forked from hardware/mailserver
-
Notifications
You must be signed in to change notification settings - Fork 30
/
docker-compose.sample.yml
202 lines (191 loc) · 8.49 KB
/
docker-compose.sample.yml
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
version: '3.7'
# IPv4 only
# docker network create http_network
# IPv4/IPv6 network
# docker network create http_network --ipv6 --subnet "fd00:0000:0000:0000::/64"
# Refer to https://github.com/hardware/mailserver/#ipv6-support for more information.
networks:
http_network:
external: true
mail_network:
external: false
services:
traefik:
image: "traefik:${TRAEFIK_DOCKER_TAG}"
restart: ${RESTART_MODE}
networks:
- http_network
ports:
# This allows incoming connection on 80 to be forwarder to port 80 of traefik
- "80:80"
# This allows incoming connection on 443 to be forwarder to port 443 of traefik
- "443:443"
# As above. Browse to port 8080 http to see trafik dashboard
# - "8080:8080"
volumes:
# static config
- "${VOLUMES_ROOT_PATH}/traefik/traefik.toml:/traefik.toml"
# dynamic config
- "${VOLUMES_ROOT_PATH}/traefik/file.toml:/file.toml"
# let's encrypt data
- "${VOLUMES_ROOT_PATH}/traefik/acme:/acme"
# This is required for the docker provider of traefik to work (read container labels, etc)
- "/var/run/docker.sock:/var/run/docker.sock:ro"
mailserver:
image: mailserver2/mailserver:${MAILSERVER_DOCKER_TAG}
restart: ${RESTART_MODE}
domainname: ${MAILSERVER_DOMAIN} # Mail server A/MX/FQDN & reverse PTR = mail.domain.tld.
hostname: ${MAILSERVER_HOSTNAME}
# extra_hosts: - Required for external database (on other server or for local database on host)
# - "mariadb:xx.xx.xx.xx" - Replace with IP address of MariaDB server
# - "redis:xx.xx.xx.xx" - Replace with IP address of Redis server
ports:
- "25:25" # SMTP - Required
# - "110:110" # POP3 STARTTLS - Optional - For webmails/desktop clients
- "143:143" # IMAP STARTTLS - Optional - For webmails/desktop clients
# - "465:465" # SMTPS SSL/TLS - Optional - Enabled for compatibility reason, otherwise disabled
- "587:587" # Submission STARTTLS - Optional - For webmails/desktop clients
- "993:993" # IMAPS SSL/TLS - Optional - For webmails/desktop clients
# - "995:995" # POP3S SSL/TLS - Optional - For webmails/desktop clients
- "4190:4190" # SIEVE STARTTLS - Optional - Recommended for mail filtering
# - "11334:11334" # HTTP - Optional - Rspamd WebUI
environment:
- DBPASS=${DATABASE_USER_PASSWORD} # MariaDB database password (required)
- RSPAMD_PASSWORD=${RSPAMD_PASSWORD} # Rspamd WebUI password (required)
- ADD_DOMAINS=${ADD_DOMAINS} # Add additional domains separated by commas (needed for dkim keys etc.)
# - DEBUG_MODE=true # Enable Postfix, Dovecot, Rspamd and Unbound verbose logging
# - ENABLE_POP3=true # Enable POP3 protocol
# - ENABLE_FETCHMAIL=true # Enable fetchmail forwarding
# - DISABLE_RATELIMITING=false # Enable ratelimiting policy
# - DISABLE_CLAMAV=true # Disable virus scanning
# - DISABLE_SIGNING=true # Disable DKIM/ARC signing
# - DISABLE_GREYLISTING=true # Disable greylisting policy
# - DISABLE_VHOSTS_OWNERSHIP_SET=true # Disable vhosts directory ownship set (useful, when you have lots of mailboxes)
#
# Full list : https://github.com/hardware/mailserver#environment-variables
#
labels:
- "traefik.enable=true"
- "traefik.docker.network=http_network"
- "traefik.http.routers.spam.entrypoints=websecure"
- "traefik.http.routers.spam.rule=Host(`spam.${MAILSERVER_DOMAIN}`)"
- "traefik.http.routers.spam.service=spam"
- "traefik.http.routers.spam.tls=true"
- "traefik.http.routers.spam.tls.certresolver=letsencrypt"
- "traefik.http.routers.spam.tls.domains[0].main=${MAILSERVER_HOSTNAME}.${MAILSERVER_DOMAIN}"
- "traefik.http.routers.spam.tls.domains[0].sans=spam.${MAILSERVER_DOMAIN}"
- "traefik.http.routers.spam.tls.options=default"
- "traefik.http.services.spam.loadbalancer.server.port=11334"
- "traefik.http.services.spam.loadbalancer.server.scheme=http"
volumes:
- ${VOLUMES_ROOT_PATH}/mail:/var/mail
- ${VOLUMES_ROOT_PATH}/traefik/acme:/etc/letsencrypt/acme
# Uncomment the line below, when you want whitelist some IP Addresses or domains in Postfix (please check the 'Whitelist Hosts/IP Addresses In Postfix' in README.md for more info)
# - ${VOLUMES_ROOT_PATH}/postfix/rbl_override:/etc/postfix/rbl_override
depends_on:
- mariadb
- redis
networks:
- mail_network
- http_network
# Administration interface
# https://github.com/hardware/postfixadmin
# http://postfixadmin.sourceforge.net/
# Configuration : https://github.com/hardware/mailserver/wiki/Postfixadmin-initial-configuration
postfixadmin:
image: mailserver2/postfixadmin:${POSTFIXADMIN_DOCKER_TAG}
restart: ${RESTART_MODE}
domainname: ${MAILSERVER_DOMAIN}
hostname: ${MAILSERVER_HOSTNAME}
labels:
- "traefik.enable=true"
- "traefik.docker.network=http_network"
- "traefik.http.routers.postfixadmin.entrypoints=websecure"
- "traefik.http.routers.postfixadmin.rule=Host(`postfixadmin.${MAILSERVER_DOMAIN}`)"
- "traefik.http.routers.postfixadmin.service=postfixadmin"
- "traefik.http.routers.postfixadmin.tls=true"
- "traefik.http.routers.postfixadmin.tls.certresolver=letsencrypt"
- "traefik.http.routers.postfixadmin.tls.domains[0].main=postfixadmin.${MAILSERVER_DOMAIN}"
- "traefik.http.routers.postfixadmin.tls.options=default"
- "traefik.http.services.postfixadmin.loadbalancer.server.port=8888"
- "traefik.http.services.postfixadmin.loadbalancer.server.scheme=http"
environment:
- DBPASS=${DATABASE_USER_PASSWORD}
depends_on:
- mailserver
- mariadb
networks:
- mail_network
- http_network
# Webmail (Optional)
# https://github.com/hardware/rainloop
# https://www.rainloop.net/
# Configuration : https://github.com/hardware/mailserver/wiki/Rainloop-initial-configuration
rainloop:
image: mailserver2/rainloop:${RAINLOOP_DOCKER_TAG}
restart: ${RESTART_MODE}
labels:
- "traefik.enable=true"
- "traefik.docker.network=http_network"
- "traefik.http.routers.rainloop.entrypoints=websecure"
- "traefik.http.routers.rainloop.rule=Host(`webmail.${MAILSERVER_DOMAIN}`)"
- "traefik.http.routers.rainloop.service=rainloop"
- "traefik.http.routers.rainloop.tls=true"
- "traefik.http.routers.rainloop.tls.certresolver=letsencrypt"
- "traefik.http.routers.rainloop.tls.domains[0].main=webmail.${MAILSERVER_DOMAIN}"
- "traefik.http.routers.rainloop.tls.options=default"
- "traefik.http.services.rainloop.loadbalancer.server.port=8888"
- "traefik.http.services.rainloop.loadbalancer.server.scheme=http"
volumes:
- ${VOLUMES_ROOT_PATH}/rainloop:/rainloop/data
#environment:
#LOG_TO_STDOUT: "true"
depends_on:
- mailserver
- mariadb
networks:
- mail_network
- http_network
# Authoritative DNS server (Optional)
# https://github.com/hardware/nsd-dnssec
# https://www.nlnetlabs.nl/projects/nsd/
# Configuration : https://github.com/hardware/mailserver/wiki/NSD-initial-configuration
# nsd:
# image: hardware/nsd-dnssec
# restart: ${RESTART_MODE}
# ports:
# - "53:53"
# - "53:53/udp"
# volumes:
# - ${VOLUMES_ROOT_PATH}/nsd/conf:/etc/nsd
# - ${VOLUMES_ROOT_PATH}/nsd/zones:/zones
# - ${VOLUMES_ROOT_PATH}/nsd/db:/var/db/nsd
# Database
# https://github.com/docker-library/mariadb
# https://mariadb.org/
mariadb:
image: mariadb:10.5
restart: ${RESTART_MODE}
# Info : These variables are ignored when the volume already exists (if databases was created before).
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- MYSQL_DATABASE=postfix
- MYSQL_USER=postfix
- MYSQL_PASSWORD=${DATABASE_USER_PASSWORD}
volumes:
- ${VOLUMES_ROOT_PATH}/mysql/db:/var/lib/mysql
networks:
- mail_network
# Cache Database
# https://github.com/docker-library/redis.
# https://redis.io/
redis:
image: redis:6.0-alpine
restart: ${RESTART_MODE}
command: redis-server --appendonly yes
sysctls:
- net.core.somaxconn=1024
volumes:
- ${VOLUMES_ROOT_PATH}/redis/db/:/data
networks:
- mail_network