maddy

Fork https://github.com/foxcpp/maddy

git clone git://git.lin.moe/go/maddy.git

 1# Docker
 2
 3Official Docker image is available from Docker Hub.
 4
 5It expects configuration file to be available at /data/maddy.conf.
 6
 7If /data is a Docker volume, then default configuration will be placed there
 8automatically. If it is used, then MADDY_HOSTNAME, MADDY_DOMAIN environment
 9variables control the host name and primary domain for the server. TLS
10certificate should be placed in /data/tls/fullchain.pem, private key in
11/data/tls/privkey.pem
12
13DKIM keys are generated in /data/dkim_keys directory.
14
15## Image tags
16
17- `latest` - A latest stable release. May contain breaking changes.
18- `X.Y` - A specific feature branch, it is recommended to use these tags to
19  receive bugfixes without the risk of feature-related regressions or breaking
20  changes.
21- `X.Y.Z` - A specific stable release
22
23## Ports
24
25All standard ports, as described in maddy docs.
26
27- `25` - SMTP inbound port.
28- `465`, `587` - SMTP Submission ports
29- `993`, `143` - IMAP4 ports
30
31## Volumes
32
33`/data` - maddy state directory. Databases, queues, etc are stored here. You
34might want to mount a named volume there. The main configuration file is stored
35here too (`/data/maddy.conf`).
36
37## Management utility
38
39To run management commands, create a temporary container with the same
40/data directory and put the command after the image name, like this:
41
42```
43docker run --rm -it -v maddydata:/data foxcpp/maddy:0.7 creds create foxcpp@maddy.test
44docker run --rm -it -v maddydata:/data foxcpp/maddy:0.7 imap-acct create foxcpp@maddy.test
45```
46
47Use the same image version as the running server. Things may break badly
48otherwise.
49
50Note that, if you modify messages using maddy subcommands while the server is running -
51you must ensure that  /tmp from the server is accessible for the management
52command. One way to it is to run it using `docker exec` instead of `docker run`:
53```
54docker exec -it container_name_here maddy creds create foxcpp@maddy.test
55```
56
57## Build Tags
58
59Some Maddy features (such as automatic certificate management via ACME with [a non-default libdns provider](../reference/tls-acme/#dns-providers)) require build tags to be passed to Maddy's `build.sh`, as this is run in the Dockerfile you must compile your own Docker image. Build tags can be set via the docker build argument `ADDITIONAL_BUILD_TAGS` e.g. `docker build --build-arg ADDITIONAL_BUILD_TAGS="libdns_acmedns libdns_route53" -t yourorgname/maddy:yourtagname .`.
60
61
62## TL;DR
63
64```
65docker volume create maddydata
66docker run \
67  --name maddy \
68  -e MADDY_HOSTNAME=mx.maddy.test \
69  -e MADDY_DOMAIN=maddy.test \
70  -v maddydata:/data \
71  -p 25:25 \
72  -p 143:143 \
73  -p 465:465 \
74  -p 587:587 \
75  -p 993:993 \
76  foxcpp/maddy:0.7
77```
78
79It will fail on first startup. Copy TLS certificate to /data/tls/fullchain.pem
80and key to /data/tls/privkey.pem. Run the server again. Finish DNS configuration
81(DKIM keys, etc) as described in [tutorials/setting-up/](../tutorials/setting-up/).