cortesi / modd

A flexible developer tool that runs processes and responds to filesystem changes
MIT License
2.8k stars 128 forks source link

Support polling of changes (for Vagrant compatibility) #32

Closed philipithomas closed 8 years ago

philipithomas commented 8 years ago

I'm trying to run Modd in Vagrant, and apparently changes made outside the VM do not play nicely with tools for watching filesystem changes (related Stack Overflow). One solution is polling the filesystem for changes.

Would polling fit into the architecture? (Are there any other known Vagrant workarounds for detecting host -> vagrant VM file changes?)

cortesi commented 8 years ago

Hi there. This is quite a complicated case to support. The file system monitoring library we use does not have a polling back-end, and I frankly don't relish the prospect of implementing one from scratch. It would be tricky to get right and portable, frightfully inefficient, and very rarely used.

To support this natively in modd, one could have a local/remote split, with an ordinary watcher monitoring for changes outside the VM, and then triggering restart inside the VM over a socket. I can imagine a syntax for this that works, where we have a match condition over remote file changes, and where all modification notices are sent to the remote modd instance. This would be a significant amount of effort to implement, and I'd want to see if there are other, similar use cases that could be served by the same mechanism.

My first impulse here would be to see if you could just use modd as-is. We can trigger arbitrary commands locally on modification - so all that's needed is an RPC mechanism to do whatever needs to be done inside the VM from the host machine. I can easily imagine setting this up over ssh with key-based auth, for instance.

Thoughts?

philipithomas commented 8 years ago

Thanks for the feedback @cortesi. We implemented a host OS filesystem watcher with modd, which then ssh's in to make changes. I'm experimenting with two other possible improvements - using Unison to sync files, and switching from vagrant to Docker.

I'm fine with marking this issue as "won't fix" for now and closing it.

cortesi commented 8 years ago

@philipithomas Yes, I think let's close this for now. Please do let me know if there's anything else you feel modd needs to do to support this use case, though.