From a107a056f1b9229a2faf07a1ee4a4d678a5c9096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marques?= Date: Fri, 12 Feb 2021 13:05:43 +0000 Subject: [PATCH] Odoo service in prod and test only depends on db if not using external db Fixes https://github.com/Tecnativa/doodba-copier-template/pull/150#issuecomment-717671877 The DB service is always created in common and imported in devel and test, but not in prod. The dependency between services also reflects that. By default, the devel and test environments will use the latest PG version. --- common.yaml.jinja | 4 +--- devel.yaml.jinja | 2 -- prod.yaml.jinja | 5 ++++- test.yaml.jinja | 2 -- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/common.yaml.jinja b/common.yaml.jinja index 85f137b8..f1cbdbc0 100644 --- a/common.yaml.jinja +++ b/common.yaml.jinja @@ -32,9 +32,8 @@ services: traefik.port: "8069" {%- endif %} - {% if postgres_version -%} db: - image: ghcr.io/tecnativa/postgres-autoconf:{{ postgres_version }}-alpine + image: ghcr.io/tecnativa/postgres-autoconf:{{ postgres_version or "13" }}-alpine shm_size: 512mb environment: POSTGRES_DB: *dbname @@ -43,7 +42,6 @@ services: work_mem = 512MB volumes: - db:/var/lib/postgresql/data:z - {%- endif %} smtpfake: image: mailhog/mailhog diff --git a/devel.yaml.jinja b/devel.yaml.jinja index fd6e58c6..26b81eef 100644 --- a/devel.yaml.jinja +++ b/devel.yaml.jinja @@ -75,7 +75,6 @@ services: - --dev=reload,qweb,werkzeug,xml {%- endif %} - {% if postgres_version -%} db: extends: file: common.yaml @@ -83,7 +82,6 @@ services: environment: POSTGRES_DB: *dbname POSTGRES_PASSWORD: odoopassword - {%- endif %} pgweb: image: sosedoff/pgweb diff --git a/prod.yaml.jinja b/prod.yaml.jinja index cf1b562b..ea6c9b24 100644 --- a/prod.yaml.jinja +++ b/prod.yaml.jinja @@ -20,7 +20,9 @@ services: SMTP_SERVER: smtplocal {%- endif %} depends_on: + {% if postgres_version -%} - db + {% endif -%} {%- if smtp_relay_host %} - smtp {%- endif %} @@ -45,7 +47,8 @@ services: ) }} {%- endif %} - {% if postgres_version -%} + {%- if postgres_version %} + db: extends: file: common.yaml diff --git a/test.yaml.jinja b/test.yaml.jinja index aadfc6bd..ce5ee26a 100644 --- a/test.yaml.jinja +++ b/test.yaml.jinja @@ -47,7 +47,6 @@ services: - --workers=2 - --max-cron-threads=1 - {% if postgres_version -%} db: extends: file: common.yaml @@ -55,7 +54,6 @@ services: env_file: - .docker/db-creation.env restart: unless-stopped - {%- endif %} smtp: extends: