postfix-relay/README.md

46 lines
1.9 KiB
Markdown
Raw Normal View History

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
recipient's mail server using `MX` records). For this to work, you will need to
set up reverse DNS and SPF.
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
TODO 3wc: Can you run more than one instance of this on a swarm? How could we handle
that in terms of reverse DNS?
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
your Docker swarm box
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
the image supports for auto-configuring SMTP settings.
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