Hello,
I am facing an issue where Traefik does not seem to reload the configuration after making changes.
I have organized my configuration files as follows:
/traefik/configurations/
├── routers/
│ ├── domain1.yml
│ ├── domain2.yml
├── middlewares/
│ └── middleware1.yml
├── services/
│ └── service1.yml
In the config.yml
file, the provider is configured as follows:
providers:
file:
directory: "/home/debian/traefik/configurations"
watch: true
However, when I modify the domain1.yml
file, the configuration doesn't seem to reload automatically. I have to restart Traefik for the changes to take effect.
On the other hand, I noticed that if I configure the provider like this, it works, but only for the files in the routers
folder, and not for middlewares
or services
:
providers:
file:
directory: "/home/debian/traefik/configurations/routers"
watch: true
If anyone could help me resolve this issue, it would be greatly appreciated.
Thank you in advance!
It seems folders in the folder are not watched.
So either you place all files inside the config folder directly, or you create 3 providers.file
watching the 3 folders.
I was able to do some research, and indeed, this is not supported by Traefik. I am quite surprised, as this feature seems essential for working effectively with a reverse proxy in dynamic mode.
opened 01:46PM - 05 Feb 25 UTC
kind/proposal
area/provider/file
### Welcome!
- [x] Yes, I've searched similar issues on [GitHub](https://github… .com/traefik/traefik/issues) and didn't find any.
- [x] Yes, I've searched similar issues on the [Traefik community forum](https://community.traefik.io) and didn't find any.
### What did you expect to see?
Hi!
# Feature Request:
I would like to configure multiple directories in the file provider config so that the configurations in multiple directories are loaded and watched for changes. This would look something like this:
```yaml
providers:
file:
directories:
- "/etc/traefik_dynamic/global"
- "/etc/traefik_dynamic/host"
watch: true
```
# Background
The issue I am running into is this: I am using traefik inside docker containers on multiple hosts. These hosts share a basic configuration (`traefik.toml` + `dynamic_conf.global.toml`) and then have specialized settings in a separate `dynamic_conf.host.toml`.
Now, because of the Limitations described in the [File Provider docs](https://doc.traefik.io/traefik/providers/file/), I have to mount these config files into the traefik container by mounting their parent directories - written something like this in docker-compose:
```yaml
services:
traefik:
...
volumes:
- ./etc:/etc/traefik:ro
- ./etc_dynamic.global:/etc/traefik_dynamic/global:ro
- ./etc_dynamic.host:/etc/traefik_dynamic/host:ro
```
Then configure the file provider like above.
# Alternatives
+ I could mount a volume inside a volume - however this would run into this issue: https://github.com/traefik/traefik/issues/3986
+ have multiple file providers - that is not possible: https://github.com/traefik/traefik/issues/9101
+ use a script that copies together the right configurations - I can not run scripts on the hosts in this setup, so I would have to modify the traefik container itself and then implement my own listener for file changes. Being able to configure this in traefik would be way easier and less prone to errors.
Thanks!
opened 07:00AM - 08 Oct 18 UTC
closed 02:17PM - 16 Jan 25 UTC
resolution/declined
area/provider/file
status/5-frozen-due-to-age
### Issue
Traefik file handlers not looking for the files in the subdirectorie… s
https://docs.traefik.io/configuration/backends/file/#multiple-separated-files
In documentation ,it is clearly mentioned ,that file handlers have capability to look into the subdirectories for the files dynamically
### How to reproduce the issue ###
Step 1:- Contents of the main.toml file
```sh
defaultEntryPoints = ["http"]
[entryPoints]
[entryPoints.http]
address = ":80"
[api]
entrypoint="dashboard"
dashboard= true
debug=true
[file]
directory= "/home/traefik/hostRules/"
watch=true
```
Step 2:- Now I am dynamically creating the subdirectories inside the mounted directory

For example the dummy configuration of one of the traefik file is:-
```sh
[file]
[frontends]
[frontends.front_end_abc]
backend="backend3"
passHostHeader = true
[frontends.front_end_abc.routes.first]
rule="Host: testingpurpose.com"
[backends]
[backends.backend3]
[backends.backend3.servers.first]
url = "http://192.168.1.2:39832"
```
But the configurations are not loaded dynamically until ,I restart the docker image
Command used to up the docker container
```sh
docker run -d -v /home/traefik:/home/traefik -p 80:80 -p 443:443 -p 172.31.30.68:8080:8080 testing-traefik /usr/bin/traefik -c /home/traefik/main.toml
```
### What did you expect to see?
I expected that the configurations inside the subdirectories should be loaded dynamically without restarting the docker image
### What did you see instead?
I have to restart the docker image ,in order to load the configurations inside the subdirectories that are creating dynamically.
### Output of `traefik version`: (_What version of Traefik are you using?_)
```
Used the latest traefik image ,for building own docker image on the top of centos
```
The best solution I’ve found so far is to place the dynamic files at the root of the directory and keep the more static configurations in separate folders.
/configurations
├── /middlewares
├── middlewareIP
├── middlewareWhiteList
├── /routers
├── security1
├── security2
domain1
domain2
domain3
But it remains disastrous between the concept of dynamic configuration (for IPs, for example) and the notion of organization within the teams.
Over the years only very few people asked for this, so it seems like a niche topic, on which the devs usually don't place high priority on.
You are probably using Traefik as free community edition, the great thing is it's open-source, so you could (let someone) implement the feature and create a pull request.