add docker-composee examples for traefik

This commit is contained in:
Thomas Renger 2024-03-24 07:47:25 +01:00
commit 345d73cf50
2 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,55 @@
version: '3.3'
volumes:
db_data:
roundcube-temp:
services:
db:
image: mariadb:10.6
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: ******
MYSQL_DATABASE: roundcube
MYSQL_USER: roundcube
MYSQL_PASSWORD: ******
roundcubemail:
depends_on:
- db
image: roundcube/roundcubemail
volumes:
- roundcube-temp:/tmp/roundcube-temp
restart: always
environment:
ROUNDCUBEMAIL_DEFAULT_HOST: ssl://imap.wazong.de
ROUNDCUBEMAIL_DEFAULT_PORT: 993
ROUNDCUBEMAIL_SMTP_SERVER: tls://mail.wazong.de
ROUNDCUBEMAIL_DB_TYPE: mysql
ROUNDCUBEMAIL_DB_HOST: db
ROUNDCUBEMAIL_DB_NAME: roundcube
ROUNDCUBEMAIL_DB_USER: roundcube
ROUNDCUBEMAIL_DB_PASSWORD: ******
networks:
- default
- traefik
labels:
- traefik.enable=true
- traefik.http.routers.roundcube-nyx.rule=HostRegexp(`{host:mail.wazong.de}`)
- traefik.http.routers.roundcube-nyx.entrypoints=pound
- traefik.http.routers.roundcube.rule=HostRegexp(`{host:mail.wazong.de}`)
- traefik.http.routers.roundcube.tls=true
- traefik.http.routers.roundcube.entrypoints=websecure
- traefik.http.services.roundcube.loadbalancer.healthcheck.path=/
- traefik.http.services.roundcube.loadbalancer.healthcheck.interval=120s
- traefik.http.services.roundcube.loadbalancer.healthcheck.hostname=wazong.de
- traefik.http.services.roundcube.loadbalancer.healthcheck.headers.X-Forwarded-Proto=https
- traefik.docker.network=traefik_default
networks:
default:
traefik:
external:
name: traefik_default

View file

@ -0,0 +1,46 @@
version: "3.3"
services:
traefik:
image: "traefik:v2.10"
command:
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --entrypoints.pound.address=:9080
- --entryPoints.pound.forwardedHeaders.trustedIPs=10.23.0.0/24
- --entrypoints.mqtts.address=:8883
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --providers.file.directory=/config/
- --providers.file.watch=true
- --api
- --api.dashboard=true
- --accesslog
- --metrics.prometheus=true
- --metrics.prometheus.buckets=0.01,0.025,0.05,0.1,0.25,0.5,1.0,2.5,5.0,10.0
network_mode: host
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "/opt/traefik/acme.json:/acme.json"
- "/opt/traefik/config:/config"
- "/opt/traefik/certs:/certs"
labels:
# Dashboard
- traefik.enable=true
- traefik.http.routers.traefik.rule=Host(`api.wazong.de`)
- traefik.http.routers.traefik.service=api@internal
- traefik.http.routers.traefik.tls=true
- traefik.http.routers.traefik.middlewares=authtraefik
- traefik.http.routers.traefik.entrypoints=websecure
- traefik.http.services.traefik.loadbalancer.server.port=888
- traefik.http.middlewares.authtraefik.basicauth.users=admin:**************
# global redirect to https
- traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
- traefik.http.routers.http-catchall.entrypoints=web
- traefik.http.routers.http-catchall.middlewares=redirect-to-https
# middleware redirect
- traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
- traefik.http.middlewares.redirect-to-https.redirectscheme.port=443
restart: always