Vscode code-server


We’re trying to get the latest vs code working as an app (https://github.com/cdr/code-server) and hitting a bit of a snag. We have more or less the same setup as at https://github.com/OSC/bc_osc_codeserver but the code-server login redirects and gets a broken URL with duplicated server/port in it. Once the interactive app starts and we click launch we get a

404 Not Found

on the URL:


If I then modify that URL to be


VS Code works fine after that. Is there a way to get OnDemand to do the right thing here or is this something that needs to be addressed in code-server upstream?

Here’s the output from code-server, showing the redirect that takes place at login:

+ /home/jbh41678/code-server/code-server --log trace --disable-telemetry --host --port 21505
debug spawned inner process 97580
debug parsed command line e[38;2;140;140;140m{"args":{"_":[],"log":"trace","disable-telemetry":true,"host":"","port":21505}}e[0m
debug wrapper 97522 received message from 97580 e[38;2;140;140;140m{"message":{"type":"handshake"}}e[0m
debug inner process 97580 received message from 97522 e[38;2;140;140;140m{"message":{"type":"handshake"}}e[0m
info  code-server 3.2.0 fd36a99a4c78669970ebc4eb05768293b657716f
info  HTTP server listening on
info    - Using custom password for authentication
info    - Not serving HTTPS
info  Automatic updates are enabled
Discovered VS Code Notebook server listening on port 21505!
TIMING - Wait ended at: Thu Apr 30 19:22:56 EDT 2020
Generating connection YAML file...
trace heartbeat
debug redirecting e[38;2;140;140;140m{"secure":false,"from":"/login","to":"./"}e[0m
debug Request error e[38;2;140;140;140m{"url":"/rnode/cpu-305.cm.storage/21505/","code":404}e[0m
debug forking vs code...
debug got message from vs code e[38;2;140;140;140m{"message":{"type":"ready"}}e[0m
debug setting up vs code...



We are working through the same problem! Will keep you posted when we find a solution.

@griznog I’ve been working on this and have a working branch available for testing. We have a few bugs to iron out but please try out what we have so far and let us know what you think! https://github.com/OSC/bc_osc_codeserver/pull/2

This bug happens because of the way reverse proxying is implemented currently in OOD, but we have a fix available in the pull request above.

Thanks for efforts on this, we’ve continued poking at it with mixed results. The latest release of code-server (3.3.1) hasn’t worked well at all in or out of ondemand. Will update if we suddenly find ourselves in possession of a stable code-server solution :slight_smile:

What’s your current issue? We used @mario solution with 3.3.1. We did have to remove a deprecated flag --disable-updates from the code-server startup.

For reference we have code-server running in a CentOS 7 singularity container.

@maflister Awesome to hear! Would you be willing to share your solution that uses a Singularity container?

I updated the PR to support code-server version 3.3.1 and removed the --disable-updates flag

We use the following Singularity recipe:

Bootstrap: docker
From: centos:7

Maintainer Matthew Flister

This container includes code server running VS Code.

    export SHELL PATH
    source scl_source enable rh-git218

    # Install necessary packages
    yum update -y && yum install -y wget python3 gcc g++
    yum install -y centos-release-scl
    yum install -y rh-git218
    yum clean all

    # install code-server
    wget https://github.com/cdr/code-server/releases/download/v3.3.1/code-server-3.3.1-linux-amd64.tar.gz
    tar -xvf code-server-3.3.1-linux-amd64.tar.gz
    cp -R code-server-3.3.1-linux-amd64 /opt/code-server
    rm -rf code-server-3.3.1-linux-amd64

Then we specify in script.sh.erb:
CODE_SERVER="singularity exec code-server-3.3.1_latest.sif code-server"


I’m still having the same issue here, i.e. after logging in the get the URL:


And, I need to manually remove the last “rnode/HOST/PORT”. Is there a fix for this?



I have a working branch for Code Server that gets around this issue:

This issue stems from some assumptions that the OOD reverse proxy makes, there’s an open issue here: https://github.com/OSC/ondemand/issues/493