docker: add ability to configure custom network

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2024-08-19 11:02:48 +02:00
parent 04b78168fd
commit bf869e93a4
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
2 changed files with 13 additions and 1 deletions

View File

@ -1,4 +1,4 @@
---
postgres_ha_service_name: 'postgres-ha'
postgres_ha_service_path: '/docker/{{ postgres_ha_service_name }}'
postgres_ha_compose_file: '{{ postgres_ha_service_path }}/docker-compose.yml'
@ -8,6 +8,7 @@ postgres_ha_cont_data_vol: '{{ postgres_ha_service_path }}/data'
postgres_ha_cont_init_vol: '{{ postgres_ha_service_path }}/init'
postgres_ha_cont_backup_vol: '{{ postgres_ha_service_path }}/backup'
postgres_ha_cont_image: 'postgres:15.1-alpine'
postgres_ha_cont_networks: []
postgres_ha_cont_port: 5432
postgres_ha_cont_uid: 70
postgres_ha_host_uid: '{{ 100000 + postgres_ha_cont_uid | int }}'

View File

@ -14,6 +14,9 @@ services:
{% endif %}
# This fixes chmod errors on DB startup due to volume + userns-remap
PGDATA: '/var/lib/postgresql/data/pgdata'
{% if postgres_ha_cont_networks %}
networks: {{ postgres_ha_cont_networks | to_json }}
{% endif %}
ports:
- '{{ postgres_ha_cont_port }}:{{ postgres_ha_cont_port }}'
tmpfs:
@ -33,3 +36,11 @@ services:
'-p', '{{ postgres_ha_cont_port }}',
'-U', '{{ postgres_ha_admin_user }}'
]
{% if postgres_ha_cont_networks != [] %}
networks:
{% for network in postgres_ha_cont_networks %}
{{ network }}:
external: true
{% endfor %}
{% endif %}