Skip to content

Commit

Permalink
Merge pull request #779 from bap14/feature/add-mailpit
Browse files Browse the repository at this point in the history
Add optional (opt-in) support for Mailpit
  • Loading branch information
navarr authored Aug 5, 2024
2 parents a9ebf25 + c3803b5 commit 60f3fdd
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion commands/install.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ if [[ ! -f "${WARDEN_HOME_DIR}/.env" ]]; then
cat >> "${WARDEN_HOME_DIR}/.env" <<-EOT
# Set to "1" to enable global Portainer service
WARDEN_PORTAINER_ENABLE=0
# SEt to "0" to disable DNSMasq
# Set to "0" to disable DNSMasq
WARDEN_DNSMASQ_ENABLE=1
EOT
fi
3 changes: 3 additions & 0 deletions commands/svc.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ if [[ -f "${WARDEN_HOME_DIR}/.env" ]]; then
eval "$(grep "^WARDEN_PORTAINER_ENABLE" "${WARDEN_HOME_DIR}/.env")"
fi

DOCKER_COMPOSE_ARGS+=("-f")
DOCKER_COMPOSE_ARGS+=("${WARDEN_DIR}/docker/docker-compose.mailpit.yml")

## add dnsmasq docker-compose
WARDEN_DNSMASQ_ENABLE="${WARDEN_DNSMASQ_ENABLE:-1}"
if [[ "$WARDEN_DNSMASQ_ENABLE" == "1" ]]; then
Expand Down
27 changes: 27 additions & 0 deletions docker/docker-compose.mailpit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
services:
mailpit:
container_name: mailhog
image: axllent/mailpit:${WARDEN_MAILPIT_VERSION:-latest}
environment:
- MP_DATABASE=/data/mailpit.db
volumes:
- mailpitdata:/data
labels:
traefik.enable: true
traefik.http.routers.mailpit.tls: true
traefik.http.routers.mailpit.priority: 2
traefik.http.routers.mailpit.rule: Host(`webmail.${WARDEN_SERVICE_DOMAIN:-warden.test}`)
traefik.http.routers.mailpit.service: mailpit
traefik.http.services.mailpit.loadbalancer.server.port: 8025
# Legacy Mailhog redirect
traefik.http.routers.legacy-mailhog.tls: true
traefik.http.routers.legacy-mailhog.priority: 1
traefik.http.routers.legacy-mailhog.rule: Host(`mailhog.${WARDEN_SERVICE_DOMAIN:-warden.test}`)
traefik.http.routers.legacy-mailhog.middlewares: legacy-mailhog-redirect
traefik.http.middlewares.legacy-mailhog-redirect.redirectregex.regex: "^https?://mailhog\\.([^/]+)/.*"
traefik.http.middlewares.legacy-mailhog-redirect.redirectregex.replacement: https://webmail.$${1}/
traefik.http.middlewares.legacy-mailhog-redirect.redirectregex.permanent: true

restart: ${WARDEN_RESTART_POLICY:-always}
volumes:
mailpitdata:
10 changes: 0 additions & 10 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ services:
- traefik.http.routers.traefik.service=api@internal
restart: ${WARDEN_RESTART_POLICY:-always}

mailhog:
container_name: mailhog
image: wardenenv/mailhog:1.0
labels:
- traefik.enable=true
- traefik.http.routers.mailhog.tls=true
- traefik.http.routers.mailhog.rule=Host(`mailhog.${WARDEN_SERVICE_DOMAIN:-warden.test}`)
- traefik.http.services.mailhog.loadbalancer.server.port=8025
restart: ${WARDEN_RESTART_POLICY:-always}

tunnel:
container_name: tunnel
image: panubo/sshd:latest
Expand Down

0 comments on commit 60f3fdd

Please sign in to comment.