feat: replace mailhog with mailpit

This commit is contained in:
Janik von Rotz committed 2024-12-11 13:56:46 +01:00
1 parent 0f2f20ba87
commit dbd14d1da7
10 files changed
+109 -6

No files matched your search

+5 -4
View File
@@ -43,10 +43,10 @@ Create an inventory folder and configure a role.
Have a look at the Ansible roles and check how to configure them.
| Role | Description |
| -------------------------------------------- | ------------------------------------ |
| [acme_sh](roles/acme_sh/README.md) | Issue & renew the free certificates. |
| [alertmanager](roles/alertmanager/README.md) | Deploy Alertmanager container. |
| Role | Description |
| ---------------------------------------------------------------------- | ---------------------------------------------------------------- |
| [acme_sh](roles/acme_sh/README.md) | Issue & renew the free certificates. |
| [alertmanager](roles/alertmanager/README.md) | Deploy Alertmanager container. |
| [ansible_scripts](roles/ansible_scripts/README.md) | Install Ansible scripts. |
| [bigbluebutton](roles/bigbluebutton/README.md) | Install BigBlueButton with https and greenlight. |
| [bigbluebutton_exporter](roles/bigbluebutton_exporter/README.md) | Deploy BigBlueButton exporter container. |
@@ -92,6 +92,7 @@ Have a look at the Ansible roles and check how to configure them.
| [logstash](roles/logstash/README.md) | Deploy Logstash Docker container. |
| [loki](roles/loki/README.md) | Deploy Loki container. |
| [mailhog](roles/mailhog/README.md) | Deploy MailHog Docker container. |
| [mailpit](roles/mailpit/README.md) | Deploy Mailpit Docker container. |
| [maintenance](roles/maintenance/README.md) | Maintain operating system and disk space. |
| [mariadb](roles/mariadb/README.md) | Deploy MariaDB database container. |
| [matomo](roles/matomo/README.md) | Deploy Matomo container. |
+2
View File
@@ -82,3 +82,5 @@
tags: meilisync
- role: n8n
tags: n8n
- role: mailpit
tags: mailpit
File renamed without changes.
+4 -1
View File
@@ -87,4 +87,7 @@ docker container run --rm \
-v "$SOURCE_VOLUME":/from \
-v "$TARGET_VOLUME":/to \
alpine ash -c "cd /to; mkdir -p .$TARGET_PATH; cd /from$SOURCE_PATH; cp -av . /to$TARGET_PATH" \
> /dev/null && { echo "Docker volume copy has finished."; }
> /dev/null && { echo "Docker volume copy has finished."; }
echo "Fix ownership for $TARGET_PATH in container:"
echo "docker exec -u root \$CONTAINER chown -R \$USER:\$GROUP /path/to$TARGET_PATH"
+1 -1
View File
@@ -47,4 +47,4 @@ nginx_proxies:
### Odoo config
To setup a outgoing mailhog connection simply use the hostname `mailogXX` and port `1025`.
To setup a outgoing mailhog connection simply use the hostname `mailhogXX` and port `1025`.
+51
View File
@@ -0,0 +1,51 @@
# Mailpit role
Deploy Mailpit container.
## Usage
Configure the role.
```yml
# https://hub.docker.com/r/axllent/mailpit
mailpit_image: axllent/mailpit:latest
mailpit_description: Odoo Mail Catcher # default: Mailpit
mailpit_hostname: mailpit01
mailpit_data_dir: /usr/share/mailpit_data01 # default: "/usr/share/{{ mailpit_hostname }}"
mailpit_timezone: Europe/Paris # default: Europe/Zurich
mailpit_webroot: /mailpit/ # default: /
mailpit_users: # default: []
- username: admin
password: "{{ vault_mailpit_user_admin_password }}"
```
And include it in your playbook.
```yml
- hosts: mailpit
roles:
- role: mailpit
```
## Docs
### Nginx config
Setup this Nginx configuration for the `mailpit01` host:
```yaml
nginx_proxies:
- src_hostname: www.example.com
dest_hostname: webserver
locations:
- path: /mailpit
dest_hostname: mailpit01
dest_port: 8025
options: |
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
```
### Odoo config
To setup a outgoing mailpit connection simply use the hostname `mailpitXX` and port `1025`.
+6
View File
@@ -0,0 +1,6 @@
---
mailpit_description: Mailpit
mailpit_data_dir: /usr/share/{{ mailpit_hostname }}
mailpit_users: []
mailpit_webroot: /
mailpit_timezone: Europe/Zurich
+6
View File
@@ -0,0 +1,6 @@
---
dependencies: # noqa 701
- role: docker_network
tags:
- docker_network
- depends
+30
View File
@@ -0,0 +1,30 @@
---
- name: Configure user access for {{ role_name }}
community.general.htpasswd:
path: "{{ mailpit_data_dir }}/auth"
name: "{{ item.username }}"
password: "{{ item.password }}"
crypt_scheme: bcrypt
loop: "{{ mailpit_users }}"
- name: Start {{ role_name }} container {{ mailpit_hostname }}
community.docker.docker_container:
name: "{{ mailpit_hostname }}"
labels:
description: "{{ mailpit_description }}"
image: "{{ mailpit_image }}"
restart_policy: unless-stopped
recreate: false
env:
TZ: "{{ mailpit_timezone }}"
MP_UI_AUTH_FILE: "{{ '/etc/mailpit/auth' if mailpit_users else ''}}"
command: "--webroot {{ mailpit_webroot }}"
volumes:
- "{{ mailpit_data_dir }}/auth:/etc/mailpit/auth"
networks:
- name: "{{ docker_network_name }}"
log_driver: "{{ docker_log_driver }}"
log_options:
max-size: "{{ docker_log_max_size }}"
max-file: "{{ docker_log_max_file }}"
tag: "{{ mailpit_hostname }}|{{ role_name }}"
+4
View File
@@ -0,0 +1,4 @@
---
- name: Include {{ role_name }} tasks
ansible.builtin.include_tasks: "{{ role_name }}.yml"
when: mailpit_image is defined