From 329bca69c01a8815df547b83ced7efa23cce3f96 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 13 Oct 2020 19:26:55 +0200 Subject: [PATCH] Fix the database hostname --- defaults/main.yml | 2 +- tasks/main.yml | 35 +++++++++++------------ templates/open-asfa-docker-compose.yml.j2 | 2 +- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 1f189c2..5c61060 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -9,7 +9,7 @@ open_asfa_docker_network: 'open_asfa_net' open_asfa_behind_haproxy: True open_asfa_haproxy_public_net: 'haproxy-public' # DB -open_asfa_db_image: 'postgres:12-alpine' +open_asfa_db_image: 'postgres:12' #open_asfa_db_pwd: 'set it in a vault file' open_asfa_db_name: 'asfadb' open_asfa_db_user: 'asfadb_user' diff --git a/tasks/main.yml b/tasks/main.yml index bde0792..e568d05 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,27 +1,24 @@ --- - name: Manage the installation of the OpenASFA configuration of the swarm service block: - - name: Create the directory where the dockerfile and the configuration file will be copied into - file: dest={{ open_asfa_compose_dir }} state=directory + - name: Create the directory where the dockerfile and the configuration file will be copied into + file: dest={{ open_asfa_compose_dir }} state=directory - - name: Install the docker compose file - template: src=open-asfa-docker-compose.yml.j2 dest={{ open_asfa_compose_dir }}/docker-open-asfa-stack.yml + - name: Install the docker compose file + template: src=open-asfa-docker-compose.yml.j2 dest={{ open_asfa_compose_dir }}/docker-open-asfa-stack.yml owner=root group=root mode='0400' - - name: Start the OpenAsfa stack - docker_stack: - name: open-asfa - state: present - compose: - - '{{ open_asfa_compose_dir }}/docker-open-asfa-stack.yml' + - name: Start the OpenAsfa stack + docker_stack: + name: open-asfa + state: present + compose: + - '{{ open_asfa_compose_dir }}/docker-open-asfa-stack.yml' - - name: Connect the OpenASFA service to the haproxy-public network - command: docker service update --network-add {{ open_asfa_haproxy_public_net }} {{ open_asfa_docker_service_name }}_{{ open_asfa_docker_service_server_name }} --update-delay 30s --update-parallelism 1 - run_once: True - ignore_errors: True - when: open_asfa_behind_haproxy + - name: Connect the OpenASFA service to the haproxy-public network + command: docker service update --network-add {{ open_asfa_haproxy_public_net }} {{ open_asfa_docker_service_name }}_{{ open_asfa_docker_service_server_name }} --update-delay 30s --update-parallelism 1 + ignore_errors: True + when: open_asfa_behind_haproxy run_once: True - when: - - docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool - - shinyproxy_container_backend == 'docker-swarm' - tags: [ 'shinyproxy', 'shinyproxy_swarm', 'docker' ] + when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool + tags: [ 'open_asfa', 'open_asfa_swarm' ] diff --git a/templates/open-asfa-docker-compose.yml.j2 b/templates/open-asfa-docker-compose.yml.j2 index e5fc7f2..8cc14c2 100644 --- a/templates/open-asfa-docker-compose.yml.j2 +++ b/templates/open-asfa-docker-compose.yml.j2 @@ -9,7 +9,7 @@ services: - asfa_pg environment: SERVER_PORT: 8080 - DB_HOST: localhost + DB_HOST: {{ open_asfa_docker_service_server_name }}_asfa_pg DB_PORT: 5432 SCHEMA: {{ open_asfa_db_name }} DB_USER: {{ open_asfa_db_user }}