blog/content/post/notes/mailcow/index.md
2025-06-11 08:16:28 +02:00

65 lines
2 KiB
Markdown

---
title: "Mailcow"
date: 2025-05-27T14:51:36+02:00
tags:
- 100DaysToOffload
draft: false
author: "Colmaris"
categories:
- notes
toc: true
---
## Mailcow derrière Traefik
Modifier le fichier de configuration `mailcow.conf`afin que nginx écoute sur les `8080` et `8443`
```shell
HTTP_PORT=8080
HTTP_BIND=127.0.0.1
HTTPS_PORT=8443
HTTPS_BIND=127.0.0.1
```
Dans l'arborescence de mailcow créer un fichier `docker-compose.override.yml` et placer les lignes suivantes.
```yaml
services:
nginx-mailcow:
expose:
- 8080
labels:
- traefik.enable=true
- traefik.http.routers.nginx-mailcow.rule=HostRegexp(`{host:(autodiscover|autoconfig|webmail|mail|email).+}`)
- traefik.http.routers.nginx-mailcow.entrypoints=https
- traefik.http.routers.nginx-mailcow.rule=Host(`${MAILCOW_HOSTNAME}`)
- traefik.http.routers.nginx-mailcow.tls=true
- traefik.http.routers.nginx-mailcow.tls.certresolver=le
# Uncomment to use wildcard cert:
# - traefik.http.routers.nginx-mailcow.tls.domains[0].main=example.com
# - traefik.http.routers.nginx-mailcow.tls.domains[0].sans=*.example.com
- traefik.http.routers.nginx-mailcow.service=nginx-mailcow
- traefik.http.services.nginx-mailcow.loadbalancer.server.port=8080
- traefik.docker.network=traefik
networks:
- traefik
certdumper:
image: humenius/traefik-certs-dumper
network_mode: none
command: --restart-containers mailcow_postfix-mailcow_1,mailcow_dovecot-mailcow_1,mailcow_nginx-mailcow_1
volumes:
- /home/draconis/traefik/certificates:/traefik:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data/assets/ssl:/output:rw
environment:
- DOMAIN=${MAILCOW_HOSTNAME}
# If using wildcard certs instead of an explicit host cert,
# use following line instead with just the TLD so certdumper
# is able to find the cert.
# - DOMAIN=YourDomain.com
networks:
traefik:
external: true
```