JupyterHub + SingleUserServer in API only mode

Hi,

My goal is to run both JupyterHub and the SingleUser servers in API only mode. I have not been able to do so for either and any guidance would be greatly appreciated. Does anyone have any tips on what I could do to put JupyterHub and SingleUser server in API only mode?

Here is what I have tried so far
For JupyterHub
I have read through the following:

This is what my values.yml looks like:

singleuser:
    storage:
        ...
    cmd:
        - jupyterhub-singleuser
        - "--ip=0.0.0.0"
        - '--ServerApp.allow_origin="http://localhost:3000"'
        - "--ServerApp.allow_credentials=True"
        - "--NotebookApp.allow_origin=http://localhost:3000"
        - "--NotebookApp.allow_credentials=True"

    extraEnv:
        JUPYTERHUB_SINGLEUSER_APP: "jupyter_server.serverapp.ServerApp"

    image:
        name: ...
        tag: ...

imagePullSecret:
    create: true
    registry: ...
    username: ...
    password: ...
    email:

hub:
    config:
        JupyterHub:
            hub_routespec: "/hub/api"

However, after applying this using helm upgrade, when I navigate to my JupyterHub, I still get the login screen presented:

SingleUser Server API Only mode
To make the Single User Server API only, I tried to modify the following Docker image to make it so that it ran jupyter server instead of jupyter lab.

Since that did not work, I tried to edit the values.yml to run jupyter server instead:

    cmd:
        - "jupyter"
        - "server"
        - "--ip=0.0.0.0"
        - '--ServerApp.allow_origin="http://localhost:3000"'
        - "--ServerApp.allow_credentials=True"
        - "--NotebookApp.allow_origin=http://localhost:3000"
        - "--NotebookApp.allow_credentials=True"

Although this successfully runs the server, the CORS options I set are seeminly ignored when trying to access the Jupyter Server API, likely because I am connecting through the hub URL and jupyter server is not proxying correctly.

I looked through jupyterhub-singleuser and realized that it always seems to create a UI: https://github.com/jupyterhub/jupyterhub/blob/7bf4efd3f814d24481bc755462723740c3f8c900/jupyterhub/singleuser/mixins.py#L950

Is there a way to put jupyterhub-singleuser in API only mode as well?

I know this was long so I really appreciate all your time if you made it this far :slight_smile:

I’m afraid I don’t quite understand. What do you mean by “API only” mode?

Hi manics,

Thanks so much again for the help.

What I meant by API only mode is I am hoping to disable the standard UI when running jupyterhub-singleuser. Ideally it would be the same as running jupyter server locally.

I noticed when I run juptyerhub-singleuser a UI is always created I assume from this part of the code:

I think if you uninstall JupyterLab and any other front-ends, leaving just jupyter-server, this may work? Otherwise there might be a way to disable JupyterLab in your configuration since JupyterLab is a jupyter-server extension, but I’m not sure.