This are my notes from Winter 2022 before the Richardson Lab ELOG was setup. TODO: Need to write a proper "HowTo" ELOG for jupyterhub + web server setup based on this.
JupyterHub on Chimay
[Early Jan 2022]
Cannot install using TLJH since it's only available for Ubuntu.
So instead, installing step-by-step using guide available here - https://github.com/jupyterhub/jupyterhub-the-hard-way/blob/master/docs/installation-guide-hard.md
Nginx webserver is used for HTTPS reverse-proxy for the jupyterhub.
I installed nginx via apt-get , config at - /etc/nginx/sites-available/default
I used cerbot to generate SSL certificates.
To start the webserver
sudo systemctl start nginx.service
Goal: Setup JupyterHub as a systemd service and make it available over HTTPS.
To start the services needed for the hub
sudo systemctl start jupyterhub.service
Note: Reload the daemon if you edited a service before you restart it, otherwise it will complain.
sudo systemctl daemon-reload
Logs
[Jan 26, 2020]
Ended up using the JupyterHub guide available here - https://github.com/jupyterhub/jupyterhub-the-hard-way/blob/master/docs/installation-guide-hard.md and SudoSpawner guide available here - https://jupyterhub.readthedocs.io/en/stable/reference/config-sudo.html
I was struggling with this quite a bit but eventually I figured out that I was running into trouble because I was trying to run jupyterhub command as a password-less sudo user as I thought that's what sudospawner needed. That seems not to be the case.
- The systemd service
jupyter.service has to be run as User=root and the ExecStart=/opt/jupyterhub/bin/jupyterhub -f /opt/jupyterhub/etc/jupyterhub/jupyterhub_config.py and ensure that /usr/sbin is in PATH. (This necessary as we need to spawn single-user jupyter servers for our users on-demand, so the User that runs the ExecStart needs to have permissions to run single-user server init commands.)
- In
jupyterhub_config.py , the spawner is configed as sudospawner - c.JupyterHub.spawner_class=sudospawner.SudoSpawner . I installed sudospawner in our jupytherhub environment via pip .
- In
jupyterhub_config.py , the authenticator used is PAM which allows linux users on chimay to login with there username and password and opens their shell in their home directories.
[Jan 27, 2020]
[10:30]
Attempted MATLAB integration following this guide - https://github.com/mathworks/jupyter-matlab-proxy
It annoyingly broke nodejs which broke jupyterhub as the proxy failed without it. I have now restored nodejs and the jupyterhub is back up.
[12:00]
User controls now has admin access on the hub. To add more admins - edit /opt/jupyterhub/etc/jupyterhub/jupyterhub_config.py by adding the username in c.Authenticator.admin_users
[15:15]
Argh! User's cannot access user-created conda environments in notebooks besides the default one i.e. the one for which kernelspec is available in /usr/local/share/jupyter/kernels . Non-sudo users also can't access this path to put a kernelspec in it! Sudo users who can do this end up having their custom environments visible to everyone. Argh!
!FIX NEEDED!
[15:54]
After reading this (https://github.com/Anaconda-Platform/nb_conda_kernels/issues/185) I am putting
"CondaKernelSpecManager": {
"kernelspec_path": "--user"
}
in /opt/miniconda3/etc/jupyter/jupyter_config.json
WebServer down, fix yet to be tested.
[16:04]
Fix does not seem to be working.
[Tue Feb 1 17:02:46 2022]
ISSUE: User unable to use their custom conda environments in notebooks
STATUS: Fixed, refer to elog 'ligo-ds' no. 1
All future logs will be on the ELOG. |