Does traefik support multiple dynamic files?

Hello, newbe here

I use Traefik in production with docker provider and it works perfectly, autodiscovery with labels and stuff... however...
I tried spinning up an instance with a dynamic folder and a couple of files because the intent is to place this instace in front of a couple of different VMs with only one public address to the load balancer VM, however it seems that only some (one?) files get loaded (?)

Here is my complete config: traefik file provider · GitHub
And here is the complete output from docker compose up and loglevel debug: traefik logs · GitHub

For example, the dashboard does not work.
An error occurred during a connection to traefik.example.com. PR_END_OF_FILE_ERROR
And in http (not https) it returns a 404 (instead of redirecting every request to https?).

I don't understand...
Thank you in advance!!

Traefik supports one static config (traefik.yml or command:) and multiple dynamic configs (providers.file or via providers.docker and labels).

Some elements like entrypoint and certresolver belong into static config, see simple Traefik example.

That's the thing I don't understand, static vs dynamic, where am I able to put things into a file, where it is strictly necessary to use the command. Because from a documentation standpoint, for every directive there are examples for both CLI (or labels) and file, but not actually specifying which is static config, which is dynamic, and why doesn't the files work...

Thanks.

Check Configuration Introduction doc.

When in doubt, check the static reference and dynamic file or dynamic Docker labels reference.

Wait, from the docs, it says the static file and dynamic folder are mutually exclusive and the dynamic folder is preferred. How do I set up the static file provider then when already using the dynamic folder, like in the configuration I posted initially?

The content is. Entrypoints belong into static, routers and services into dynamic. See simple Traefik example. Command is static, labels is dynamic.

2 Likes

Thank you @bluepuma77, I have one last unaswered question from the beginning tho, how does one not use command? Like, how do I put everything in a file?

To be precise: I would like this instance to be managed entirely by file, not by CLI commands in the docker-compose.yml.

Static config: either placed in traefik.yml file or command section.

So, can traefik.yml coexist with the dynamic config folder? Because that's the issue that's bugging my head, from the docs it seems they're mutually exclusive...

Yes, they are independent. Static config is read during startup. Dynamic config can change over time, be it files or labels on containers.

I think you can even use a providers.file in static config and watch a full directory, which includes traefik.yml. It's not "nice", but I have seen many people do that, so there seems to be no issue.

I totally got it wrong then, the traefik.yml is where the static configuration goes (if you want to use the file and not CLI or ENV vars), where as the file provider can be either a single file with everything in it, or multiple files in a folder. THAT's what mutually exclusive...
F* myself, I can't read engrish :rofl:

Thank you very much, now everything is much more clear

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