Skip to content

Commit a17f353

Browse files
committed
docs: fixed configuration errors in traefik example config
1 parent 00db32a commit a17f353

2 files changed

Lines changed: 22 additions & 112 deletions

File tree

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,11 @@
11
# Traefik Reverse Proxy Setup
22

3-
This example demonstrates how to deploy docker-mailserver with Traefik as a reverse proxy, providing automatic HTTPS with Let's Encrypt certificates.
4-
5-
## Overview
6-
7-
This setup extends the main `docker-compose.yml` and adds:
8-
9-
- **Traefik Reverse Proxy**: Handles HTTP/HTTPS routing and SSL termination
10-
- **Automatic HTTPS**: Let's Encrypt certificates with automatic renewal
11-
- **HTTP to HTTPS Redirect**: Automatic redirection from HTTP to HTTPS
3+
This example demonstrates how to deploy docker-mailserver with Traefik as a reverse proxy.
124

135
## Configuration Details
146

15-
### Traefik Configuration
16-
17-
The Traefik service is configured with:
18-
19-
- **Entry Points**: HTTP (80) and HTTPS (443)
20-
- **Let's Encrypt**: Automatic SSL certificate management
21-
- **Docker Provider**: Automatic service discovery
22-
- **Security**: HTTP to HTTPS redirect
23-
- **Logging**: Access logs and debug information
24-
25-
### Web Service
26-
27-
The web service is configured with Traefik labels for:
7+
1. Copy the `compose.yaml` file to your project's root folder with the name `docker-compose.override.yml`.
8+
2. Update the `Host(`mail.example.org`)` in the `docker-compose.override.yml` file to the domain you want to use for your mail server web interface.
9+
3. Run `bin/production.sh up -d` to start the services.
2810

29-
- **Host Routing**: `mail.example.org`
30-
- **SSL Termination**: Let's Encrypt certificates
11+
[compose.yaml](./compose.yaml)
Lines changed: 17 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,50 @@
11
# Traefik Reverse Proxy Setup for docker-mailserver
22
# This compose file extends the main docker-compose.yml and adds Traefik as reverse proxy
3+
# Copy the file to docker-compose.override.yml in the root folder of the project.
4+
# It'll be automatically picked up by the `bin/production.sh` wrapper script.
5+
36
services:
47
# Include all services from main docker-compose.yml
5-
ssl:
6-
extends:
7-
file: ../../../../docker-compose.yml
8-
service: ssl
9-
db:
10-
extends:
11-
file: ../../../../docker-compose.yml
12-
service: db
13-
redis:
14-
extends:
15-
file: ../../../../docker-compose.yml
16-
service: redis
17-
unbound:
18-
extends:
19-
file: ../../../../docker-compose.yml
20-
service: unbound
21-
filter:
22-
extends:
23-
file: ../../../../docker-compose.yml
24-
service: filter
25-
fetchmail:
26-
extends:
27-
file: ../../../../docker-compose.yml
28-
service: fetchmail
298
# Traefik reverse proxy
309
traefik:
31-
image: traefik:v3.0
32-
container_name: traefik
10+
image: traefik
3311
restart: unless-stopped
3412
command:
35-
# API and dashboard
36-
- --api.dashboard=false
37-
- --api.insecure=false
3813
# Entry points
3914
- --entrypoints.web.address=:80
4015
- --entrypoints.websecure.address=:443
4116
# Let's Encrypt configuration
42-
- --certificatesresolvers.letsencrypt.acme.tlschallenge=true
43-
44-
- --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
17+
# - --certificatesresolvers.letsencrypt.acme.tlschallenge=true
18+
19+
# - --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
4520
# Docker provider
4621
- --providers.docker=true
4722
- --providers.docker.exposedbydefault=false
4823
# Logging
49-
- --log.level=INFO
50-
- --accesslog=true
51-
# Security headers
52-
- --entrypoints.web.http.redirections.entrypoint.to=websecure
53-
- --entrypoints.web.http.redirections.entrypoint.scheme=https
54-
- --entrypoints.web.http.redirections.entrypoint.permanent=true
24+
- --log.level=DEBUG
5525
ports:
5626
- "80:80"
5727
- "443:443"
5828
volumes:
5929
- /var/run/docker.sock:/var/run/docker.sock:ro
6030
- traefik-letsencrypt:/letsencrypt
61-
networks:
62-
- default
63-
- traefik
64-
labels:
65-
# Enable Traefik for itself (dashboard)
66-
- traefik.enable=true
6731
# Override web service to add Traefik labels
6832
web:
69-
extends:
70-
file: ../../../../docker-compose.yml
71-
service: web
33+
ports: []
7234
labels:
7335
# Enable Traefik for web service
7436
- traefik.enable=true
7537
# HTTP router (redirects to HTTPS)
7638
- traefik.http.routers.mail-web-http.rule=Host(`mail.example.org`)
7739
- traefik.http.routers.mail-web-http.entrypoints=web
78-
- traefik.http.routers.mail-web-http.middlewares=redirect-to-https
79-
# HTTPS router
80-
- traefik.http.routers.mail-web.rule=Host(`mail.example.org`)
81-
- traefik.http.routers.mail-web.entrypoints=websecure
82-
- traefik.http.routers.mail-web.tls.certresolver=letsencrypt
40+
- traefik.http.routers.mail-web-http.service=mail-web
41+
# # HTTPS router
42+
# - traefik.http.routers.mail-web.rule=Host(`mail.example.org`)
43+
# - traefik.http.routers.mail-web.entrypoints=websecure
44+
# - traefik.http.routers.mail-web-http.service=mail-web
45+
# - traefik.http.routers.mail-web.tls.certresolver=letsencrypt
8346
# Service configuration
84-
- traefik.http.services.mail-web.loadbalancer.server.port=80
85-
networks:
86-
- default
87-
- traefik
88-
# Override MTA service to expose ports for direct SMTP access
89-
mta:
90-
extends:
91-
file: ../../../../docker-compose.yml
92-
service: mta
93-
ports:
94-
- "25:25" # SMTP
95-
- "587:587" # SMTP submission
96-
networks:
97-
- default
98-
# Override MDA service to expose ports for direct IMAP access
99-
mda:
100-
extends:
101-
file: ../../../../docker-compose.yml
102-
service: mda
103-
ports:
104-
- "143:143" # IMAP
105-
- "993:993" # IMAPS
106-
networks:
107-
- default
108-
# Define networks
109-
networks:
110-
traefik:
111-
external: false
112-
# Define volumes
47+
- traefik.http.services.mail-web.loadbalancer.server.port=8080
48+
11349
volumes:
11450
traefik-letsencrypt:
115-
external: false
116-
# Inherit volumes from main docker-compose.yml
117-
data-db:
118-
data-mail:
119-
data-tls:
120-
data-filter:
121-
data-redis:

0 commit comments

Comments
 (0)