Skip to content

Commit

Permalink
[ADD] External connection to db for test instance
Browse files Browse the repository at this point in the history
    - Added traefik 3 labels
    - Added traefik 2 configuration
  • Loading branch information
josep-tecnativa committed Nov 21, 2024
1 parent 74b46ab commit 63a88cb
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
14 changes: 14 additions & 0 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,20 @@ postgres_cidr_whitelist:
⚠️ It must be a list. And this is only supported if you deploy with Traefik 2+.
postgres_exposed_test:
default: false
type: bool
help: >-
Do you also want to expose database service for demo?
postgres_exposed_port_test:
default: 5432
type: int
when: &db_exposed_test "{{ postgres_exposed and traefik_version != 3 }}"
help: >-
Indicate the port to connect to the demo database..
It must not be de same of production database port
odoo_dbfilter:
default: "^{{ postgres_dbname }}"
type: str
Expand Down
21 changes: 21 additions & 0 deletions test.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{%- import "_traefik1_labels.yml.jinja" as traefik1_labels -%}
{%- import "_traefik2_labels.yml.jinja" as traefik2_labels -%}
{%- import "_traefik3_labels.yml.jinja" as traefik3_labels -%}
{%- import "_traefik3_paths_labels.yml.jinja" as traefik3_labels_2 -%}
{%- set _key = traefik2_labels.key(project_name, odoo_version, "test") -%}
version: "2.4"

Expand Down Expand Up @@ -59,6 +60,26 @@ services:
env_file:
- .docker/db-creation.env
restart: unless-stopped
{%- if postgres_exposed_test %}
{%- if traefik_version == 3 %}
networks:
default:
inverseproxy_shared:
labels:
traefik.enable: "true"
traefik.docker.network: "inverseproxy_shared"
{{- traefik3_labels_2.database(
domains_test,
postgres_cidr_whitelist,
_key,
postgres_exposed_port_test,
project_name,
) }}
{%- else %}
ports:
- "{{ postgres_exposed_port_test }}:5432"
{%- endif %}
{%- endif %}
{%- endif %}

smtp:
Expand Down

0 comments on commit 63a88cb

Please sign in to comment.