mirror of
https://github.com/bluepuma77/traefik-best-practice.git
synced 2025-12-21 13:23:10 +01:00
67 lines
2.1 KiB
YAML
67 lines
2.1 KiB
YAML
configs:
|
|
traefik-dynamic.yml:
|
|
file: ./traefik-dynamic.yml
|
|
|
|
volumes:
|
|
traefik-certificates:
|
|
|
|
networks:
|
|
proxy:
|
|
name: proxy
|
|
attachable: true
|
|
|
|
services:
|
|
traefik:
|
|
image: traefik:v3.3
|
|
configs:
|
|
- traefik-dynamic.yml
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
- traefik-certificates:/certificates
|
|
ports:
|
|
- target: 80
|
|
published: 80
|
|
protocol: tcp
|
|
mode: host
|
|
- target: 443
|
|
published: 443
|
|
protocol: tcp
|
|
mode: host
|
|
networks:
|
|
- proxy
|
|
command:
|
|
- --providers.docker=true
|
|
- --providers.docker.exposedByDefault=false
|
|
- --providers.docker.network=proxy
|
|
- --providers.file.filename=/traefik-dynamic.yml
|
|
- --providers.file.watch=true
|
|
- --entryPoints.web.address=:80
|
|
- --entryPoints.web.http.redirections.entryPoint.to=websecure
|
|
- --entryPoints.web.http.redirections.entryPoint.scheme=https
|
|
- --entryPoints.websecure.address=:443
|
|
- --entryPoints.websecure.http.tls=true
|
|
- --entryPoints.websecure.http.tls.certResolver=myresolver
|
|
- --api.debug=true
|
|
- --api.dashboard=true
|
|
- --log.level=INFO
|
|
- --accesslog=true
|
|
- --certificatesResolvers.myresolver.acme.email=mail.example.com
|
|
- --certificatesResolvers.myresolver.acme.storage=/certificates/acme.json
|
|
- --certificatesresolvers.myresolver.acme.tlschallenge=true
|
|
labels:
|
|
- traefik.enable=true
|
|
- traefik.http.routers.api.entrypoints=websecure
|
|
- traefik.http.routers.api.rule=Host(`traefik.example.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))
|
|
- traefik.http.routers.api.service=api@internal
|
|
- traefik.http.routers.api.middlewares=myauth
|
|
- 'traefik.http.middlewares.myauth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/'
|
|
|
|
whoami:
|
|
image: traefik/whoami:v1.10
|
|
networks:
|
|
- proxy
|
|
labels:
|
|
- traefik.enable=true
|
|
- traefik.http.routers.whoami.rule=Host(`whoami.example.com`)
|
|
- traefik.http.services.whoami.loadbalancer.server.port=80
|