man-group / notebooker

Productionise & schedule your Jupyter Notebooks as easily as you wrote them.
GNU Affero General Public License v3.0
856 stars 81 forks source link

Enable me to explore on Jupyterhub behind reverse proxy #119

Open MarcSkovMadsen opened 1 year ago

MarcSkovMadsen commented 1 year ago

I want to try out notebooker. I don't have access to python on my laptop for enterprise reasons. I can work inside jupyterhub.

I run

mkdir -p /home/jovyan/shared/.analytics-workspace/.mongodb
conda install -y -c anaconda mongodb=6.0.2
pip install notebooker;python -m ipykernel install --user --name=notebooker_kernel
mongod --dbpath /home/jovyan/shared/.analytics-workspace/.mongodb
notebooker-cli --mongo-host localhost:27017 start-webapp --port 11828

Both mongodb and notebooker start up successfully.

The jupyter-server-proxy is installed. So I would expect to be able to try out notebooker ui at

https://domain/namespace/user/user-name/proxy/11828

image

or

https://domain/namespace/user/user-name/proxy/11828/

image

But as you can see I cannot.

The issue is that all assets are expected to be found at the root /.

image

But they should not be. Either they should be found at some nested path that I should be able to specify via a --prefix flag. Or they should be referenced as ./static I believe.

Additional Context

I often run Panel succesfully from the terminal in my jupyter hub. Panel enables me to set a --prefix that is used to point to the static assets.

image

Its the same for other data app frameworks. For example streamlit.

MarcSkovMadsen commented 1 year ago

Tried out the branch on this one.

conda install -c anaconda mongodb
mkdir /home/jovyan/shared/.analytics-workspace/.mongodb
# pip install notebooker
pip install git+https://github.com/man-group/notebooker.git@support-url-prefix
mongod --dbpath /home/jovyan/shared/.analytics-workspace/.mongodb

python -m ipykernel install --user --name=notebooker_kernel
notebooker-cli --mongo-host localhost:27017 start-webapp --port 11828

But it does not work. And its actually clear. The notebook server will get a request at / when I request from /....subpath.

127.0.0.1 - - [2022-10-12 15:45:46] "GET / HTTP/1.1" 404 331 0.001531

The issue to be solved is the link to the assets. It needs to be available at ./static not /static.

(I forgot. I don't use --prefix for Panel, Streamlit etc. when running on jupyterhub. It just works).

I hope though that the url-prefix will make a difference when deployed to kubernetes.