Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Add support for Redis configuration #98

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions roles/artemis/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
##############################################################################
Expand Down
21 changes: 6 additions & 15 deletions roles/artemis/tasks/docker_deploy_artemis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions roles/artemis/templates/application-prod.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
10 changes: 10 additions & 0 deletions roles/artemis/templates/artemis.env.j2
Original file line number Diff line number Diff line change
@@ -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 }}'
Expand All @@ -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 }}'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SPRING_DATA_REDIS_CLIENTNAME='{{ artemis_eureka_instance_id }}'
SPRING_DATA_REDIS_CLIENTNAME='{{ artemis_redis_client_name }}'

{% endif %}
{% if is_multinode_install and hazelcast_address is defined %}
SPRING_HAZELCAST_INTERFACE='{{ hazelcast_address }}'
{% endif %}
Expand Down
5 changes: 5 additions & 0 deletions roles/artemis/templates/docker.env.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}'
Expand Down
3 changes: 3 additions & 0 deletions roles/artemis/templates/node.env.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Loading