VS Code Remote on Mistral#

Target audience#

  • vs code is your favorite IDE

  • interested to use the remote extension

VS Code Remote extension#

Visual Studio Code Remote Development allows you to use a container, remote machine, or the Windows Subsystem for Linux (WSL) as a full-featured development environment.

So the idea is that you want to remotely create and manage code on Mistral using VS Code.

How it works?#

../../_images/architecture.png

https://code.visualstudio.com/docs/remote/remote-overview

The issue#

In order to use vs code remote you need the Remote Development extension pack, which includes three extensions:

  • Remote - SSH

  • Remote - Containers

  • Remote - WSL

Unfortunately, none of these will work due to system requirements. The extension pack requires x86_64 Debian 8+, Ubuntu 16.04+, CentOS / RHEL 7+. These are not available on Mistral (RHEL 6).

For instance, if you want to use Remote - SSH you will probably see an error like this:

The remote host may not meet VS Code Server’s prerequesties for glibc and libstdc++.

This is somehow similar to the issue described here. The Docker container extension will not work neither, Docker is not supported on Mistral andin HPC in general.

The workaround#

As mentioned before, the Remote - Containers extension in the pack is limited to Docker and other container technologies which are not supported on Mistral (we support Singularity only). According to the VS Code developers, there is currently no plan to add support to Singularity in the pack.

However, we provide you here with a workaround using Singularity containers.

The temporary solution consists of modifying the vs code starting script on the remote machine (Mistral node).

Requirements#

  • a supported Singularity image on mistral (e.g. Centos 7 or Ubuntu 16)

  • a server.sh that you should find in `.vscode-server/bin/XXXX/

  1. set the SINGULARITY_IMAGE to the image in your workspace (e.g. centos_7.sif)

  2. add module load singularity/3.6.1-gcc-9.1.0

  3. change "$ROOT/node ..." to singularity run "$SINGULARITY_IMAGE" $ROOT/node ...".

The server.sh looks like this:

#!/usr/bin/env sh
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#


module load singularity/3.6.1-gcc-9.1.0

case "$1" in
    --inspect*) INSPECT="$1"; shift;;
esac

ROOT="$(dirname "$0")"

singularity run "centos_7.sif" $ROOT/node ${INSPECT:-} "$ROOT/out/vs/server/main.js" "$@"

After that, you can try again in your host (laptop).

Warning

This is just a temporary workaround, there is no guarantee that this solution will always work for you. Due to networking issues, it might not work for the firs