-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(other): add mailpit for email testing (local and e2e) (#949)
* add mailserver to docker.compose.yml * move mailserver service entry to authentik docker.compose.yml * add email configuration to .env * move mailserver service to separate docker-compose.test.yml * restore authentik .env * remove redundant version element from docker compose files * update authentik readme * fix typo * linting * refactor: make use of docker-compose local DNS --------- Co-authored-by: Robert Schäfer <[email protected]>
- Loading branch information
1 parent
e9d9a99
commit 3002d71
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,26 @@ If you want to publish changes to the database you can use the following command | |
|
||
(Note: this assumes you are not root and sets the permissions of the database files via sudo) | ||
(Note: make sure to shut down the database first before you run the script) | ||
|
||
## E-Mail testing | ||
|
||
Authentik e-mails can be checked locally via [Mailpit mailserver](https://mailpit.axllent.org/). | ||
|
||
### Prepare and start | ||
|
||
In the `authentik/` directory start authentik and mailserver: | ||
|
||
```bash | ||
docker-compose -f docker-compose.yml -f docker-compose.test.yml up | ||
``` | ||
|
||
### Example | ||
|
||
The given setup can be tested via [Authentik's e-mail testing tool](https://github.com/goauthentik/authentik/blob/main/authentik/stages/email/management/commands/test_email.py) | ||
|
||
Send a test email with: | ||
```bash | ||
docker compose exec worker ak test_email [email protected] | ||
``` | ||
|
||
Visit [Mailpit](http://localhost:8025) and see your test email. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
x-mail-settings: &x-mail-settings | ||
environment: | ||
- AUTHENTIK_EMAIL__HOST=mailserver | ||
- AUTHENTIK_EMAIL__PORT=1025 | ||
- AUTHENTIK_EMAIL__USE_TLS=false | ||
- AUTHENTIK_EMAIL__USE_SSL=false | ||
- AUTHENTIK_EMAIL__TIMEOUT=10 | ||
- [email protected] | ||
|
||
services: | ||
mailserver: | ||
image: axllent/mailpit | ||
container_name: mailpit | ||
restart: unless-stopped | ||
ports: | ||
- 8025:8025 | ||
- 1025:1025 | ||
|
||
server: | ||
<<: *x-mail-settings | ||
worker: | ||
<<: *x-mail-settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: "3.4" | ||
|
||
services: | ||
postgresql: | ||
image: docker.io/library/postgres:12-alpine | ||
|