forked from Tecnativa/doodba-copier-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.yaml.jinja
154 lines (147 loc) · 4.54 KB
/
test.yaml.jinja
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{%- import "_macros.jinja" as macros -%}
{%- import "_traefik1_labels.yml.jinja" as traefik1_labels -%}
{%- import "_traefik2_labels.yml.jinja" as traefik2_labels -%}
{%- import "_traefik3_labels.yml.jinja" as traefik3_labels -%}
{%- set _key = traefik2_labels.key(project_name, odoo_version, "test") -%}
version: "2.4"
services:
odoo:
extends:
file: common.yaml
service: odoo
env_file:
- .docker/odoo.env
- .docker/db-access.env
environment:
DOODBA_ENVIRONMENT: "${DOODBA_ENVIRONMENT-test}"
# To install demo data export DOODBA_WITHOUT_DEMO=false
WITHOUT_DEMO: "${DOODBA_WITHOUT_DEMO-all}"
SMTP_PORT: "1025"
SMTP_SERVER: smtplocal
restart: unless-stopped
{%- if domains_test %}
hostname: {{ macros.first_main_domain(domains_test)|tojson }}
{%- endif %}
depends_on:
{% if postgres_version -%}
- db
{%- endif %}
- smtp
networks:
default:
globalwhitelist_shared:
{%- if odoo_proxy == "traefik" and domains_test %}
inverseproxy_shared:
{%- endif %}
labels:
doodba.domain.main: {{ macros.first_main_domain(domains_test)|tojson }}
{%- if odoo_proxy == "traefik" and domains_test %}
traefik.enable: "true"
{{- traefik1_labels.odoo(domains_test, ["/"], odoo_version) }}
{{- traefik2_labels.odoo(
domains_test,
cidr_whitelist,
_key,
odoo_version,
["/"],
project_name,
) }}
{%- endif %}
command:
- odoo
- --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:
file: common.yaml
service: smtpfake
restart: unless-stopped
networks:
default:
aliases:
- smtplocal
{%- if odoo_proxy == "traefik" and domains_test %}
inverseproxy_shared:
{%- endif %}
labels:
doodba.domain.main: {{ macros.first_main_domain(domains_test)|tojson }}
{%- if odoo_proxy == "traefik" and domains_test %}
traefik.docker.network: "inverseproxy_shared"
traefik.enable: "true"
{#- Traefik v1 labels #}
traefik.frontend.passHostHeader: "true"
{%- call(domain_group) macros.domains_loop_grouped(domains_test|rejectattr("redirect_to")|rejectattr("path_prefixes")) %}
{{-
traefik1_labels.router(
prefix="mailhog",
index0=domain_group.loop.index0,
rule="%s;PathPrefixStrip:/smtpfake/"|format(
traefik1_labels.domains_rule(domain_group.hosts),
),
entrypoints=domain_group.entrypoints,
port=8025,
)
}}
{%- endcall %}
{#- Traefik v2 labels #}
# Mailhog service
traefik.http.middlewares.{{ _key }}-mailhog-stripprefix.stripPrefix.prefixes: /smtpfake/
traefik.http.services.{{ _key }}-mailhog.loadbalancer.server.port: 8025
{{- traefik2_labels.common_middlewares(_key, cidr_whitelist) }}
{%- call(domain_group) macros.domains_loop_grouped(domains_test|rejectattr("redirect_to")|rejectattr("path_prefixes")) %}
{#- Remember basic middlewares for this domain group #}
{%- set _ns = namespace(basic_middlewares=[]) -%}
{%- if cidr_whitelist %}
{%- set _ns.basic_middlewares = _ns.basic_middlewares + ["whitelist"] %}
{%- endif %}
{%- if domain_group.cert_resolver %}
{%- set _ns.basic_middlewares = _ns.basic_middlewares + ["addSTS", "forceSecure"] %}
{%- endif %}
{{-
traefik2_labels.router(
domain_group=domain_group,
key=_key,
suffix="mailhog",
rule="%s && PathPrefix(`/smtpfake/`)"|format(traefik2_labels.domains_rule(domain_group)),
service="mailhog",
middlewares=_ns.basic_middlewares + [
"buffering",
"compress",
"forbid-crawlers",
"mailhog-stripprefix",
],
)
}}
{%- endcall %}
{%- endif %}
volumes:
- "smtpconf:/etc/mailhog:ro,z"
entrypoint: [sh, -c]
command:
- test -r /etc/mailhog/auth && export MH_AUTH_FILE=/etc/mailhog/auth; exec MailHog
networks:
default:
internal: ${DOODBA_NETWORK_INTERNAL-true}
driver_opts:
encrypted: 1
globalwhitelist_shared:
external: true
{%- if odoo_proxy == "traefik" %}
inverseproxy_shared:
external: true
{%- endif %}
volumes:
filestore:
{% if postgres_version -%}
db:
{%- endif %}
smtpconf: