tilt-dev / tilt

Define your dev environment as code. For microservice apps on Kubernetes.
https://tilt.dev/
Apache License 2.0
7.58k stars 298 forks source link

live update doesn't work on rancher desktop / windows #5730

Open nicks opened 2 years ago

nicks commented 2 years ago

From the tilt channel:

I cannot get live_update working on Windows. Tried one Win 10 machine and one Win 11 machine. Same issue on both.
The tar command never finish, it just hangs. Is it supposed to call C:\Windows\System32\tar.exe, because that is what is think is happening (I get the same result if I open up a terminal in windows and execute tar -C / -x -f -)
Will copy 1 file(s) to container: [tilt-frontend-demo-847d79b47b-kn5xd/tilt-frontend-demo]
- 'C:\Repositories\tilt-frontend-demo\src\App.js' --> '/src/src/App.js'
RUNNING: tar -C / -x -f -

Output of tilt doctor:

Tilt: v0.27.3, built 2022-04-22
System: windows-amd64
---
Docker
- Host: [default]
- Server Version: 20.10.11
- API Version: 1.41
- Builder: 2
---
Kubernetes
- Env: rancher-desktop
- Context: rancher-desktop
- Cluster Name: rancher-desktop
- Namespace: default
- Container Runtime: read-failure
- Version: v1.23.5+k3s1
- Cluster Local Registry: none
nicks commented 2 years ago

i can repro but haven't figured out what the issue is yet

nicks commented 2 years ago

OK, confirmed that this is a bug in Rancher Desktop (or one of its subcomponents). You can reproduce it from the commandline. Launch any container in Rancher Desktop, then run:

echo hi | docker exec -i [CONTAINER] cat -

On Docker Desktop, this command prints 'hi', then exits.

On Rancher Desktop, this command prints 'hi', then hangs indefinitely.

Other details

On Docker Desktop, tilt does live_update commands directly through the container runtime (docker exec) rather than through the apiserver (kubectl exec). In theory, we could add a workaround for Rancher Desktop, but this would still be broken for other things (e.g., docker-compose on rancher desktop) so probably better to get it fixed upstream.

jesperume commented 2 years ago

Thanks for the detailed explanation. I managed to solve the issue with live_update by switching from dockerd to containerd runtime in rancher desktop. And in the tiltfile use nerdctl_build instead of docker_build. Works great!

So there is only a issue when you use rancher desktop for windows + rancher dockerd runtime + tile.

nicks commented 2 years ago

ooh that's a good workaround thanks!!

Go2Engle commented 2 years ago

Thanks for the detailed explanation. I managed to solve the issue with live_update by switching from dockerd to containerd runtime in rancher desktop. And in the tiltfile use nerdctl_build instead of docker_build. Works great!

So there is only a issue when you use rancher desktop for windows + rancher dockerd runtime + tile.

I can confirm this works as a fix for me as well!

Go2Engle commented 2 years ago

If anyone else needs another workaround you can use devcontainers in vscode as well. Set rancher desktop to moby. configure your project with devcontainer running on ubuntu (in my case). Config devcontainer for docker from docker and install tilt and kubectl inside container. Copy over kube config to container. Profit! If anyone wants my configs how this is setup please take a look at the sample project I tossed together https://github.com/Go2Engle/tilt-in-devcontainer

nahlian commented 2 years ago

@Go2Engle Have you been able to get live update to work with vscode devcontainer and docker compose? I have tried rancher desktop and docker desktop on two different computers. I have tried docker-in-docker and docker-with-docker on both systems. Either way, live update never picks up the changes. As soon as I open locally, boom live update off and running.

Don't want to hijack this issue, if have this working then I will keep searching. I just searched for devcontainer and found this issue.

Go2Engle commented 2 years ago

@nahlian I dont have much experience with devcontainer with docker compose. Feel free to shoot me an email(found on my profile) and id be glad test for you.

joebowbeer commented 2 weeks ago

@nahlian Regarding devcontainers, incl. docker-in-docker, docker-outside-of-docker, docker-outside-of-docker-compose, the updated docs:

https://code.visualstudio.com/remote/advancedcontainers/use-docker-kubernetes