Fix the database hostname

This commit is contained in:
Andrea Dell'Amico 2020-10-13 19:26:55 +02:00
parent 73314b8c2c
commit 329bca69c0
3 changed files with 18 additions and 21 deletions

View File

@ -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'

View File

@ -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' ]

View File

@ -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 }}