V2.3.0 not reading config directory

All of a sudden, traefik isn't reading the toml file I keep in /config

The docker-compose file was working as before and all I did was update to 2.3.0:

  traefik:
    image: "traefik"
    container_name: "traefik"
    restart: always
    networks:
      - traefik_proxy
    command:
      - "--api=true"
      - "--entrypoints.http.address=:80"
      - "--entrypoints.https.address=:443"
      - "--providers.docker.exposedbydefault=false"
      - "--providers.docker.watch=true"
      - "--providers.docker=true"
      - "--providers.file.watch=true"
      - "--providers.file.directory=/config/"
      - "--global.sendAnonymousUsage=false"
    ports:
      - "443:443"
      - "8080:8080"
      - "80:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ${USERDIR}/Settings/Traefik/traefik.toml:/traefik.toml
      - ${USERDIR}/Settings/Traefik/config:/config
      - ${USERDIR}/Settings/Traefik/acme.json:/acme.json
      - ${USERDIR}/Settings/Traefik/error.log:/error.log
      - ${USERDIR}/Settings/Traefik/access.log:/access.log
    environment:
      - CLOUDFLARE_EMAIL=${CLOUDFLARE_EMAIL}
      - CLOUDFLARE_API_KEY=${CLOUDFLARE_API_KEY}
    labels:
       - "traefik.docker.network=traefik_proxy"
       - "traefik.enable=false"
       - "traefik.http.middlewares.traefik.stripprefix.prefixes=traefik/"
       - "traefik.http.routers.traefik.entrypoints=http"
       - "traefik.http.routers.traefik.service=api@internal"
       - "traefik.http.routers.traefik.tls.options=default"
       - "traefik.http.routers.traefik.tls=true"
       - "traefik.http.services.traefik.loadbalancer.server.port=8080"

and on my config/servers.toml I had this:

[http]
	[http.routers]
		[http.routers.homeassistant]
			entryPoints = ["https"]
			rule = "Host(`sub.domain.net`)"
			service = "homeassistant"
			[http.routers.homeassistant.tls]
			  certResolver = "default"
			  [[http.routers.homeassistant.tls.domains]]
			    main = "domain.net"
			    sans = ["*.domain.net"]

	[http.services]
		[http.services.homeassistant]
			[[http.services.homeassistant.loadBalancer.servers]]
				url = "http://192.168.1.10"
				port = 8123
				passHostHeader = true

	[tcp.services.homeassistant]
		[[tcp.services.homeassistant.loadBalancer.servers]]
			url = "http://192.168.1.10"
			port = 8123
			passHostHeader = true

	[http.middlewares]
		[http.middlewares.homeassistant]
			browserXSSFilter = true
			contentTypeNosniff = true
			forceSTSHeader = true
			SSLHost = "domain.net"
			SSLRedirect = true
			STSIncludeSubdomains = true
			STSPreload = true
			STSSeconds = 315360000
			[http.middlewares.homeassistant.headers]
				FrameDeny = true
				SSLRedirect = true
				# CORS
				accessControlAllowMethods = ["GET", "OPTIONS", "PUT", "POST"]
				accessControlAllowOrigin = '*'
				accessControlAllowHeaders = ['DNT','User-Agent','X-Requested-With','If-Modified-Since','Cache-Control','Content-Type','Range']
				accessControlExposeHeaders = ["Content-Length","Content-Range"]
				accessControlAllowCredentials = true
				accessControlMaxAge = 100
				addVaryHeader = true

All my logs say is "Configuration loaded from file: /traefik.toml" but nothing shows up on the dashboard.

I'm blocked ... what else can I do to track down the problem?

Hello,

In Traefik v2 (since v2.0.0), the sources of static configuration are mutually exclusive:

this means that you can't use a file (traefik.toml) and CLI flags at the same time, you have to choose between CLI flags and traefik.toml file.

Thanks, I’ll make it a point to clear that up on my configuration.

I haven’t made any changes to the above yet, and I downgraded from v2.3 to 2.2.11. It’s working fine now.

The file configuration validation in v2.3.0 is more strict than before, and now the validation can detect more errors.

Your dynamic configuration contains a lot of mistakes.

FYI you can see the errors in your logs.

--- you.toml	2020-09-26 13:50:15.006444662 +0200
+++ fixed.toml	2020-09-26 13:52:37.803076072 +0200
@@ -13,29 +13,26 @@
 	[http.services]
 		[http.services.homeassistant]
 			[[http.services.homeassistant.loadBalancer.servers]]
-				url = "http://192.168.1.10"
-				port = 8123
+				url = "http://192.168.1.10:8123"
 				passHostHeader = true
 
 	[tcp.services.homeassistant]
 		[[tcp.services.homeassistant.loadBalancer.servers]]
-			url = "http://192.168.1.10"
-			port = 8123
-			passHostHeader = true
+			address = "192.168.1.10:8123"
 
 	[http.middlewares]
 		[http.middlewares.homeassistant]
-			browserXSSFilter = true
-			contentTypeNosniff = true
-			forceSTSHeader = true
-			SSLHost = "domain.net"
-			SSLRedirect = true
-			STSIncludeSubdomains = true
-			STSPreload = true
-			STSSeconds = 315360000
 			[http.middlewares.homeassistant.headers]
-				FrameDeny = true
-				SSLRedirect = true
+				browserXssFilter = true
+				contentTypeNosniff = true
+				forceSTSHeader = true
+				sslHost = "domain.net"
+				sslRedirect = true
+				stsIncludeSubdomains = true
+				stsPreload = true
+				stsSeconds = 315360000
+				frameDeny = true
+
 				# CORS
 				accessControlAllowMethods = ["GET", "OPTIONS", "PUT", "POST"]
 				accessControlAllowOrigin = '*'

Also:

  • I think that you can drop tcp.services.homeassistant block because it's not used.
  • I fixed the url of http.services.homeassistant to http://192.168.1.10:8123 but I think it's http://192.168.1.10

Thank you very much @ldez ! :grin:

As for the url of the http services, it's the one with the port number. I also confirmed that so far dropping the TCP block didn't cause any issues.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.