Repository navigation
VS Code on Xanadu
Visual Studio Code is a popular integrated development environment (IDE).
It has a lot of really nice features for editing and testing code, so many folks are interested in connecting it to the Xanadu cluster for their work. It causes a some problems if you simply use it via SSH and connect to a login node, however, so we recommend following the steps below to use it.
The general approach is to use a piece of software provided by the VS Code developers to set up a VS Code server and a tunnel through which to access it on a xanadu compute node, and then connect, either through a web browser instance of VS Code or the desktop app, from your local machine to that server. The VS Code server app makes this very simple.
We're just getting this all sorted out, so these recommendations may be updated. If you have any suggestions or run into problems, please let us know!
NOTE: Xanadu runs on an old version of CentOS. Versions of VS Code > 1.85.2 will not be able to connect. So be sure to download 1.85.2 (the curl command below pulls the 1.85.2 CLI). You can get 1.85.2 for your local machine here and prevent it from automatically updating with these instructions. Alternatively, newer versions of VS Code work fine on the Mantis cluster, which we will be transitioning to in the near future.
-
Log in to Xanadu, download the VS Code command line interface (cli) and decompress it.
curl -Lk 'https://update.code.visualstudio.com/1.85.2/cli-alpine-x64/stable' --output vscode_cli_1.85.2.tar.gzYou should now have an executable called
code. You will use this every time you want to set up a server, so keep this somewhere handy. -
Begin an interactive session, for example:
srun -c 4 --mem=10G -p general --qos=general --pty bash
If you're just editing code, a couple of processors and a few G of memory should be enough. If you plan on doing something more intense, request resources accordingly.
-
Inside the interactive session, navigate to the directory you want to work in (not 100% necessary, but will save a step later) and start the cli. I want to work on my bokoblin genome assembly, in
~/cbc_projects/bokoblin_genomeand I'm keeping the VS Code cli here~/bin/vscode_cli/codeso I'll do the following to set up the server and the tunnel:cd ~/cbc_projects/bokoblin_genome ~/bin/vscode_cli/code tunnel
-
The program will now ask you to visit a github URL and enter a code it provides to confirm you want to connect. Then it will give you a URL you can visit, which will open VS Code in a web browser, and at that point you're done. You can start editing.
-
When you are done working, kill the VS Code server program, and close your interactive session.
If you want to work in the VS Code desktop app, you can do that as well. You will need to install the Remote Development Extension Pack. After that, you can connect by clicking the blue >< button in the lower left part of the VS Code window and selecting "Connect to Tunnel", and connecting to the tunnel you've created.