-
Notifications
You must be signed in to change notification settings - Fork 115
/
common.yaml.jinja
116 lines (111 loc) · 3.79 KB
/
common.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
{% import "_macros.jinja" as macros -%}
version: "2.4"
services:
odoo:
{%- if odoo_oci_image %}
image: {{ odoo_oci_image }}:{{ macros.version_minor(odoo_version) }}
{%- endif %}
build:
context: ./odoo
args:
{%- if odoo_version >= 11 %}
DB_VERSION: "{{ postgres_version or 'latest' }}"
{%- endif %}
ODOO_VERSION: "{{ macros.version_minor(odoo_version) }}"
UID: "${UID:-1000}"
GID: "${GID:-1000}"
environment:
EMAIL_FROM: "{{ smtp_default_from|default("", true) }}"
PGDATABASE: &dbname {{ postgres_dbname }}
PGUSER: &dbuser "{{ postgres_username }}"
PROXY_MODE: "{% if odoo_proxy %}true{% else %}false{% endif %}"
LIST_DB: "{{ odoo_listdb | tojson }}"
tty: true
volumes:
- filestore:/var/lib/odoo:z
{%- if odoo_proxy == "traefik" %}
labels:
traefik.backend.buffering.retryExpression: IsNetworkError() && Attempts() < 5
traefik.docker.network: "inverseproxy_shared"
traefik.frontend.passHostHeader: "true"
traefik.port: "8069"
{%- endif %}
{% if postgres_version -%}
db:
image: ghcr.io/tecnativa/postgres-autoconf:{{ postgres_version }}-alpine
shm_size: 4gb
environment:
POSTGRES_DB: *dbname
POSTGRES_USER: *dbuser
CONF_EXTRA: |
work_mem = 512MB
volumes:
- db:/var/lib/postgresql/data:z
{%- endif %}
smtpfake:
image: docker.io/mailhog/mailhog
{%- if smtp_relay_host %}
smtpreal:
image: ghcr.io/docker-mailserver/docker-mailserver:{{ smtp_relay_version }}
hostname: "smtp.{{ smtp_canonical_default }}"
stop_grace_period: 1m
volumes:
- mailconfig:/tmp/docker-mailserver:z
- maildata:/var/mail:z
- maillogs:/var/log/mail:z
- maillogssupervisord:/var/log/supervisor:z
- mailstate:/var/mail-state:z
cap_add:
- SYS_PTRACE
environment:
DEFAULT_RELAY_HOST: "[{{ smtp_relay_host }}]:{{ smtp_relay_port }}"
{% if smtp_relay_version|float < 11.0 -%}
DMS_DEBUG: 0
{% else %}
LOG_LEVEL: info
{%- endif %}
ENABLE_SRS: 1
ONE_DIR: 1
PERMIT_DOCKER: connected-networks
POSTFIX_INET_PROTOCOLS: ipv4
POSTFIX_MESSAGE_SIZE_LIMIT: 52428800 # 50 MiB
RELAY_HOST: "{{ smtp_relay_host }}"
RELAY_PORT: "{{ smtp_relay_port }}"
RELAY_USER: "{{ smtp_relay_user }}"
SMTP_ONLY: 1
SRS_DOMAINNAME: "{{ smtp_canonical_default }}"
SRS_EXCLUDE_DOMAINS: "{{
([smtp_canonical_default] + (smtp_canonical_domains or []))
|unique|sort|join(",")
}}"
SRS_SENDER_CLASSES: envelope_sender,header_sender
{%- endif %}
{%- if backup_dst and postgres_version|int >= 10 %}
backup:
image: ghcr.io/tecnativa/docker-duplicity-postgres{% if backup_dst.startswith(('boto3+s3://', 's3://', 's3+http://')) %}-s3{% endif %}:{{ backup_image_version }}
hostname: backup.{% if domains_prod %}{{ macros.first_main_domain(domains_prod) }}{% else %}{{ project_name|replace('.','-') }}{% endif %}
init: true
environment:
DB_VERSION: "{{ postgres_version or 'latest' }}"
DBS_TO_INCLUDE: "{{ odoo_dbfilter | replace('$', '$$') | replace('%d', '.*') | replace('%h', '.*') }}"
DST: "{{ backup_dst }}"
{%- if smtp_relay_host %}
EMAIL_FROM: "{{ backup_email_from }}"
EMAIL_TO: "{{ backup_email_to }}"
{%- endif %}
{%- if backup_deletion %}
JOB_500_WHAT: dup full $$SRC $$DST
JOB_500_WHEN: weekly
JOB_800_WHAT: dup --force remove-older-than 3M $$DST
JOB_800_WHEN: weekly
{%- endif %}
PGDATABASE: *dbname
PGUSER: *dbuser
{%- if smtp_relay_host %}
SMTP_HOST: smtplocal
{%- endif %}
TZ: "{{ backup_tz }}"
volumes:
- backup_cache:/root:z
- filestore:/mnt/backup/src/odoo:z
{%- endif %}