# Vscode code-server

**URL:** <https://discourse.openondemand.org/t/vscode-code-server/882>\
**Category:** Get Help\
**Created:** [April 30, 2020, 11:34pm UTC](https://discourse.openondemand.org/t/vscode-code-server/882 "2020-04-30T23:34:29Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![griznog](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/griznog/32/39_2.png) [@griznog](https://discourse.openondemand.org/u/griznog)\
**Post date:** [April 30, 2020, 11:34pm UTC](https://discourse.openondemand.org/t/vscode-code-server/882/1 "2020-04-30T23:34:29Z")

</div>

Hi,

We’re trying to get the latest vs code working as an app ([https://github.com/cdr/code-server](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](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:

`https://ushpc-ondemand.gsk.com/rnode/cpu-305.cm.storage/21505/rnode/cpu-305.cm.storage/21505/`

If I then modify that URL to be

`https://ushpc-ondemand.gsk.com/rnode/cpu-305.cm.storage/21505/`

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:

```auto
+ /home/jbh41678/code-server/code-server --log trace --disable-telemetry --host 0.0.0.0 --port 21505
debug spawned inner process 97580
debug parsed command line e[38;2;140;140;140m{"args":{"_":[],"log":"trace","disable-telemetry":true,"host":"0.0.0.0","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 http://0.0.0.0:21505
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...

```

Best,

griznog

---

<div class="post-metadata">

**Author:** ![efranz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/efranz/32/27_2.png) [@efranz](https://discourse.openondemand.org/u/efranz)\
**Post date:** [May 1, 2020, 1:43am UTC](https://discourse.openondemand.org/t/vscode-code-server/882/2 "2020-05-01T01:43:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mario](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mario/32/662_2.png) [@mario](https://discourse.openondemand.org/u/mario)\
**Post date:** [May 13, 2020, 12:35am UTC](https://discourse.openondemand.org/t/vscode-code-server/882/3 "2020-05-13T00:35:25Z")

</div>

@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](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.

---

<div class="post-metadata">

**Author:** ![griznog](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/griznog/32/39_2.png) [@griznog](https://discourse.openondemand.org/u/griznog)\
**Post date:** [May 25, 2020, 5:50pm UTC](https://discourse.openondemand.org/t/vscode-code-server/882/4 "2020-05-25T17:50:21Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![maflister](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/maflister/32/139_2.png) [@maflister](https://discourse.openondemand.org/u/maflister)\
**Post date:** [May 26, 2020, 2:00pm UTC](https://discourse.openondemand.org/t/vscode-code-server/882/5 "2020-05-26T14:00:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mario](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mario/32/662_2.png) [@mario](https://discourse.openondemand.org/u/mario)\
**Post date:** [May 26, 2020, 3:27pm UTC](https://discourse.openondemand.org/t/vscode-code-server/882/6 "2020-05-26T15:27:17Z")

</div>

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

I updated the [PR](https://github.com/OSC/bc_osc_codeserver/pull/2/commits/1e9bece281d967574f9a5ab5f6abc0428b71e465) to support code-server version `3.3.1` and removed the `--disable-updates` flag

---

<div class="post-metadata">

**Author:** ![maflister](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/maflister/32/139_2.png) [@maflister](https://discourse.openondemand.org/u/maflister)\
**Post date:** [May 26, 2020, 3:42pm UTC](https://discourse.openondemand.org/t/vscode-code-server/882/7 "2020-05-26T15:42:06Z")

</div>

We use the following Singularity recipe:

```
Bootstrap: docker
From: centos:7

%labels
Maintainer Matthew Flister

%help
This container includes code server running VS Code.

%environment
    SHELL=/bin/bash
    PATH=$PATH:/opt/code-server
    export SHELL PATH
    source scl_source enable rh-git218

%post
    # 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"`

---

<div class="post-metadata">

**Author:** ![edwardsp](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/edwardsp/32/511_2.png) [@edwardsp](https://discourse.openondemand.org/u/edwardsp)\
**Post date:** [July 20, 2020, 8:29am UTC](https://discourse.openondemand.org/t/vscode-code-server/882/8 "2020-07-20T08:29:08Z")

</div>

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

```
DOMAIN/rnode/HOST/PORT/rnode/HOST/PORT

```

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

Thanks,  
Paul

---

<div class="post-metadata">

**Author:** ![mario](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mario/32/662_2.png) [@mario](https://discourse.openondemand.org/u/mario)\
**Post date:** [July 20, 2020, 1:47pm UTC](https://discourse.openondemand.org/t/vscode-code-server/882/9 "2020-07-20T13:47:57Z")

</div>

@edwardsp

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

> <https://github.com/OSC/bc_osc_codeserver/pull/2>

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](https://github.com/OSC/ondemand/issues/493)

---

<div class="post-metadata">

**Author:** ![ryao-mdanderson](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/ryao-mdanderson/32/699_2.png) [@ryao-mdanderson](https://discourse.openondemand.org/u/ryao-mdanderson)\
**Post date:** [April 23, 2021, 10:15pm UTC](https://discourse.openondemand.org/t/vscode-code-server/882/10 "2021-04-23T22:15:31Z")

</div>

Hello, Thank you for posting your singularity recipe. I am struggling to get code-server to run using singularity. May I know what is the content for file scl\_source?

I am able to do this far:  
with the following steps proceed ok :

- I save the recipe file in my directory as vscode.recipt.
- As a root user on a linux server, use commands  
module load singularity/3.7.0  
singularity build vscode.sif vscode.recipe  
to build a vscode.sif;

However, I am not able to run vscode.sif? Missing scl\_source is the first complain. May you please kindly provide me more details of building and running this singularity code-server container. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![maflister](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/maflister/32/139_2.png) [@maflister](https://discourse.openondemand.org/u/maflister)\
**Post date:** [April 26, 2021, 1:38pm UTC](https://discourse.openondemand.org/t/vscode-code-server/882/11 "2021-04-26T13:38:40Z")

</div>

Hi. The purpose of SCL in that container is to support a newer version of git. However, if you don’t need git, you can remove those portions. Also, I should mention that we no longer use this container in production. We originally created it because our host OS (CentOS 6) did not support VSCode. However, we now use CentOS 7 and do not need the container. I’d suggest to not use container if your host OS is CentOS 7. If you will use the container, I’d suggest to remove these lines:

```auto
    source scl_source enable rh-git218
    yum install -y centos-release-scl
    yum install -y rh-git218

```

---

<div class="post-metadata">

**Author:** ![ryao-mdanderson](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/ryao-mdanderson/32/699_2.png) [@ryao-mdanderson](https://discourse.openondemand.org/u/ryao-mdanderson)\
**Post date:** [April 26, 2021, 2:55pm UTC](https://discourse.openondemand.org/t/vscode-code-server/882/12 "2021-04-26T14:55:23Z")

</div>

Hello!

Thank you very much for your reply and providing suggestion.

Best,

Rong Yao

---

<div class="post-metadata">

**Author:** ![groucho64738](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/groucho64738/32/721_2.png) [@groucho64738](https://discourse.openondemand.org/u/groucho64738)\
**Post date:** [September 1, 2021, 4:25pm UTC](https://discourse.openondemand.org/t/vscode-code-server/882/13 "2021-09-01T16:25:16Z")

</div>

@mario Hi. I’m just looking at doing this now and have the same issue as originally reported with the 404 error. Are your changes merged in the latest release of bc\_osc\_codeserver? That’s the one I’m using and still have the issue.

I’m using OOD 2.0.13. It does look like the code-server is launching ok, and I can connect directly to it on the node that it’s running on, but the URL is malformed like was described here.

---

<div class="post-metadata">

**Author:** ![groucho64738](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/groucho64738/32/721_2.png) [@groucho64738](https://discourse.openondemand.org/u/groucho64738)\
**Post date:** [September 7, 2021, 11:57am UTC](https://discourse.openondemand.org/t/vscode-code-server/882/14 "2021-09-07T11:57:57Z")

</div>

@mario Hi again. I wanted to post an update. It seems like the problems I’m seeing are specific (maybe) to 3.11.1. I tried code-server version 3.10.2 and do not have an issue. Seems like the code-server developers may have done some reverse proxy work that might be conflicting with OOD.

---

<div class="post-metadata">

**Author:** ![westburg.2](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@westburg.2](https://discourse.openondemand.org/u/westburg.2)\
**Post date:** [May 26, 2022, 3:42pm UTC](https://discourse.openondemand.org/t/vscode-code-server/882/15 "2022-05-26T15:42:45Z")

</div>


