forked from Tecnativa/doodba-copier-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prod.yaml.jinja
165 lines (157 loc) · 4.24 KB
/
prod.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
155
156
157
158
159
160
161
162
163
164
165
{%- import "_macros.jinja" as macros -%}
{%- import "_traefik1_labels.yml.jinja" as traefik1_labels -%}
{%- import "_traefik1_paths_labels.yml.jinja" as traefik1_path_labels -%}
{%- import "_traefik2_labels.yml.jinja" as traefik2_labels -%}
{%- import "_traefik2_hosts_labels.yml.jinja" as traefik2_hosts_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, "prod") -%}
version: "2.4"
services:
odoo:
extends:
file: common.yaml
service: odoo
restart: unless-stopped
{%- if domains_prod %}
hostname: {{ macros.first_main_domain(domains_prod)|tojson }}
{%- endif %}
env_file:
- .docker/odoo.env
- .docker/db-access.env
environment:
DB_FILTER: "{{ odoo_dbfilter | replace('$', '$$') }}"
DOODBA_ENVIRONMENT: "${DOODBA_ENVIRONMENT-prod}"
INITIAL_LANG: "{{ odoo_initial_lang }}"
{%- if smtp_relay_host %}
SMTP_SERVER: smtplocal
{%- endif %}
depends_on:
- db
{%- if smtp_relay_host %}
- smtp
{%- endif %}
networks:
default:
{%- if odoo_proxy == "traefik" and domains_prod %}
inverseproxy_shared:
{%- endif %}
labels:
doodba.domain.main: {{ macros.first_main_domain(domains_prod)|tojson }}
{%- if odoo_proxy == "traefik" and domains_prod %}
traefik.enable: "true"
{%- if traefik_version == 3 -%}
{{- traefik3_labels.odoo(domains_prod, paths_without_crawlers, odoo_version, traefik_version)}}
{%- elif traefik_version == 2 -%}
{{- traefik2_hosts_labels.odoo(domains_prod, paths_without_crawlers, odoo_version)}}
{%- else -%}
{{- traefik1_labels.odoo(domains_prod, paths_without_crawlers, odoo_version)}}
{%- endif -%}
{{- traefik2_labels.common_middlewares(_key, cidr_whitelist) }}
{%- if traefik_version == 3 -%}
{{- traefik3_labels_2.odoo(
domains_prod,
cidr_whitelist,
_key,
odoo_version,
paths_without_crawlers,
project_name,
) }}
{%- elif traefik_version == 2 -%}
{{- traefik2_labels.odoo(
domains_prod,
cidr_whitelist,
_key,
odoo_version,
paths_without_crawlers,
project_name,
) }}
{%- else -%}
{{- traefik1_path_labels.odoo(
domains_prod,
cidr_whitelist,
_key,
odoo_version,
paths_without_crawlers,
project_name,
) }}
{%- endif %}
{%- endif %}
{% if postgres_version -%}
db:
extends:
file: common.yaml
service: db
env_file:
- .docker/db-creation.env
restart: unless-stopped
{%- if postgres_exposed %}
{%- if traefik_version == 3 %}
networks:
default:
inverseproxy_shared:
labels:
traefik.enable: "true"
traefik.docker.network: "inverseproxy_shared"
{{- traefik3_labels_2.database(
domains_prod,
postgres_cidr_whitelist,
_key,
postgres_exposed_port,
project_name,
) }}
{%- else %}
ports:
- "{{ postgres_exposed_port }}:5432"
{%- endif %}
{%- endif %}
{%- endif %}
{%- if smtp_relay_host %}
smtp:
extends:
file: common.yaml
service: smtpreal
env_file:
- .docker/smtp.env
networks:
default:
aliases:
- smtplocal
restart: unless-stopped
{%- endif %}
{%- if backup_dst and postgres_version|int >= 10 %}
backup:
extends:
file: common.yaml
service: backup
env_file:
- .docker/backup.env
- .docker/db-access.env
restart: unless-stopped
depends_on:
- db
{%- if smtp_relay_host %}
- smtp
{%- endif %}
{%- endif %}
networks:
default:
driver_opts:
encrypted: 1
{%- if odoo_proxy == "traefik" %}
inverseproxy_shared:
external: true
{%- endif %}
volumes:
{%- if backup_dst %}
backup_cache:
{%- endif %}
filestore:
db:
{%- if smtp_relay_host %}
mailconfig:
maildata:
maillogs:
maillogssupervisord:
mailstate:
{%- endif %}