Skip to content
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

Watch doesn't work on Windows + docker volumes #210

Closed
lilactown opened this issue Feb 26, 2018 · 7 comments
Closed

Watch doesn't work on Windows + docker volumes #210

lilactown opened this issue Feb 26, 2018 · 7 comments

Comments

@lilactown
Copy link

The situation I'm dealing with:

I'm currently developing an app that needs to work on both Windows + Mac. To ease some of the friction getting the development environment setup, I've put it inside of a docker container running Linux.

The problem is that on windows, filesystem events do not work with shared volumes on docker. Basically, the FS events are emitted on the host platform but not the container that has mounted the directory as a volume.

My current thinking is I should do one of two things:

  1. Fork shadow-cljs and add a polling option to the watcher that I can enable for Windows
  2. Create a separate client + server program that listens for the fs events on the Windows host and sends them to the server in the container, that triggers some action that will cause inotify to emit a proper event.

Any thoughts?

@thheller
Copy link
Owner

You are building an app for Windows + Mac but to make development easier you are introducing Linux to the mix? Wouldn't it be easier to just work on Windows or Mac directly? Why add another completely different system?

If I understand you correctly shadow-cljs is running inside the docker VM and you editing the files locally which are also mounted using a shared folder inside the VM?

It should be fairly simple to add a polling file watcher since there are already 2 different file watching implementations. Adding a config option to let you select a third would not be hard at all.

@lilactown
Copy link
Author

lilactown commented Feb 26, 2018

😅 Yeah I misspoke - the app runs on Linux (whatever AWS flavor...) and developers are running Mac or Windows, but yes, it is starting to turn into kind of a rube-goldberg contraption...

Your understanding is correct.

Yeah, I think polling is the simplest option. That would be awesome if it was available to toggle - perhaps even at runtime?

@thheller
Copy link
Owner

I currently have 2 different watch implementation since the default JDK watcher on OSX used polling and was way too slow. The hawk based version is currently the default on OSX/Linux. On Windows the JDK watcher works just fine so I'm using that. I never tested how well the JDK watcher works on Linux.

First we should confirm that the default JDK watcher works in your setup since it might just be hawk not working.

@thheller
Copy link
Owner

thheller commented Feb 26, 2018

Please run shadow-cljs clj-repl inside the VM.

(require '[shadow.cljs.devtools.server.fs-watch-jvm :as fs-watch])
(require '[clojure.java.io :as io])

(def x (fs-watch/start [(io/file "src")] ["cljs"] prn))

Then inside your usual editor edit/save a .cljs file. If something is printed inside the REPL window the watch seems to trigger?

@lilactown
Copy link
Author

lilactown commented Feb 26, 2018

I can confirm that running fs-watch-jvm inside the VM against a directory that is mounted using a shared folder, and then modifying the file on the host, does not trigger any message.

Just to dot my i's and cross my t's, poking the file on the container does elicit a message. In the container, I did chmod 777 dev.cljs inside of the shared src folder and received a message.

@thheller
Copy link
Owner

thheller commented Feb 28, 2018

Try setting :fs-watch {:watcher :polling} in your shadow-cljs.edn config.

You can also set this in ~/.shadow-cljs/config.edn for CI only.

PS: With 2.2.0.

@lilactown
Copy link
Author

Works! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants