Skip to content

Commit

Permalink
Odoo service in prod and test only depends on db if not using externa…
Browse files Browse the repository at this point in the history
…l db

Fixes #150 (comment)

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.
  • Loading branch information
joao-p-marques committed Feb 12, 2021
1 parent e9f86bf commit fc34ad5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
4 changes: 1 addition & 3 deletions common.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -43,7 +42,6 @@ services:
work_mem = 512MB
volumes:
- db:/var/lib/postgresql/data:z
{%- endif %}

smtpfake:
image: mailhog/mailhog
Expand Down
2 changes: 0 additions & 2 deletions devel.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,13 @@ services:
- --dev=reload,qweb,werkzeug,xml
{%- endif %}

{% if postgres_version -%}
db:
extends:
file: common.yaml
service: db
environment:
POSTGRES_DB: *dbname
POSTGRES_PASSWORD: odoopassword
{%- endif %}

pgweb:
image: sosedoff/pgweb
Expand Down
5 changes: 4 additions & 1 deletion prod.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ services:
SMTP_SERVER: smtplocal
{%- endif %}
depends_on:
{%- if postgres_version %}
- db
{%- endif %}
{%- if smtp_relay_host %}
- smtp
{%- endif %}
Expand All @@ -45,7 +47,8 @@ services:
) }}
{%- endif %}

{% if postgres_version -%}
{%- if postgres_version %}

db:
extends:
file: common.yaml
Expand Down
2 changes: 0 additions & 2 deletions test.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ services:
- --workers=2
- --max-cron-threads=1

{% if postgres_version -%}
db:
extends:
file: common.yaml
service: db
env_file:
- .docker/db-creation.env
restart: unless-stopped
{%- endif %}

smtp:
extends:
Expand Down

0 comments on commit fc34ad5

Please sign in to comment.