= Run Visual Studio Code as a service on a remote host =
Two SEPP software packages of Visual Studio Code are available:
* [[https://www.sepp.ee.ethz.ch/sepp-debian/code-1.x.x-sr.html|Code]], started from the command line with `code`, the desktop application
* [[https://www.sepp.ee.ethz.ch/sepp-debian/openvscode_server-1.x.x-sr.html|OpenVSCode Server]], started from the command line with `openvscode-server`, the web application
This article explains how to start `openvscode-server` as a service on a remote PC or cluster node and connect to it with a web browser.<
>
A typical use case is to start it within a cluster job for debugging.
== Use case: Start openvscode-server in an interactive Slurm job ==
Within an [[Services/SLURM#srun_.2BIZI_Start_an_interactive_shell|interactive shell in a Slurm job]], issue the following command:
{{{#!highlight bash numbers=disable
OVS_HOST=$(hostname -f) && openvscode-server --host $OVS_HOST --accept-server-license-terms --telemetry-level off |sed "s/localhost/$OVS_HOST/g"
}}}
In the example above, a random free port is picked. For access from a remote PC through VPN the port range should be constricted to `5900-5999`:
{{{#!highlight bash numbers=disable
OVS_HOST=$(hostname -f) && openvscode-server --host $OVS_HOST --port 5900-5999 --accept-server-license-terms --telemetry-level off |sed "s/localhost/$OVS_HOST/g"
}}}
The output of `openvscode-server` will tell you the URL to access the web-based Code editor:
{{{
Server bound to : (IPv4)
Extension host agent listening on
Web UI available at http://:/?tkn=01234567-89ab-cdef-0123-456789abcdef
}}}
Connecting your web browser to the URL `http://:/?tkn=01234567-89ab-cdef-0123-456789abcdef` shown at the end of the output from `openvscode-server` is possible from anywhere within the ETH network or while connected to it by VPN.
== VSCode data ==
''OpenVSCode Server'' stores it's data in `$HOME/.openvscode-server`, separated from the'' VSCode desktop application'' which stores it's data in `$HOME/.vscode`. Both store their extensions in the subdirectory `extensions`.
The example token ''01234567-89ab-cdef-0123-456789abcdef'' is saved in `$HOME/.openvscode-server/data/token` and will be re-used at future starts of `openvscode-server`.