This page describes a workflow on how to build and test NVIDIA Infra Controller (NICo) inside a remotely running docker container. The advantage of this workflow is that it requires no tools to be installed on your native Machine, but still can provide you a similar development feeling.
code command for MacBook:
Cmd + Shift + P to open the Command Palette.Shell Command: Install 'code' command in PATH and select it. This sets up the code command for your terminal.~/.ssh/known_hosts file.
Source: Stack OverflowStart VS Code using the code command in the same shell after running nvinit:
Click the remote button on the lower left of the IDE window:
.
Select “Connect to Host”, choose the remote hostname defined in Prerequisites, and connect. A new Visual Studio Code window should open, which is now on that host.
Inside that window, open the folder which contains the NICo project.
Assuming that remote machine already has all dev tools installed, and you want to work directly on the machine instead of inside a container, you could open up Visual Studio Code’s integrated terminal, and for example run:
In order to get proper IDE support also while working on the remote host, you can install the “Rust Analyzer” extension on the remote host. To do so:
SSH: $hostname - Installed..toml files, and GitLens.On top of developing on a remote host, one can develop inside a container that contains all dev tools. The container can either run locally (if you work on a Linux machine), or on a remote Linux machine.
To work inside the remote container, the following steps are performed:
.devcontainer/devcontainer.json file with the following details
Dockerfile, launch it as a container, install a VsCode remote server in it,
and launch your editor window in it.While the last step will allow you to build the project and run some unit tests, all unit tests which require a database will fail. To fix this, start the postgres server inside the development container:
DATABASE_URL environment variable:
With those steps completed, running cargo test should succeed.
If you also want to run or debug unit-test from within Visual Studio code using the inline buttons “Run Test” and “Debug” that Rust-Analyzer adds, you have to add the following configuration to the Visual Studio Code json config file:
root inside the dev container, editing files might make them
owned by root, which can prevent working on them from your regular desktop.
You might need to reset ownership when going back to your regular environment:
.git be owned by rootThose problems might be avoidable by being able to set remoteUser in devcontainer.json
to one’s alias. However when doing that I wasn’t able to build the devcontainer image
anymore, since it is missing my user alias in /etc/passwd.