help run mox with docker

in the Dockerfile, allow running on privileged ports and expose those ports.

add a docker-compose.yml with instructions for the quickstart.

fix running imaptest somewhat. after a short while it will hit the rate limiter.

in quickstart, recognize we are running under docker, and print slightly
different commands to set permissions, and skip generating the systemd service
file. als fix cleaning up the right paths during failure in quickstart.

for issue #3
This commit is contained in:
Mechiel Lukkien
2023-02-24 14:16:51 +01:00
parent 210fd34702
commit b1dcd73ebe
8 changed files with 104 additions and 34 deletions

30
docker-compose.yml Normal file
View File

@ -0,0 +1,30 @@
# Before launching mox, run the quickstart to create config files:
#
# MOX_UID=0 MOX_GID=0 docker-compose run mox mox quickstart you@yourdomain.example
#
# After following the instructions, start mox as the newly created mox user:
#
# MOX_UID=$(id -u mox) MOX_GID=$(id -g mox) docker-compose up
version: '3.7'
services:
mox:
# Replace latest with the version you want to run.
image: moxmail/mox:latest
user: ${MOX_UID}:${MOX_GID}
environment:
- MOX_DOCKER=... # Quickstart won't try to write systemd service file.
# Mox needs host networking because it needs access to the IPs of the
# machine, and the IPs of incoming connections for spam filtering.
network_mode: 'host'
command: sh -c "umask 007 && exec mox serve"
volumes:
- ./config:/mox/config
- ./data:/mox/data
working_dir: /mox
restart: on-failure
healthcheck:
test: netstat -nlt | grep ':25 '
interval: 1s
timeout: 1s
retries: 10