Skip to content

Commit 8b2c66d

Browse files
[IMP] Use network alias as an alternative to db service unique name
1 parent d625427 commit 8b2c66d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

prod.yaml.jinja

+10
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ services:
3030
{%- if smtp_relay_host %}
3131
SMTP_SERVER: smtplocal
3232
{%- endif %}
33+
PGHOST: {{ _key }}-db
3334
depends_on:
3435
- db
3536
{%- if smtp_relay_host %}
@@ -87,13 +88,17 @@ services:
8788
extends:
8889
file: common.yaml
8990
service: db
91+
environment:
92+
- DB_HOST={{ _key }}-db
9093
env_file:
9194
- .docker/db-creation.env
9295
restart: unless-stopped
9396
{%- if postgres_exposed %}
9497
{%- if traefik_version == 3 %}
9598
networks:
9699
default:
100+
aliases:
101+
- "{{ _key }}-db"
97102
inverseproxy_shared:
98103
labels:
99104
traefik.enable: "true"
@@ -109,6 +114,11 @@ services:
109114
ports:
110115
- "{{ postgres_exposed_port }}:5432"
111116
{%- endif %}
117+
{%- else %}
118+
networks:
119+
default:
120+
aliases:
121+
- "{{ _key }}-db"
112122
{%- endif %}
113123
{%- endif %}
114124

0 commit comments

Comments
 (0)