jupyterhub / zero-to-jupyterhub-k8s

Helm Chart & Documentation for deploying JupyterHub on Kubernetes
https://zero-to-jupyterhub.readthedocs.io
Other
1.56k stars 798 forks source link

defaultUrl not consistently bringing user to file created in postStart script #1972

Closed naterush closed 3 years ago

naterush commented 3 years ago

Bug description

I have the following YAML in my config file:

singleuser:
  defaultUrl: "/lab/tree/Introduction.ipynb"
  image:
    name: <name>
    tag: <tag>
  lifecycleHooks:
    postStart:
      exec:
        command:
          - "sh"
          - "-c"
          - >
            rm -rf /home/jovyan/lost+found;
            if [ -z `ls /home/jovyan/*` ]; then cp -r /tutorial/. /home/jovyan/; fi

Essentially, it copies over files from a tutorial folder (that I create in my docker image), one of them being Introduction.ipynb. When users then show up and log in for the first time, I want them to get taken to this file (rather than a launcher).

Expected behaviour

Users would get taken to the Introduction.ipynb file upon first log in.

Actual behaviour

When creating an account, the Introduction.ipynb is copied successfully to the files, and appears on the RHS in the file navigator.

Sometimes (happening currently), users get taken to the URL https://staging.trymito.io/user/<USERNAME>/lab/workspaces/auto-b/tree/Introduction.ipynb, but the file does not load. It just stays at the JupyterHub launcher. When the page is refreshed, the Introduction.ipynb file then loads.

It seems related to the workspaces part of the URL - any idea why that is there? When it works, the workspaces part of the URL disappears...

How to reproduce

  1. Deploy a base instance of Kuberenetes JupyterHub.
  2. Create a docker image like the one below.
  3. Add a script that copies these files over to the home page in the postStart lifecycle method. Feel free to copy the code above and below :0
  4. Set the defaultUrl to one of these files.
  5. Create a new account and log in on that JupyterHub for the first time. This file will not load.

Your personal set up

Running on AWS ECS. Very standard EC2 managed + autoscaled AWS EC2 instances!

The docker image itself:

FROM jupyter/base-notebook:hub-1.2.1

# Installs a pip package, and rebuilds Jupyter Lab
RUN pip install mitosheet==$version
RUN python -m jupyter labextension install @jupyter-widgets/jupyterlab-manager@2

# Add some files for the tutorial
COPY Introduction.ipynb /tutorial/Introduction.ipynb

We're also using Google Auth. It currently allows anyone with a Google Account anywhere to come sign up on our kuberenetes instance.

welcome[bot] commented 3 years ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

support[bot] commented 3 years ago

Hi there @naterush :wave:!

I closed this issue because it was labelled as a support question.

Please help us organize discussion by posting this on the http://discourse.jupyter.org/ forum.

Our goal is to sustain a positive experience for both users and developers. We use GitHub issues for specific discussions related to changing a repository's content, and let the forum be where we can more generally help and inspire each other.

Thanks you for being an active member of our community! :heart:

consideRatio commented 3 years ago

This is probably a probelm you experience caused by using a k8s postStart hook + JupyterLab, rather than an issue of this Helm chart.

Quick ideas on what to look out for:

Good luck!

naterush commented 3 years ago

Thanks for the response! I actually managed to fix this just by clearing my cookies in that browser (lol), and it just works now. Not sure why this is the case though...

Thanks again for the quick hit back - really apprecaite all the really freakin' great work you all do! Happy holidays :)