I know there are multiple threads discussing NFS mounted volumes and file modification watch issues. Since most of the discussions are old, some from 8 years ago, my goal here is to compile some and bring them up again to check what are the most recent solutions you guys have been using to handle those issues.
The core problem
Linux relies on inotify
, a kernel subsystem, to generate events when files are modified (changed/deleted) and those events are most often used by developer tools to watch files to trigger some task. The core issue is that when you have a volume/folder shared via NFS protocol, it doesn't generate the events, and therefore the tools need to use polling methods instead of trigger based on events.
Polling methods often create multiple issues such as high CPU usage, delay to trigger tasks over file alterations, and so on.
Some of the watching tools:
- Webpack watch: https://webpack.js.org/configuration/watch/
- Guard: https://github.com/guard/guard
Popular threads
- inotify with NFS
- Why are inotify events different on an NFS mount?
- File update in shared folder does not trigger inotify on Ubuntu
- Triggering file changes over VirtualBox shared folders
Nice solution attempts
- Vagrant file system notification forwarder plugin - ABANDONED AND NOT RELIABLE
- vagrant-fsnotify - ABANDONED AND NOT RELIABLE
My current challenge
We run our dev env using macOS as host, Vagrant (provider Virtualbox) with Alpine Linux as the guest, and Docker containers for the services (Node, NGINX...), the setup is running smoothly for everything aside from when the frontend developers need to watch file modifications using webpack watch feature. It works with polling but with a delay of 3-10 seconds.
Any updates or any recommendations on how you solve this problem?