How to configure Jupyterhub to run code-server?

Do you have an example hub configuration to run single-user code-server instance? The only solution I found is not clear.

Is there any way to configure to select to launch Jupyterlab and/or code-server and/or R-Studio after the Jupyterhub login page?

As mentioned in nils-braun’s codehub project, using this, I can;

  • Let users choose between different “profiles” (e.g. resources, predefined images)
  • Customize user
  • Using a different authenticator, e.g. OAuth2 (e.g. via GitHub), LDAP, Active Directory.
  • Use HTTPS for encrypting the communication with the hub.
  • Automatically remove idle servers.

I really appreciate your help.

1 Like

code-server should just work, for instance this repo let’s you run it on mybinder:

You can choose which interface users are directed to by setting Spawner.default_url, e.g. c.Spawner.default_url="/lab" will go to JupyterLab.

1 Like

You may consider using jupyter-server-proxy
I compiled and wrote plugins to run several apps within jupyterlab. Not all work well, but code-server does, though you may need to adapt it to your environment:

1 Like

I was surprised but it was simple as others suggested:

# To install Server Proxy Extension for Lab
sudo /usr/local/anaconda3/bin/python3 -m pip install jupyter-server-proxy

# To Install VSCode code-server for proxying
sudo /usr/local/anaconda3/bin/python3 -m pip install jupyter-vscode-proxy

# Restart the hub for changes to apply
sudo systemctl restart jupyterhub.service

On login I see the VSCode icon next to iPython notebook :face_with_monocle:… Concerns for myself include sudo for pip and also I am not running Hub at container, so the ports are exposed for other users I think… for test & dev this worked nicely, glad to run VSCode on the same remote host as Python kernel :unicorn:

Yes, this is one of the limitations of jupyter-server-proxy. This is why it’s recommended for use only where users are isolated from each other, such as in a container.

Any one having a binder setup with versions pinned for code-server, python extension, jupyter extension where “notebooks” just works. I’ve been trying here hvplot_interactive/binder at main · MarcSkovMadsen/hvplot_interactive (github.com). But cannot get Notebook cells working. Cells are just not running.

One issue seems to be that code launches jupyter server from the preinstalled python 3.6 instead of the conda notebook environment. If I open the Interactive Window it then installs pip and ipykernel in the python 3.6 environment. Then I can change Interactive Window to conda notebook environment and work in there. Sometimes I can then even get cells in notebook to execute. But I’ve not found the exact steps yet to get it working. Seems random.

Hello
I am trying to do exactly that : using JupyterHub as a … Hub, allowing users to start either JupyterLab or Code-server images on a microk8s server.
I took the idea from nils-braun codehub too.

I am struggling on the configuration of the proxy :

  • Code-server image needs the “chp: extraCommandLineFlags: - “–no-include-prefix”” option (or i get a 404 because Code-server doesn’t handle base-url )
  • JupyterLab image needs this option to be disabled, or I get a 404

For the selection of the profile (container image), i use the “profileList” option in the value.yaml used by the Helm chart to make the deployment (see code extract below).

Do you have succeeded on this, or are you using another method ?

singleuser:
  # Defines the default image
  image:
    name: "jupyter/minimal-notebook"
    tag: "hub-2.3.0"
  storage:
    capacity: 20Mi

  profileList:
    - display_name: "minimalnotebook"
      description: "(jupyter/minimal-notebook) Jupyter"
      default: true

    - display_name: "Code-server"
      description: "(codercom/code-server:4.4.0) Code-server"
      kubespawner_override:
        image: codercom/code-server:4.4.0