As I still only have one public IP address I run my private mail server behind an HAProxy instance. At the same time I use Postfix on my servers to provide me with system information (anything from information on system updates to hardware failures). Naturally the mail service listeners in HAProxy collide with those of the local Postfix installation on the reverse proxy server. Every now and then this caused issues when Postfix managed to start before HAProxy, and stole the network ports from under its feet.
In systemd based distributions one “right way” to get around this issue is to override the service defaults for the Postfix service, so it doesn’t attempt to start until after HAProxy has started. We don’t want to mess with the package maintainer’s service files as they can change over time by necessity. Instead we should override the service defaults.
sudo systemctl edit postfix.service
The above command does the magic involved in creating an override (creates a file
/etc/systemd/system/servicename.service.d/override.conf, and then runs
systemctl daemon-reload once you’re done editing so the changes can take hold on the next service start).
Inside the override configuration file we just add a
Unit block and add an
That’s all, really. Save the file and on the next system reboot the services should start in the correct order.
(As I write this we’re approaching the tenth anniversary of World IPv6 Launch Day and most ISPs in Sweden still don’t hand out native IPv6 subnets to their clients but increasingly move them to IPv4 CGNAT despite the obvious issues this creates when attempting to present anything to the Internet, from “serious” web services to game servers!)