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

Reload not working on OSX #47

Open
paologf-mb opened this issue Mar 4, 2020 · 13 comments
Open

Reload not working on OSX #47

paologf-mb opened this issue Mar 4, 2020 · 13 comments

Comments

@paologf-mb
Copy link

I'm setting up a project in Go following this guide https://levelup.gitconnected.com/how-to-live-reload-code-for-golang-and-docker-without-third-parties-ee90721ef641 , on Linux it works fine. Using it from mac when I change a file from my editor, the file into the container change but CompileDaemon doesn't recognise the change and doesn't rebuild.
If I enter the container and save the changed file, CompileDaemon rebuild.

DOCKER FILE

FROM golang:latest

WORKDIR /go/src

DockerCompose

version: '3'
services:
  app:
    build:
      context: .
    volumes:
      - ".:/go/"
    container_name: golang_app
    command: bash -c "go get github.com/githubnemo/CompileDaemon && CompileDaemon -command="./app""
    ports:
      - "8080:8080"
    tty: true
    depends_on:
      - db

VERSIONs

OSX Catalina 10.15.2
Docker version 19.03.5 ( Using Docker Desktop application)
@paologf-mb
Copy link
Author

Here the code example repository https://github.com/paologf-mb/go-docker-compiledaemon

@paologf-mb
Copy link
Author

Any help?

@funktionslust
Copy link

@paologf-mb Did you try it with go 1.12?

@yuraxdrumz
Copy link

Same as #44
I suspect its how the container sends events to the host due to the difference in file systems and their synchronization. Sometimes it works fine and sometimes it stops working altogether. Removing large folders like vendor and .git helped the rebuilds. Giving more resources helped as well, but it still occurs from time to time

@pycckuu
Copy link

pycckuu commented Apr 26, 2020

@pycckuu
Copy link

pycckuu commented Apr 28, 2020

In my case, it was Docker issue. After reinstallation of Docker, everything worker fine. Thanks!

@yuraxdrumz
Copy link

@pycckuu I tried reinstalling docker but it didnt work, plus I have tried it over 10 MacBooks at work and same result for everyone, reload works several times and afterwards doesn't recognize changes.

@githubnemo
Copy link
Owner

Sadly I have no macs available so it is hard for me to debug this but I doubt there is anything I can actively do at this point. It is either fsnotify/fsnotify that has issues or the implementation of the bind mount between MacOS host and the container.

@githubnemo
Copy link
Owner

Thanks to @HurSungYun, CompileDaemon now supports -polling=true which switches from FS notifications to active polling for changes. While this is neither instant (notifications are delayed by the polling rate) nor resource friendly (always looking instead of being event driven) it is a workaround to help get people back to work. I strongly discourage you from using this in any production environment.

@HurSungYun
Copy link
Contributor

@githubnemo It would be great if warnings are documented in READMD.md. Can I update it?

Btw, I believe using hot-reload daemon for production is not a good practice in itself, isn't it?

@HurSungYun
Copy link
Contributor

oh you already updated it. nevermind XD

@githubnemo
Copy link
Owner

githubnemo commented Nov 29, 2020

@githubnemo It would be great if warnings are documented in READMD.md. Can I update it?
oh you already updated it. nevermind XD

Yep but thanks anyway :)

Btw, I believe using hot-reload daemon for production is not a good practice in itself, isn't it?

I have nothing against using fsnotify based hot-reload but using polling should be discouraged as it is quite wasteful and should never become a default or habit just because there's a bug somewhere.

(But you are right of course, normally you would expect your artefacts to be stable and not need hot-reloading once shipped to production, as such I would see it as bad practice to use hot-reloading in production.)

@justinpage
Copy link

I started having this problem with the latest versions of docker-desktop. One thing I noticed was the default behavior of enabling the Use gRPC FUSE for file sharing flag in the preferences. Turning this off, and restarting my machine, seemed to resolve the issue.

Screen Shot 2020-12-05 at 10 02 43 PM

Perhaps others will have luck with toggling this option off?

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

7 participants