network-management-client icon indicating copy to clipboard operation
network-management-client copied to clipboard

Add devcontainer

Open ThatKalle opened this issue 8 months ago • 12 comments

Added an initial development container configuration. Tested on a Windows11 host, Docker Desktop, and a WSL2 Ubuntu installation.

It starts up, installs dependencies needed to run pnpm run rust:dev. Also installs meshtasticd and meshtastic CLI.

With that it's possible to access the application, see a node.

I did try changing some text in the application and it works.

image

issue #471 issue #472

ThatKalle avatar Mar 07 '25 00:03 ThatKalle

Wow! This is great work. This was attempted in #491 but looks like that PR was closed. Love the inclusion of meshtasticd, this will be hugely helpful for testing in CI/CD etc.

Could you add something to the readme that states the dev container only works on Linux? I spun it up on my Mac and ran into issues with USB forwarding, and would also probably run into problems with display output from GTK.

Could you also move the config.yaml to a directory other than the root? Maybe into /.devcontainer/? Or give it a more descriptive name?

matthewCmatt avatar Mar 08 '25 12:03 matthewCmatt

Could you also move the config.yaml to a directory other than the root? Maybe into /.devcontainer/? Or give it a more descriptive name?

Sorted! meshtasticd looks for it in the current directory, but it was possible to set a new location with -c path syntax.

Could you add something to the readme that states the dev container only works on Linux? I spun it up on my Mac and ran into issues with USB forwarding, and would also probably run into problems with display output from GTK.

That is quite, interesting. It's kind of supposed to work everywhere, and it doesn't do any USB forwarding. I don't have access to Mac or Linux hardware to test on.

I myself run it on a Windows 11 host with Docker Desktop and WSL2 Ubuntu backend.

This was attempted in https://github.com/meshtastic/network-management-client/pull/491

Oh neat! Didn't see that one. I've copied most of the README content with some updates.

ThatKalle avatar Mar 08 '25 13:03 ThatKalle

I myself run it on a Windows 11 host with Docker Desktop and WSL2 Ubuntu backend.

Ah, great to hear it works with WSL. Probably just needs some tweaking for MacOS/Linux, but that shouldn't hold up this PR!

Could still use a note in the README here about it only working in Windows, just so new devs don't get the wrong idea and get frustrated if things don't work as expected.

matthewCmatt avatar Mar 08 '25 13:03 matthewCmatt

display output from GTK

I have somewhere in the back of my head that playing with the $DISPLAY variable can help that flow. I've added a RUN step in the Dockerfile, made no difference to me, still works both ways,, but that might very well be some Microsoft magic.

Also added a note at the top of the README, hopefully that can get updated as more devs give it a go 👍

ThatKalle avatar Mar 08 '25 13:03 ThatKalle

I have somewhere in the back of my head that playing with the $DISPLAY variable can help that flow. I've added a RUN step in the Dockerfile, made no difference to me, still works both ways,, but that might very well be some Microsoft magic.

Yeah WSL is pretty well-instrumented from my experience. Looks like this thread has some similar issues to mine, so maybe related to some MacOS docker stuff being more locked down?

Also added a note at the top of the README, hopefully that can get updated as more devs give it a go 👍

This note is perfect, thanks.

matthewCmatt avatar Mar 08 '25 13:03 matthewCmatt

Updated to match https://github.com/meshtastic/firmware/discussions/4278, give it a go

ThatKalle avatar Mar 08 '25 14:03 ThatKalle

Updated to match meshtastic/firmware#4278, give it a go

Still no dice. I'm getting the same SPI issue when trying to run the standalone meshtasticd container, so this may need some more involvement to debug.

In the meantime I'm spinning this up on an old Ubuntu machine to see if that works. Container build took about 40 minutes, and had to retry a few times to get the VSCode Server to install in the container. I got a similar Gtk-WARNING **: 15:15:22.896: cannot open display: :0 error

matthewCmatt avatar Mar 08 '25 15:03 matthewCmatt

In the meantime I'm spinning this up on an old Ubuntu machine to see if that works. Container build took about 40 minutes, and had to retry a few times to get the VSCode Server to install in the container. I got a similar Gtk-WARNING **: 15:15:22.896: cannot open display: :0 error

I ran the following on the Ubuntu host:

xhost +

This lets the display output through, but the initial container script fails. On finishing, I was able to run pnpm rust:dev and the app came through fine with the meshtasticd node showing up properly! If we add the above to the README, I think we can list Ubuntu as a tested environment

matthewCmatt avatar Mar 08 '25 15:03 matthewCmatt

I have just tested today on Fedora/Nobara 41 worked as it was meant to be, great work. I used a remote web connection to my node this time.

takov751 avatar Mar 15 '25 19:03 takov751

Hey @matthewCmatt , if you do find a moment. I did read somewhere that one is supposed to use debian bullseye on apple silicon. I don't know if you are running a apple silicon mac, but if so, maybe that change would solve the issues for you?

Adjust line 1 in .devcontainer/Dockerfile from FROM mcr.microsoft.com/devcontainers/base:bookworm to FROM mcr.microsoft.com/devcontainers/base:bullseye and try to Rebuild the container.

ThatKalle avatar Mar 19 '25 14:03 ThatKalle

@ThatKalle

Thanks for looking into this! I was able to get the devcontainer working fine by installing XQuartz for the display forwarding. This worked on Apple ARM fine without having to change the Debian version. I had to resize the window manually to get the virtual display to fill the whole window, but otherwise works well!

matthewCmatt avatar Mar 22 '25 22:03 matthewCmatt

Here's the guide I used to get it working https://gist.github.com/sorny/969fe55d85c9b0035b0109a31cbcb088

matthewCmatt avatar Mar 22 '25 22:03 matthewCmatt

@ThatKalle Thanks for implementing this!

matthewCmatt avatar May 10 '25 12:05 matthewCmatt