ansible-role-open-asfa-test/templates/open-asfa-db-docker-compose...

110 lines
2.8 KiB
Django/Jinja

version: '3.6'
networks:
{% if open_asfa_behind_haproxy %}
haproxy-public:
external: true
{% endif %}
{{ open_asfa_docker_network }}:
volumes:
{{ open_asfa_pgadmin_data_vol }}:
{% if open_asfa_pgadmin_volume_type == "nfs4" %}
driver: local
driver_opts:
type: {{ open_asfa_pgadmin_volume_type }}
o: "{{ open_asfa_pgadmin_volume_o }}"
device: "{{ open_asfa_pgadmin_volume_device }}"
{% endif %}
{{ open_asfa_db_volume }}:
{% if open_asfa_pg_volume_type == "nfs4" %}
driver: local
driver_opts:
type: {{ open_asfa_pg_volume_type }}
o: "{{ open_asfa_pg_volume_o }}"
device: "{{ open_asfa_pg_volume_device }}"
{% endif %}
secrets:
open_asfa_test_pgadmin_config:
external: true
open_asfa_test_pgadmin_servers:
external: true
open_asfa_test_pg_config:
external: true
services:
pg:
image: {{ open_asfa_db_image }}
networks:
- {{ open_asfa_docker_network }}
volumes:
- {{ open_asfa_db_volume }}:/var/lib/postgresql/data/pg_data
environment:
POSTGRES_PASSWORD: {{ open_asfa_db_pwd }}
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PORT: {{ open_asfa_db_port }}
PGDATA: /var/lib/postgresql/data/pg_data
secrets:
- source: open_asfa_test_pg_config
target: /docker-entrypoint-initdb.d/pg-create-user-db.sh
mode: 0555
deploy:
placement:
{% if open_asfa_pg_volume_type == "nfs4" %}
constraints: [node.role == worker]
{% else %}
constraints: {{ open_asfa_db_constraints }}
{% endif %}
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
logging:
driver: 'journald'
pgadmin:
image: {{ open_asfa_pgadmin_image }}
networks:
- {{ open_asfa_docker_network }}
{% if open_asfa_behind_haproxy %}
- haproxy-public
{% endif %}
volumes:
- {{ open_asfa_pgadmin_data_vol }}:/var/lib/pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: {{ open_asfa_pgadmin_email }}
PGADMIN_DEFAULT_PASSWORD: {{ open_asfa_pgadmin_default_pwd }}
PGADMIN_DISABLE_POSTFIX: disable
#PGADMIN_ENABLE_TLS: enable
PGADMIN_LISTEN_ADDRESS: 0.0.0.0
PGADMIN_LISTEN_PORT: 5050
GUNICORN_THREADS: 20
secrets:
- source: open_asfa_test_pgadmin_config
target: /pgadmin4/config_local.py
mode: 0444
- source: open_asfa_test_pgadmin_servers
target: /pgadmin4/servers.json
mode: 0444
deploy:
placement:
{% if open_asfa_pgadmin_volume_type == "nfs4" %}
constraints: [node.role == worker]
{% else %}
constraints: {{ open_asfa_pgadmin_constraints }}
{% endif %}
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
logging:
driver: 'journald'