This repository has been archived on 2021-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
postfix-relay/README.md

60 lines
2.5 KiB
Markdown
Raw Permalink Normal View History

2020-09-26 09:17:53 +00:00
# Postfix-Relay
[![Build Status](https://drone.autonomic.zone/api/badges/coop-cloud/postfix-relay/status.svg)](https://drone.autonomic.zone/coop-cloud/postfix-relay)
<!-- metadata -->
* **Category**: Utilities
* **Status**: ❷💛
* **Image**: [`boky/postfix`](https://hub.docker.com/r/boky/postfix/), ❶💚, upstream
* **Healthcheck**: Yes
* **Backups**: No
* **Email**: N/A
* **Tests**: ❷💛
* **SSO**: N/A
<!-- endmetadata -->
Centralised email delivery for all your `coop-cloud` apps using the
2020-09-26 14:18:02 +00:00
[`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 20:04:31 +00:00
recipient's mail server using `MX` records). **NOTE**: 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`][abra]
2. Deploy [`coop-cloud/traefik`][compose-traefik]
3. `abra app new postfix-relay`
4. `abra app YOURAPPDOMAIN config` - be sure to change `$DOMAIN` to something that resolves to
your Docker swarm box
5. `abra app YOURAPPDOMAIN deploy`
2020-09-26 09:17:53 +00:00
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
`coop-cloud/wordpress`][wordpress-compose].
2020-09-26 14:18:02 +00:00
2020-09-27 20:00:20 +00:00
[`boky/postfix`]: https://hub.docker.com/r/boky/postfix
2020-09-26 14:18:02 +00:00
[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
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
[wordpress-compose]: https://git.autonomic.zone/coop-cloud/wordpress/src/branch/master/compose.mailrelay.yml