Skip to content

Commit

Permalink
[IMP] Use unique db service name for project, version and environment
Browse files Browse the repository at this point in the history
  • Loading branch information
josep-tecnativa committed Jan 29, 2025
1 parent 772d808 commit eaa7e05
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions devel.yaml.jinja
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{%- import "_macros.jinja" as macros -%}
{%- import "_traefik2_labels.yml.jinja" as traefik2_labels -%}
{%- set _key = traefik2_labels.key(project_name, odoo_version, "test") -%}
{% set whitelisted_hosts = (
"cdnjs.cloudflare.com",
"fonts.googleapis.com",
Expand Down Expand Up @@ -56,7 +58,7 @@ services:
- ./odoo/custom:/opt/odoo/custom:ro,z
- ./odoo/auto:/opt/odoo/auto:rw,z
depends_on:
- db
- {{ _key }}-db
{% for host in whitelisted_hosts -%}
- proxy_{{ host|replace(".", "_") }}
{% endfor -%}
Expand All @@ -77,7 +79,7 @@ services:
{%- endif %}

{% if postgres_version -%}
db:
{{ _key }}-db:
extends:
file: common.yaml
service: db
Expand All @@ -92,9 +94,9 @@ services:
ports:
- "127.0.0.1:{{ macros.version_major(odoo_version) }}081:8081"
environment:
DATABASE_URL: postgres://{{ postgres_username }}:odoopassword@db:5432/devel?sslmode=disable
DATABASE_URL: postgres://{{ postgres_username }}:odoopassword@{{ _key }}-db:5432/devel?sslmode=disable
depends_on:
- db
- {{ _key }}-db

smtp:
extends:
Expand Down
6 changes: 3 additions & 3 deletions prod.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
SMTP_SERVER: smtplocal
{%- endif %}
depends_on:
- db
- {{ _key }}-db
{%- if smtp_relay_host %}
- smtp
{%- endif %}
Expand Down Expand Up @@ -83,7 +83,7 @@ services:
{%- endif %}

{% if postgres_version -%}
db:
{{ _key }}-db:
extends:
file: common.yaml
service: db
Expand Down Expand Up @@ -137,7 +137,7 @@ services:
- .docker/db-access.env
restart: unless-stopped
depends_on:
- db
- {{ _key }}-db
{%- if smtp_relay_host %}
- smtp
{%- endif %}
Expand Down
4 changes: 2 additions & 2 deletions test.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
hostname: {{ macros.first_main_domain(domains_test)|tojson }}
{%- endif %}
depends_on:
- db
- {{ _key }}-db
- smtp
networks:
default:
Expand Down Expand Up @@ -57,7 +57,7 @@ services:
- --max-cron-threads=1

{% if postgres_version -%}
db:
{{ _key }}-db:
extends:
file: common.yaml
service: db
Expand Down

0 comments on commit eaa7e05

Please sign in to comment.