How to open a notebook on startup?

Hello,

I used this config to have a notebook open on startup a new session of JupyterHub on K8s on GCP.

extraConfig:
jupyterlab: |
c.Spawner.notebook_dir = ‘/home/jovyan/workspace’
c.KubeSpawner.default_url = ‘/lab/tree/READ_ME_FIRST.ipynb’

Or
c.KubeSpawner.default_url = ‘/tree/READ_ME_FIRST.ipynb’

Or some other variants of the path.

It used to work with helm 0.9.0/app 1.1.0.
I am now trying out helm 2.0.0/app 3.0.0 and none of these no longer works.

Does someone know how to setup the path so that the notebook file will open by default on a new session please?

Can you share your full configuration? Did you update your singleuser image to take account of the major JupyterHub release?

Hello,

Thank you very much for helping. Here is my config.yaml file.

proxy:
secretToken: “ccd0739e3b4a793243457810eade76802adc055201de5ab74e2cca6528bf92”
https:
enabled: true
hosts:
- s22.nm.dev
type: secret
secret:
name: s2-tls
service:
loadBalancerIP: 35.202.190.25
singleuser:
image:
name: nmimages/s2-jupyter-image
tag: latest
pullPolicy: “Always”
defaultUrl: “/lab”
storage:
capacity: 0.5Gi
cpu:
limit: 2
guarantee: 0.5
memory:
limit: 1Gi
guarantee: 0.5Gi
scheduling:
userScheduler:
enabled: true
podPriority:
enabled: true
userPlaceholder:
enabled: true
replicas: 4
userPods:
nodeAffinity:
matchNodePurpose: require
cull:
enabled: true
timeout: 3600
every: 300
hub:
config:
KubeSpawner:
singleuser_privileged: true
extraConfig:
myConfig.py: |
# remove Python kernel
c.Spawner.args = [“–KernelSpecManager.ensure_native_kernel=False”]
c.KernelSpecManager.whitelist = {‘kotlin’}
extraConfig:
jupyterlab: |
c.JupyterHub.authenticator_class = ‘tmpauthenticator.TmpAuthenticator’
c.Spawner.notebook_dir = ‘/home/jovyan/workspace’
c.KubeSpawner.default_url = ‘/lab/tree/READ_ME_FIRST.ipynb’
# remove Python kernel, not working
c.Spawner.args = [“–KernelSpecManager.ensure_native_kernel=False”]
c.KernelSpecManager.ensure_native_kernel = False
c.KernelSpecManager.whitelist = {‘kotlin’}

I just tried helm chart version [1.2.0], app version 1.5.0. And it works. The file opens on startup.

So, I believe that there is a bug in helm chart version [2.0.0], app version 3.0.0 to prevent the file from opening on startup.

Did you update your singleuser image to take account of the major JupyterHub release? If you didn’t this is likely to be a problem since there was a major release of JupyterHub (and therefore the singleuser package is updated).

If it still doesn’t work please could you share your image with us (i.e. your Dockerfile), or if that’s not possible please try and reproduce the issue with a minimal Dockerfile.

Manics,

Thank you very much for your reply.
No, I did not update the singleuser image that I built back in 2020 June.

I think you are right that it may be the problem.

I have updated the singleuser image and am using helm chart version [1.2.0], app version 1.5.0.
I am able to open the notebook on startup.

I don’t (yet) have the latest singleuser imange and using app version 3.0.0. I will try and let you know.

Thanks!

I can confirm that it is the singleuser image problem. It works with app version 3.0.0. after using the latest singleuser image.

Thank you for helping.

1 Like