Hello everyone,
I want to have my static and dynamic configurations in separate files (I was able to make it work using docker-compose.yml only with commands (static) and labels (dynamic))
I'm starting form scratch with a basic example: traefik dashboard over https with letsencrypt certificates, but I'm not able to get it done.
Here are my files:
Docker-compose.yml
# @prettier
version: "3.3"
networks:
proxy:
name: proxy
external: true
volumes:
letsencrypt:
name: letsencrypt
services:
traefik:
image: traefik:v3.2
networks:
- proxy
command:
- --configfile=/etc/traefik/traefik.yml
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./letsencrypt:/letsencrypt
- ./config:/etc/traefik/config
- ./logs:/var/log
ports:
- "80:80"
- "443:443"
- "8080:8080"
restart: unless-stopped
traefik.yml (static)
## STATIC CONFIGURATION
################################################################
# Traefik Logging
################################################################
log:
level: INFO
format: common
filepath: /var/log/traefik.log
accesslog:
filepath: /var/log/traefik-access.log
################################################################
# API and dashboard configuration
################################################################
api:
insecure: true
dashboard: true
################################################################
# Docker configuration backend
################################################################
providers:
docker:
watch: true
exposedByDefault: false
endpoint: unix:///var/run/docker.sock
network: proxy
file:
directory: /etc/traefik/config
watch: true
accesslog:
filepath: /var/log/traefik.log
################################################################
# Entrypoint
################################################################
entryPoints:
web:
address: :80
http:
redirection:
entrypoint:
to: websecure
scheme: https
websecure:
address: :443
################################################################
# Challenge TLS
################################################################
certresolver:
letsencrypt:
acme:
tlschallenge:
email: admin@mydomain.com
storage: /letsencrypt/acme.json
dynamic.yml
http:
routers:
dashboard:
rule: Host(`traefik.mydomain.com`) || Host(`www.traefik.mydomain.com`)
middlewares: authtraefik
service: dashboard
entrypoints : websecure
tls:
certresolver: letsencrypt
middlewares:
authtraefik:
basicauth:
users : **mycredentialshashed**
Folder hierarchy:
./traefik.yml
./config/dynamic.yml
My logs are empty (ie ./logs is empty) and docker logs container-id gives nothing.
Can someone tell me what am I doing wrong ?
Thank you