Running code-server on Ibex

code-server is an opensource alternative to running VS code on a remote machine.
The server instantiates on a remote host and the client can run in a browser. The following has been tested on Ibex’s GPUs node and client in Google Chrome on local workstation.

Please login to username@vscode.ibex.kaust.edu.sa for the steps below. This is to isolate the processes invoked by VSCode.

It applies to those who are only interested to use Ibex’s filesystem in your local VS Code installation.

Step 1

Install code-server in your conda environment:

conda install -c conda-forge code-server

Step 2

You can run code-server remote server either interactively or in a batch job. Batch jobs are preferred

Interactive

Allocate a node with e.g. GPU on Ibex (assuming you are on vscode.ibex.kaust.edu.sa node):

srun --gpus=1 --time=01:00:00 --pty bash echo $(/bin/hostname)

Note the hostname of the node your job has been allocated. E.g. in this case I have been allocated dgpu501-22

 

Edit ~/.config/code-server/config.yaml to set a password of your choice and the port on host machine to bind to. For example, I do the following:

bind-addr: dgpu501-22:10121 auth: password password: 7days7nights cert: false

The above password will be needed to login to the client session.

Start code-server:

This will start the server within your GPU enabled interactive job. The output will look as follows:

Batch job

Modify the following jobscript according to your parameters:

Step 3

Port forwarding is required to bind to the listening port of the remote host (Ibex GPU node). For this, open a new terminal window and start an SSH tunnel to achieve the above:

In the above command line, dgpu501-22 is the hostname of the machine our job is running (server is running). Use you username instead of shaima0d and the jump server/node is glogin login node.

In case you have submitted a batch job, please see the slurm output and copy the ssh command from there and paste it in a new terminal

 

Step 4

Once the SSH tunnel is established, you can open the URL that code-server is listening on in the browser to access VS code/code-server

Fill the password and your session is ready to use.

 

When finished, please exit the job on Ibex.