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
air started but NOT reloading #274
Comments
I am also experiencing this... on Intel.. I wonder if related to a new version of Docker or something? Maybe fsnotify for some particular reason/stack not working with mounted volumes? Will continue looking but thought I'd post here to show support. Works fine locally, without Docker. EDIT: Seems potentially related from mounted volumes on Docker for Windows/WSL not firing the necessary I/O events.. can anyone else confirm? EDIT2: The real issue is here microsoft/WSL#4739 and I was able to resolve my problem by integrating Docker with my Ubuntu WSL2 distro, and putting my file system in the Linux-mounted \wsl$ file system. Now fsnotify is properly detecting changes, and Air works! |
Good for you, if it's not an ARM thing, then I'll wait for Air to get updated :) |
Checking in - @kockok did you ever find a resolution for this? I'm running into the exact same problem setting up air to run w/ docker on my M1. |
Negative, I switched to |
Gotcha. Is there an existing issue that addresses this? If not shouldn't this one be reopened? |
I'm new to Go, but I'm having the same problem.
My simple sample project structure and code looks like this: ...which results in a simple page that looks like this: So I go to make a change in ...but the terminal output doesn't change at all, like Air SAYS it's "watching" for changes, but when I save, nothing happens in the output. So then, even after clearing browser cache, and using a new incognito window, the change doesn't even reflect on the page: Forgive my newbie-ness, but what's happening here? |
One thing that might be worth mentioning here is that I’m running this inside a docker-compose. Maybe it doesn’t apply changes saved in a container, but only on local instances of the app? |
I'm fairly confident that the issue is due to (Or, fsnotify could add polling themselves, but this has been open since 2014: fsnotify/fsnotify#9 (comment)) (Alternatively, you can standardize on a singular file system.. such as pairing Docker with WSL2 and working out of the \\wsl$ directory as I described above. I found this had some other side effects down the road so I reverted, but it is a solution) Thus, this issue is better closed in favor of/described by #190 (or the earlier, but less discussed, #67). |
Just noticed my Docker Desktop in Linux use virtiofs in container, so I tried disable it thourgh "~/.docker/desktop/settings.json" setting "useVirtualizationFrameworkVirtioFS": true -> "useVirtualizationFrameworkVirtioFS": false. After that Docker Desktop stop running. And I just installed usual docker :), and now hot reload is working. |
I tried this. Unfortunately does not work, after I set |
mine still doesn't work even after updating the docker engine version to |
I tried both versions and neither detected a difference on Docker.
|
I'm facing the same issue in Windows 11 on Docker v20.10.22 |
WIndows 10, Docker v20.10.22, ditto. Working if run air from terminal, not working if run it from docker compose. |
Unfortunately, I have the same problem.
.air.toml
docker-compose.yml
|
I haven't tried yet but maybe for when working from vscode Devcontainer could be the solution taking into account it'll handle the container file system, here's a small example about that: https://github.com/devmeireles/go-shop-store By the end of the day I moved to CompileDaemon |
I had same issue but only forget docker-compose a volume-mount setting .
web:
container_name: go_app
volumes:
...
- ./app:/app #← add this |
VScode alternative solution is to use Dev Container and Docker Extensions (by Microsoft.com). Connect to the container via instructions provided by Dev Container and navigate to the working directory through the explorer (you may be defaulted to /root/) and file changes will reload with Air. With the volume type mount, I haven't seen any issues arise in the remote vscode instance; however, this still has no effect on the host vscode instance, as there seems to be no response with file changes in Air. So you must use the remote vscode instance. I haven't tested with a remote docker instance either, as I am hosting docker on the host machine. note: vscode dev container instance will not have your extensions. |
I'm on windows, i thought it may be a permission issue, so i started vscode and docker as administrator, but no luck. the only solution i found was to make air to use polling instead of events, so what you should do is basically change poll to true and it should work # Poll files for changes instead of using fsnotify.
poll = true |
Excellent answer. It works for me. i have just changed in the .air.toml |
The perfect solution 💕Issue: Air is starting but not reloading on changes in the project Solution: In .air.toml file add poll = true This is because Windows has some restrictions and to overcome that we set poll to true Solution in code:
|
I think it's solved |
It's the docker issue for me. Just updat to the latest docker app. |
i have this problem just quite terminal and run air command again. |
Try changing your browser or just follow my solution |
it works for me, thanks |
Polling is not a performant solution. What is the underlying issue here? I have tested on Arch and Windows and both platforms suffer from the same issue.
|
it works for me |
Yes, polling is not the best option, but as long as we are only using air for development, it is acceptable. Air does not use additional memory, but it does make reloading somewhat slower, which is fine for development purposes. Perhaps this issue will be resolved later. |
It seems to be working, but there's no rebuilding after I change the code.
Dockerfile:
docker-copose.yml
I'm using M1 macbook, just wondering if it's an ARM/AMD thing.
The text was updated successfully, but these errors were encountered: