-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not looking for files in subdirectories dynamically #3986
Comments
Hello @BullHacks3 , Many thanks for interest in the project. I guess the problem comes from the watcher we use which is not recursive. As a workaround, by waiting for the fix, you can touch a file in the root directory when a modification is done in a subdirectory to load all the configuration (or make a modification in an existing file). |
I'm guessing this isn't going to get fixed, since last update was 1.5 years ago? :( |
The issue is due to fsnotify/fsnotify not capable of watching file recursively. To provide a cross platform solution, fsnotify relies on adapters (inotify, ReadDirectoryChangesW, kqueue) but recursive file watching is not supported everywhere. There is some work in progress (fsnotify/fsnotify#18, fsnotify/fsnotify#114, fsnotify/fsnotify#12) to bring support but we are not yet there. An alternative would be to implement a user-space solution based on |
This comment has been minimized.
This comment has been minimized.
Same in Traefik v2.5 |
same for traefik v2.9.1 based on @nmengins suggestion we're using an alpine container with inotify-tools to watch for file changes recursively and touch an empty file in traefiks dynamic conf root: docker run --rm -it \
-v $PWD/traefik.d/:/watchme:ro \
-v $PWD/traefik.d/.please_reread_files_traefik:/touchme \
alpine \
sh -c 'apk update && apk add inotify-tools && while true; do inotifywait -e modify,create,delete,attrib -r /watchme && touch /touchme; done' |
Hello, I link this issue to the PR #9993. If any contributor finds a better solution, we would love community support to address it. |
Not sure if responding on a 6 month old thread is the right place, but is there a reason why there is code in the File provider to specifically exclude adding a watcher for sub directories? I understand that you cannot recursively monitor a sub-directory that is created after traefik has started, but adding a file to a sub-directory that existed at startup also does not work, and it would appear that this is intentional. I forked the repo, commented out those lines and built an image and can confirm that creating a new file within a sub-directory that existed at start does automatically load the config from that file. Curious as to why lines 69-72 exist |
Issue
Traefik file handlers not looking for the files in the subdirectories
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
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:-
But the configurations are not loaded dynamically until ,I restart the docker image
Command used to up the docker container
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?)The text was updated successfully, but these errors were encountered: