Hello, community. I just started with traefik, stumbled upon a problem and I have a few questions:
- Is it possible to combine different providers? I want to use the docker provider as well as have some dynamic configuration in a file.
- Does the order in which I specify the providers matter?
- If I specify a file provider of directory type, can I mix dynamic configurations in .yaml and .toml? Will traefik pick up all of them from the specified directory?
The problem: I'm trying to run Nextcloud behind traefik and I'm struggling. In their guide, they are explicitly warning that:
Please note: Since the Apache container gets spawned by the mastercontainer, there is NO way to provide custom docker labels or custom environmental variables for the Apache container. So please do not attempt to do this because you will fail! Only the documented way will work!
Further in the guide there is a dynamic configuration in toml. All of my other services behind traefik are autodiscovered by using lables and the the docker provider. However when I specify both (docker and file providers) the middlewares and routers from the file never get created.
This is what my directory looks like:
This is how my traefik.yml configuration looks like:
providers: docker: endpoint: "unix:///var/run/docker.sock" watch: true #exposedByDefault: false network: proxy file: directory: "/configs" watch: true
This is how the nextcloud.toml dynamic config looks like:
[http.routers] [http.routers.nc-rtr] entryPoints = ["https"] rule = "Host(nextcloud.dexvility.com)" service = "nc-svc" middlewares = ["chain-no-auth"] [http.routers.nc-rtr.tls] certresolver = "le" [http.services] [http.services.nc-svc] [http.services.nc-svc.loadBalancer] passHostHeader = true [[http.services.nc-svc.loadBalancer.servers]] url = "http://192.168.1.10:11000" [http.middlewares.nc-middlewares-secure-headers] [http.middlewares.nc-middlewares-secure-headers.headers] hostsProxyHeaders = ["X-Forwarded-Host"] sslRedirect = true referrerPolicy = "same-origin" X-Robots-Tag = "none" [http.middlewares.chain-nc] [http.middlewares.chain-nc.chain] middlewares = [ "middlewares-rate-limit", "nc-middlewares-secure-headers"]
I'm also mounting the entire "configs" directory like so:
services: traefik: volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock:ro - /srv/traefik/data/traefik.yml:/traefik.yml:ro - /srv/traefik/data/acme.json:/acme.json - /srv/traefik/configs/nextcloud.toml:/configs/nextcloud.toml:ro
Upon spinning up traefik with docker-compose, it seems that it never picks up the configuration and does not create the nc-rtr router, nor the nc-middlewares-secure-headers middleware.
Both of these commands return nothing:
docker logs traefik | grep @file docker logs traefik | grep nc-
I will be very grateful if you could help me diagnose the problem. Thank you in advance