2030
Comment: Clarify possibility to connect to the openvscode-server URL from within the ETH network
|
← Revision 5 as of 2022-06-21 08:42:05 ⇥
2381
|
Deletions are marked like this. | Additions are marked like this. |
Line 14: | Line 14: |
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" }}} |
Run Visual Studio Code as a service on a remote host
Two SEPP software packages of Visual Studio Code are available:
Code, started from the command line with code, the desktop application
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 interactive shell in a Slurm job, issue the following command:
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:
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 <public ip of OVS_HOST>:<random port> (IPv4) Extension host agent listening on <random port> Web UI available at http://<OVS_HOST>:<random port>/?tkn=01234567-89ab-cdef-0123-456789abcdef
Connecting your web browser to the URL http://<OVS_HOST>:<random port>/?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.