Reputation: 1809
I've defined a static configuration for in my traefik_v2.yml
api:
dashboard: true
insecure: true
global: {}
providers:
providersThrottleDuration: 2s
docker:
watch: true
endpoint: unix:///var/run/docker.sock
swarmModeRefreshSeconds: 15s
file:
filename: "traefik_v2.yml"
log:
level: INFO
tls:
certificates:
- certFile: /run/secrets/cert_secret
keyFile: /run/secrets/cert_key_secret
entryPoints:
web:
address: ":80"
redirections:
entrypoint:
to: external
scheme: https
web-secure:
address: ":443"
api:
address: ":8080"
external:
address: ":10443"
Now in one of my compose files, how can I configure the router tls configs to the ones existent in the static file traefik_v2.yml
?
version: '3.4'
services:
x-authentication-app:
image: x_authentication_app_nightly:v${BUILD_NUMBER}
deploy:
labels:
- "traefik.docker.network=x-swarm-net"
- "traefik.http.routers.authenticationapp.rule=PathPrefix(`/authentication`)"
- "traefik.http.routers.authenticationapp.service=x-authentication-app"
- "traefik.http.routers.authenticationapp.entrypoints=web"
- "traefik.http.routers.authenticationapp.tls={}" // **What to say in here ? I want to use the static configurations that I created for tls in the traefik_v2.yml**
- "traefik.enable=true"
- "traefik.port=80"
replicas: 1
update_config:
parallelism: 1
delay: 10s
order: stop-first
networks:
- default
networks:
default:
external:
name: x-swarm-net
Upvotes: 1
Views: 568
Reputation: 5215
You don't have to say anything else juste set traefik.http.routers.authenticationapp.tls=true
.
You also need to make your endpoint listen on port 443:
traefik.http.routers.authenticationapp.entrypoints=web, web-secure
Upvotes: 1