Skip to content

Commit

Permalink
feat(service): add mailhog
Browse files Browse the repository at this point in the history
  • Loading branch information
borjapazr committed May 14, 2023
1 parent 10b5ff2 commit 03f9aec
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
8 changes: 8 additions & 0 deletions services/mailhog/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Volume settings ##
VOLUME_DIR=

## Domain settings ##
DOMAIN=

## Timezone configuration ##
TZ=
15 changes: 15 additions & 0 deletions services/mailhog/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
SERVICE := mailhog
include $(ROOT_DIR)/../../core/common.mk
include .env

.ONESHELL:

.PHONY: install
install: ## Start all containers in background
@$(DOCKER_COMPOSE) up -d

.PHONY: uninstall
uninstall: ## Stop all containers and remove all data
@$(DOCKER_COMPOSE) down -v
@sudo rm -rf $(VOLUME_DIR)
48 changes: 48 additions & 0 deletions services/mailhog/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: "3.7"

services:
### MailHog: Web and API based SMTP testing ###
mailhog:
image: mailhog/mailhog
container_name: mailhog
restart: always
command: ["-smtp-bind-addr", "0.0.0.0:1025"]
environment:
- TZ=${TZ}
ports:
- 1025:1025
- 8025:8025
networks:
- default
- traefik-network
labels:
## Watchtower configuration ##
- com.centurylinklabs.watchtower.enable=true
- com.centurylinklabs.watchtower.monitor-only=true

## Diun configuration ##
- diun.enable=true

## Traefik configuration ##
# Enable Traefik #
- traefik.enable=true
- traefik.docker.network=traefik-network

# Set entrypoint port #
- traefik.http.services.mailhog.loadbalancer.server.port=8025

# Set HTTP domain and HTTP -> HTTPS redirection #
- traefik.http.routers.mailhog.rule=Host(`${DOMAIN}`)
- traefik.http.routers.mailhog.entrypoints=web
- traefik.http.routers.mailhog.middlewares=https-redirect@file

# Set HTTPS domain #
- traefik.http.routers.mailhog-secure.rule=Host(`${DOMAIN}`)
- traefik.http.routers.mailhog-secure.entrypoints=websecure

networks:
default:
name: mailhog-network
traefik-network:
name: traefik-network
external: true

0 comments on commit 03f9aec

Please sign in to comment.