Many of the recipies that follow require email access of some kind. It's normally possible to use a hosted service such as SendGrid, or just a gmail account. If (like me) you'd like to self-host email for your stacks, then the following recipe provides a full-stack mail server running on the docker HA swarm.
The instructions say to create a directory called /var/data/mailserver, but the docker-compose file references /var/data/mail. (And the git repository references /var/data/docker-mailserver)
The docker-compose file references a traefik network. The git repository does not. Which is correct? Also, when I do a list of networks, there is no traefik network.
NETWORK ID NAME DRIVER SCOPE
b97bd270f512 bridge bridge local
c0342e092ab5 docker_gwbridge bridge local
c01707ef700f host host local
9dffna7c85f1 ingress overlay swarm
qexvt668odwt mailserver_internal overlay swarm
e21b75fea00f none null local
5z7k8jarn7av traefik_public overlay swarm
Right. So this is a discrepancy between the original recipe, and the improvements I made in the pre-mix repository. If you’re building off pre-mix, then your traefik stack would have created an overlay network called “traefik_public” (I felt it was more descriptive than just “traefik”). I’ll tidy this up in the original recipe (ho ho, I sound like Colonel Sanders)
The path /var/data/ discrepancy is due to other multiple iterations. Choose whatever suits you - In the pre-mix repo (i.e., what I use myself), I chose to name it docker-mailserver, which is slightly more verbose but also more descriptive
I removed the reference to the traefik network and it seems to work fine.
I’m trying to sync my email over from my old server using mbsync. It’s super slow. Way slower than when I tried it before with a configured server rather than using docker. Have you seen performance problems using the cephfs? Any suggestions for how to pinpoint it?
CPU usage on all the nodes is at 3% or so. The nodes all have 16GB of RAM. NVME drives for boot and a separate NVME drive for storage. These things should be stupid fast.
I agree it doesn’t seem to be ceph which is struggling. Maybe try benchmarking copying a 10GB (or a size > your available RAM, to avoid caching) file locally one one of the nodes, vs copying the same file into cephfs?
docker-mailserver does include fetchmail support, although I haven’t played with it. Maybe you could use setup.sh to suck the mail off your old host that way?
Okay, I’m trying to get rainloop up and running. It looks like they support sieve now. This is my first time trying to get a service up in this context, so I’m looking for advice Here’s my docker-compose.yml. I get an error that I can’t get a secure connection to rainloop.gerg.org, so I’m wondering what I’m doing wrong:
Excellent Yes, traefik_port should be whatever the “app” container listens on. Most containers listen on port 80, but if they don’t (and it’s not mentioned in their docs), you can find out by either:
Inspecting their Dockerfile
Inspecting the container using “docker inspect [container-id]”
I’m keen to know how sieve goes - you’re one step ahead of my recipe now
I ran into an odd issue with sieve rules. They make a bogus directory show up in the mail apps. The workaround is to put an override into config/dovecot.cf
I have a problem with my mailserver. It’s getting pounded (apparently by one of my devices?) I see this in the logs:
Oct 20 00:53:14 011c9f505ae6 dovecot: imap-login: Maximum number of connections from user+IP exceeded (mail_max_userip_connections=10): user=<[email protected]>, method=PLAIN, rip=10.255.0.2, lip=10.255.0.14, TLS, session=<GgPL5e9bGfQK/wAC>
Top shows:
I can’t start up a shell on the docker container:
oci runtime error: exec failed: container_linux.go:265: starting container process caused "process_linux.go:84: executing setns process caused \"exit status 15\""
And I can’t find a way to restart the service. Am I at the docker stack rm, docker stack deploy stage?
Remember, you’re using swarm ingress, so any inbound traffic will appear to come from that address. Maybe you’re being brute-forced? You should be able to shell into the container though, using something like this:
Instead of deleting and redeploying the whole stack, you could just stop the specific container, and let swarm auto-recover it, but it will most likely auto-start it on a different node, which might break your inbound mail NAT.
I couldn’t stop the docker processes. Couldn’t even reboot. I ended up having to cycle power on the machine to get things back.
Then mail wasn’t working. Turns out keepalived on one of the machines was in a weird state (I must have missed starting ipvs, but it was in /etc/rc.local), so the firewall was pointing at the wrong machine. The downside of having the mail process pinned to one machine. Guess I need to spend some more time investigating mail in a swarm (unless you’ve already figured it out
I ended up in a bad state again with "maximum number of connections exceeded. My “solution” is to add to the dovecot.cf:
protocol imap {
# Space separated list of plugins to load (default is global mail_plugins).
#mail_plugins = $mail_plugins
# Maximum number of IMAP connections allowed for a user from each IP address.
# NOTE: The username is compared case-sensitively.
mail_max_userip_connections = 100
}
Then to restart the mailserver (I couldn’t find a way to restart a service from docker stack):
sudo docker service update --force mailserver_mail