diff --git a/roles/artemis/defaults/main.yml b/roles/artemis/defaults/main.yml index 9b4b282..e8148ef 100644 --- a/roles/artemis/defaults/main.yml +++ b/roles/artemis/defaults/main.yml @@ -226,6 +226,14 @@ hazelcast_address: "{% if is_multinode_install is defined and is_multinode_insta artemis_eureka_urls: "{% if registry.url is defined and registry.url is not none %}http://admin:${jhipster.registry.password}@{{ registry.url }}:8761/eureka/{% endif %}" artemis_eureka_instance_id: "{{ node_id }}" +artemis_redis_client_name: "{% if artemis_redis_client_name is defined %}{{ artemis_redis_client_name }}{% else %}{{ artemis_eureka_instance_id }}{% endif %}" + +#redis: +# host: +# port: +# username: +# password: + ############################################################################## # Iris Configuration ############################################################################## diff --git a/roles/artemis/tasks/docker_deploy_artemis.yml b/roles/artemis/tasks/docker_deploy_artemis.yml index 80adb82..7bc56d7 100644 --- a/roles/artemis/tasks/docker_deploy_artemis.yml +++ b/roles/artemis/tasks/docker_deploy_artemis.yml @@ -8,23 +8,14 @@ - name: Create artemis data directory become: true file: - path: "{{ artemis_working_directory }}/data" - state: directory - mode: '0770' - -- name: Create artemis database directory - become: true - file: - path: "{{ artemis_working_directory }}/data/database" - state: directory - mode: '0770' - -- name: Create artemis data/artemis directory - become: true - file: - path: "{{ artemis_working_directory }}/data/artemis" + path: "{{ artemis_working_directory }}/{{ item }}" state: directory mode: '0770' + loop: + - "data" + - "data/database" + - "data/artemis" + - "data/redis" - name: Set permissions for artemis directory become: true diff --git a/roles/artemis/templates/application-prod.yml.j2 b/roles/artemis/templates/application-prod.yml.j2 index 939b90c..e969762 100644 --- a/roles/artemis/templates/application-prod.yml.j2 +++ b/roles/artemis/templates/application-prod.yml.j2 @@ -32,6 +32,17 @@ spring: addresses: "{{ broker.url }}:61613" {% endif %} {% endif %} + +{% if redis is defined and redis is not none %} + data: + redis: + host: {{ redis.host }} + port: {{ redis.port}} + username: {{ redis.username}} + password: {{ redis.password }} + client-name: {{ artemis_redis_client_name }} +{% endif %} + {% if is_multinode_install and hazelcast_address is defined %} hazelcast: interface: "{{ hazelcast_address }}" diff --git a/roles/artemis/templates/artemis.env.j2 b/roles/artemis/templates/artemis.env.j2 index a91ed9a..8ed26a2 100644 --- a/roles/artemis/templates/artemis.env.j2 +++ b/roles/artemis/templates/artemis.env.j2 @@ -1,6 +1,7 @@ SPRING_PROFILES_ACTIVE: '{{ artemis_spring_profiles }}' _JAVA_OPTIONS: '-Xmx3g -Xms1g' +{% if artemis_computed_is_core_node %} SPRING_DATASOURCE_TYPE='com.zaxxer.hikari.HikariDataSource' SPRING_DATASOURCE_URL='jdbc:{{ artemis_database_type }}://{{ artemis_database_host }}:{{ artemis_database_port }}/{{ artemis_database_dbname }}?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC' SPRING_DATASOURCE_USERNAME='{{ artemis_database_username }}' @@ -22,6 +23,15 @@ SPRING_WEBSOCKET_BROKER_USERNAME='{{ broker.username }}' SPRING_WEBSOCKET_BROKER_PASSWORD='{{ broker.password }}' SPRING_WEBSOCKET_BROKER_ADDRESSES='{{ broker.url }}:61613' {% endif %} +{% endif %} + +{% if redis is defined and redis is not none %} +SPRING_DATA_REDIS_HOST='{{ redis.host }}' +SPRING_DATA_REDIS_PORT='{{ redis.port}}' +SPRING_DATA_REDIS_USERNAME='{{ redis.username}}' +SPRING_DATA_REDIS_PASSWORD='{{ redis.password }}' +SPRING_DATA_REDIS_CLIENTNAME='{{ artemis_eureka_instance_id }}' +{% endif %} {% if is_multinode_install and hazelcast_address is defined %} SPRING_HAZELCAST_INTERFACE='{{ hazelcast_address }}' {% endif %} diff --git a/roles/artemis/templates/docker.env.j2 b/roles/artemis/templates/docker.env.j2 index 793e5b1..1df5381 100644 --- a/roles/artemis/templates/docker.env.j2 +++ b/roles/artemis/templates/docker.env.j2 @@ -15,6 +15,11 @@ ARTEMIS_DATA_EXPORT_MOUNT='{{ artemis_working_directory }}/data-exports' DATABASE_ENV_FILE='{{ artemis_working_directory }}/database.env' DATABASE_VOLUME_MOUNT='{{ artemis_working_directory }}/data/database' +{% if redis is defined and redis is not none %} +REDIS_DATA_VOLUME='{{ artemis_working_directory }}/data/redis' +REDIS_PASSWORD='{{ redis.password }}' +{% endif %} + # Broker & Registry vars {% if is_multinode_install %} REGISTRY_PASSWORD='{{ artemis_jhipster_registry_password }}' diff --git a/roles/artemis/templates/node.env.j2 b/roles/artemis/templates/node.env.j2 index 6f752a7..b201fae 100644 --- a/roles/artemis/templates/node.env.j2 +++ b/roles/artemis/templates/node.env.j2 @@ -2,3 +2,6 @@ SPRING_PROFILES_ACTIVE='{{ artemis_spring_profiles }}{% if docker_node_id == 1 % EUREKA_INSTANCE_INSTANCEID='Artemis:{{ docker_node_id }}' EUREKA_INSTANCE_HOSTNAME='artemis-app-node-{{ docker_node_id }}' SPRING_HAZELCAST_INTERFACE='artemis-app-node-{{ docker_node_id }}' +{% if redis is defined and redis is not none %} +SPRING_DATA_REDIS_CLIENTNAME='{{ artemis_redis_client_name }}' +{% endif %}