Skip to content

Instantly share code, notes, and snippets.

@corusm
Last active May 7, 2022 19:42
Show Gist options
  • Save corusm/063de56d133aa688f9d36a82bd78e607 to your computer and use it in GitHub Desktop.
Save corusm/063de56d133aa688f9d36a82bd78e607 to your computer and use it in GitHub Desktop.
Mailcow Tutorial - Override
version: '2.1'
services:
nginx-mailcow:
labels:
- "traefik.enable=true"
- "traefik.http.routers.nginx-mailcow.entrypoints=web"
- "traefik.http.routers.nginx-mailcow.rule=HostRegexp(`{host:(autodiscover|autoconfig|webmail|mail|email).+}`)"
- "traefik.http.middlewares.nginx-mailcow-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.nginx-mailcow.middlewares=nginx-mailcow-https-redirect"
- "traefik.http.routers.nginx-mailcow-secure.entrypoints=web-secure"
- "traefik.http.routers.nginx-mailcow-secure.rule=Host(`mail.example.de`)" # YOUR EMAIL SUBDMAIN
- "traefik.http.routers.nginx-mailcow-secure.tls=true"
- "traefik.http.routers.registry-secured.tls.certresolver=myCertResolver" # ADD your Certresolver here
- "traefik.http.routers.nginx-mailcow-secure.service=nginx-mailcow"
- "traefik.http.services.nginx-mailcow.loadbalancer.server.port=80"
- "traefik.docker.network=main"
networks:
main:
certdumper:
image: humenius/traefik-certs-dumper
container_name: traefik_certdumper
restart: unless-stopped
network_mode: none
command: --restart-containers mailcowdockerized_postfix-mailcow_1,mailcowdockerized_dovecot-mailcow_1
volumes:
# mount the folder which contains Traefik's `acme.json' file
# in this case Traefik is started from its own docker-compose in ../traefik
- /home/niklas/letsencrypt:/traefik:ro
# mount mailcow's SSL folder
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data/assets/ssl:/output:rw
environment:
- DOMAIN=mail.example.de # YOUR EMAIL SUBDOMAIN HERE
networks:
main: # YOUR TRAEFIK NETWORK HERE
external: true
@barhom
Copy link

barhom commented May 7, 2022

I'm not sure if this is correct, but in order to get my traefik to get a letsencrypt cert I had to change,

- "traefik.http.routers.registry-secured.tls.certresolver=myCertResolver" # ADD your Certresolver here

to

- "traefik.http.routers.nginx-mailcow-secure.tls.certresolver=myCertResolver" # ADD your Certresolver here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment