Hi everybody.
I have just a small question and i didn't find a clear answer on the doc.
Can we configurate traefik by configuration file in swarm mode ON ?
I am not succeding so I suppose it's not possible but it would be so great to not have to put this not clear lablels like that.
stack.yml
version: "3.8"
networks:
traefik:
name: "dmz"
driver: overlay
attachable: true
services:
traefik:
image: "traefik:v2.2"
networks:
- traefik
ports:
- "8080:8080"
- "443:443"
- "80:80"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./traefik.yml:/etc/traefik/traefik.yml:ro"
- "./conf/:/etc/traefik/conf"
whoami:
image: "containous/whoami"
networks:
- traefik
deploy:
labels:
- "traefik.enable=true"
- "traefik.docker.lbswarm=true"
- "traefik.http.services.whoami.loadbalancer.server.port=80"
traefik.yml
global:
sendAnonymousUsage: false
checkNewVersion: false
# API and dashboard configuration
api:
insecure: true
log:
level: DEBUG
providers:
docker:
endpoint: 'unix:///var/run/docker.sock'
exposedByDefault: false
swarmMode: true
file:
directory= "/etc/traefik/conf"
watch = true
entryPoints:
web:
address: ':80'
websecure:
address: ':443'
certificatesResolvers:
letsencrypt:
acme:
email: my@email.com
caServer: 'https://acme-v02.api.letsencrypt.org/directory'
storage: acme.json
keyType: EC384
httpChallenge:
entryPoint: web
./conf/traefik_dynamic.yml
tls:
options:
default:
minVersion: VersionTLS12
sniStrict: true
cipherSuites:
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
- TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
- TLS_AES_128_GCM_SHA256
- TLS_AES_256_GCM_SHA384
- TLS_CHACHA20_POLY1305_SHA256
curvePreferences:
- CurveP521
- CurveP384
http:
middlewares:
compression:
compress:
excludedContentTypes:
- text/event-stream
https-redirect:
redirectScheme:
scheme: https
permanent: true
security:
headers:
accessControlAllowMethods:
- GET
- OPTIONS
- PUT
accessControlAllowOrigin: origin-list-or-null
accessControlMaxAge: 100
addVaryHeader: true
browserXssFilter: true
contentTypeNosniff: true
forceSTSHeader: true
frameDeny: true
stsIncludeSubdomains: true
stsPreload: true
customFrameOptionsValue: SAMEORIGIN
referrerPolicy: same-origin
featurePolicy: vibrate 'self'
stsSeconds: 315360000
./conf/whoami.yml
docker:
network: dmz
lbswarm: true
http:
routers:
reverse_proxy_whoami_insecure:
rule: Host(`whoami.example.com`)
service: whoami@docker
middlewares: http-redirect@docker
reverse_proxy_whoami:
entrypoints: websecure
tls:
certresolver: letsencrypt-rsa2048
rule: Host(`whoami.example.com`)
service: whoami@docker
loadbalancer:
passhostheader: true
server:
scheme: http