forked from hardware/mailserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.sample.yml
166 lines (156 loc) · 5.88 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
version: "3"
# 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:1.7-alpine
restart: ${RESTART_MODE}
ports:
- "80:80"
- "443:443"
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:mail.${MAILSERVER_DOMAIN}
- traefik.port=8080
- traefik.docker.network=http_network
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ${VOLUMES_ROOT_PATH}/traefik/traefik.toml:/traefik.toml:ro
- ${VOLUMES_ROOT_PATH}/traefik/acme:/etc/traefik/acme
networks:
- http_network
mailserver:
image: hardware/mailserver:${MAILSERVER_DOCKER_TAG}
restart: ${RESTART_MODE}
domainname: ${MAILSERVER_DOMAIN} # Mail server A/MX/FQDN & reverse PTR = mail.domain.tld.
hostname: ${MAILSERVER_HOSTNAME}
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:spam.${MAILSERVER_DOMAIN}
- traefik.port=11334
- traefik.docker.network=http_network
# extra_hosts: - Required for external database (on other server or for local databases on host without docker)
# - "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
environment:
- DBPASS=${DATABASE_USER_PASSWORD} # MariaDB database password (required)
- RSPAMD_PASSWORD=${RSPAMD_PASSWORD} # Rspamd WebUI password (required)
# - ADD_DOMAINS=aa.tld, www.bb.tld... # 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
#
# Full list : https://github.com/hardware/mailserver#environment-variables
#
volumes:
- ${VOLUMES_ROOT_PATH}/mail:/var/mail
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: hardware/postfixadmin
restart: ${RESTART_MODE}
domainname: ${MAILSERVER_DOMAIN}
hostname: ${MAILSERVER_HOSTNAME}
labels:
- traefik.enable=true
- traefik.frontend.rule=Host:postfixadmin.${MAILSERVER_DOMAIN}
- traefik.port=8888
- traefik.docker.network=http_network
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: hardware/rainloop
restart: ${RESTART_MODE}
labels:
- traefik.enable=true
- traefik.port=8888
- traefik.frontend.rule=Host:webmail.${MAILSERVER_DOMAIN}
- traefik.docker.network=http_network
volumes:
- ${VOLUMES_ROOT_PATH}/rainloop:/rainloop/data
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.2
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
# Database
# https://github.com/docker-library/redis
# https://redis.io/
redis:
image: redis:4.0-alpine
restart: ${RESTART_MODE}
command: redis-server --appendonly yes
volumes:
- ${VOLUMES_ROOT_PATH}/redis/db:/data
networks:
- mail_network