2020-09-26 09:17:53 +00:00
|
|
|
# Postfix-Relay
|
|
|
|
|
2020-09-26 14:18:02 +00:00
|
|
|
Centralised email delivery for all your `compose-stacks` apps using the
|
|
|
|
[`boky/postfix`] outgoing-only mail image.
|
|
|
|
|
|
|
|
The basic idea is to run one instance of this on each swarm, and configure that
|
|
|
|
swarm's apps to send all their email through it.
|
|
|
|
|
|
|
|
By default, this stack will try to deliver e-mail directly (i.e. looking up the
|
2020-09-27 19:36:04 +00:00
|
|
|
recipient's mail server using `MX` records).
|
|
|
|
|
|
|
|
**NOTE**: If you use this direct delivery, make sure that:
|
|
|
|
- your Traefik server and host firewall are configured to allow port 587,
|
|
|
|
- you have an MX record for your configured `$DOMAIN` pointing to this server,
|
|
|
|
- you have an SPF record for `$DOMAIN` that includes `mx` or this server's IP
|
|
|
|
- you have a reverse DNS (rDNS / PTR) record for this IP that matches `$DOMAIN`
|
|
|
|
|
|
|
|
(These requirements mean that you can only deploy one direct-delivery instance
|
|
|
|
of this app per swarm host..)
|
2020-09-26 14:18:02 +00:00
|
|
|
|
|
|
|
Alternatively, you can easily route mail through a smarthost / relay host like
|
|
|
|
Mailgun or Gandi -- see [`RELAYHOST` and related parameters][boky-postfix-options].
|
|
|
|
|
|
|
|
FIXME 3wc: Pass `RELAYHOST` etc. from `.envrc` to service
|
|
|
|
|
2020-09-26 09:17:53 +00:00
|
|
|
## Basic usage
|
|
|
|
|
|
|
|
1. Set up Docker Swarm and [`abra`]
|
|
|
|
2. Deploy [`compose-stacks/traefik`]
|
|
|
|
3. `git clone https://git.autonomic.zone/compose-stacks/postfix-relay.git && cd postfix-relay`
|
|
|
|
3. `cp .envrc.sample .envrc`
|
|
|
|
4. Edit `.envrc` - be sure to change `DOMAIN` to something that resolves to
|
2020-09-27 19:36:04 +00:00
|
|
|
your Docker swarm box, and add any extra domains (including subdomains) you'd
|
|
|
|
like to be able to send mail from in `EXTRA_SENDER_DOMAINS`.
|
2020-09-26 09:17:53 +00:00
|
|
|
5. `direnv allow` (or `. .envrc`)
|
|
|
|
6. `abra deploy`
|
|
|
|
|
2020-09-26 14:18:02 +00:00
|
|
|
## Using this in other stacks
|
|
|
|
|
|
|
|
Add the other service to the (internal) `mail` network, and set whatever options
|
2020-09-27 11:15:32 +00:00
|
|
|
the image supports for auto-configuring SMTP settings.
|
2020-09-26 14:18:02 +00:00
|
|
|
|
|
|
|
For reusable stacks, you probably want to put this configuration in a separate
|
|
|
|
`compose.mailrelay.yml` file, e.g. [the version in
|
|
|
|
`compose-stacks/nextcloud`][nextcloud-compose].
|
|
|
|
|
|
|
|
[`boky-postfix`]: https://hub.docker.com/r/boky/postfix
|
|
|
|
[boky-postfix-options]: https://github.com/bokysan/docker-postfix#postfix-specific-options
|
2020-09-26 09:17:53 +00:00
|
|
|
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
|
|
|
|
[`compose-stacks/traefik`]: https://git.autonomic.zone/compose-stacks/traefik
|
2020-09-26 14:18:02 +00:00
|
|
|
[nextcloud-compose]: https://git.autonomic.zone/compose-stacks/nextcloud/src/branch/main/compose.mailrelay.yml
|