2021-04-15 18:44:19 +00:00
## JupyterHub programming environment with student Notebooks
2021-08-01 16:40:58 +00:00
#### Secondary schools may want to consider JupyterHub to integrate coding with dynamic interactive graphing — A New Way to Think About Programming — allowing students to integrate science experiment results and program output within their own blog-like "Jupyter Notebooks."
2021-04-15 18:14:14 +00:00
2021-07-31 17:38:17 +00:00
* Jupyter Notebooks are widely used in the scientific community:
2021-08-24 20:28:28 +00:00
* [Institutional FAQ ](https://jupyterhub.readthedocs.io/en/stable/getting-started/institutional-faq.html )
2021-08-07 18:40:04 +00:00
* [Getting Started ](https://jupyterhub.readthedocs.io/en/stable/getting-started/ )
2021-12-02 19:45:59 +00:00
* [JupyterLab changelog ](https://github.com/jupyterlab/jupyterlab/releases )
* [JupyterHub changelog ](https://jupyterhub.readthedocs.io/en/stable/changelog.html#changelog )
2021-08-01 20:31:48 +00:00
* Students create their own accounts on first use — e.g. at http://box.lan/jupyterhub — just as if they're logging in regularly (unfortunately the login screen doesn't make that clear, but the teacher _does not_ need to be involved!)
2021-08-01 15:31:53 +00:00
* A student can then sign in with their username and password, to gain access to their files (Jupyter Notebooks).
2023-02-08 17:17:19 +00:00
* The teacher should set and protect JupyterHub's overall `Admin` password, just in case. As with student accounts, the login screen unfortunately doesn't make that clear — so just log in with username `Admin` — using any password that you want to become permanent.
2021-09-03 23:13:48 +00:00
* Individual student folders are created in `/var/lib/private/` on the Internet-in-a-Box (IIAB) server:
2021-08-01 15:31:53 +00:00
* A student will only be able to see their own work — they do not have privileges outside of their own folder.
* Students may upload Jupyter Notebooks to the IIAB server, and download the current state of their work via a normal browser.
2021-08-07 17:56:21 +00:00
2021-08-07 18:10:20 +00:00
### Settings
2021-09-03 23:30:45 +00:00
Linux administrators may want to review `/opt/iiab/jupyterhub/etc/jupyterhub/jupyterhub_config.py` which originates from:
2021-08-07 18:43:18 +00:00
2021-11-22 17:28:21 +00:00
https://github.com/iiab/iiab/blob/master/roles/jupyterhub/templates/jupyterhub_config.py.j2
2021-08-07 18:10:20 +00:00
2021-09-03 23:30:45 +00:00
In some rare circumstances, it may be necessary to restart JupyterHub's systemd service:
```
sudo systemctl restart jupyterhub
```
2023-02-08 17:17:19 +00:00
FYI `/opt/iiab/jupyterhub` is a Python 3 virtual environment, that can be activated (and deactivated) with the usual:
2021-08-07 18:10:20 +00:00
```
source /opt/iiab/jupyterhub/bin/activate
2023-02-08 17:17:19 +00:00
(jupyterhub) root@box:~# deactivate
2021-08-07 18:10:20 +00:00
```
2021-09-01 16:31:56 +00:00
Passwords are hashed using 4096 rounds of the latest Blowfish (bcrypt's $2b$ algorithm) and stored in:
```
2021-11-22 17:32:35 +00:00
/opt/iiab/jupyterhub/etc/passwords.dbm # Or passwords.dbm.db in the past.
2021-09-01 16:31:56 +00:00
```
2021-09-03 23:30:45 +00:00
### Users can change their own password
2021-08-13 21:16:07 +00:00
2021-09-03 23:30:45 +00:00
Users can change their password by logging in, and then visiting URL: http://box.lan/jupyterhub/auth/change-password
2021-08-13 21:16:07 +00:00
2021-09-03 23:13:48 +00:00
NOTE: This is the only way to change the password for user 'Admin', because Control Panel > Admin (below) does not permit deletion of this account.
2021-08-30 04:11:14 +00:00
2021-09-03 23:30:45 +00:00
### Control Panel > Admin page, to manage other accounts
2021-08-30 04:11:14 +00:00
2021-09-04 02:12:50 +00:00
The `Admin` user (and any users given `Admin` privilege) can reset user passwords by deleting the user from JupyterHub's **Admin** page (below). This logs the user out, but does not remove any of their data or home directories. The user can then set a new password in the usual way — simply by logging in. Example:
2021-08-30 04:11:14 +00:00
2023-02-08 17:17:19 +00:00
1. As a user with `Admin` privilege, click **File > Hub Control Panel** in your JupyterHub:
2021-08-30 04:28:16 +00:00
2023-02-08 17:17:19 +00:00
![image ](https://user-images.githubusercontent.com/2458907/217602766-ab6a9d3c-9f92-496e-a0e8-6c18a084e960.png )
2021-08-30 04:15:42 +00:00
2023-02-08 17:17:19 +00:00
2. At the top of the Control Panel, click **Admin** :
2021-08-30 04:11:14 +00:00
2023-02-08 17:17:19 +00:00
![image ](https://user-images.githubusercontent.com/2458907/217602473-f4f9fd40-b4c1-45e1-88c5-54c6d4b604ff.png )
2021-08-30 04:11:14 +00:00
2021-09-01 05:13:55 +00:00
This opens up the JupyterHub Admin page, where you can add / delete users, start / stop peoples’ servers and see who is online.
2021-08-30 04:15:42 +00:00
2021-09-03 23:30:45 +00:00
3. Delete the user whose password needs resetting. Remember this does not delete their data or home directory:
2021-09-01 05:13:55 +00:00
![Delete user button for each user ](delete-user.png )
2021-09-04 02:12:50 +00:00
If there is a confirmation dialog, confirm the deletion. This will also log the user out, if they were currently running.
2021-08-30 04:11:14 +00:00
2021-09-03 23:13:48 +00:00
4. Re-create the user whose password needs resetting, on this same screen.
2021-08-30 04:11:14 +00:00
2021-09-01 05:13:55 +00:00
5. Ask the user to log in, but with a new password of their choosing. This will be their password going forward.
2021-09-03 23:13:48 +00:00
_WARNING: If on login users see "500 : Internal Server Error", you may need to remove ALL files of the form_ `/run/jupyter-johndoe-singleuser`
2023-02-09 00:26:41 +00:00
### Logging
To see JupyterHub's (typically very long!) log, run:
```
journalctl -u jupyterhub.service
```
Sometimes other logs might also be available, e.g.:
```
journalctl -u jupyter-admin-singleuser.service
```
2021-09-01 05:13:55 +00:00
### PAWS/Jupyter Notebooks for Python Beginners
2021-08-30 04:11:14 +00:00
2021-09-01 05:13:55 +00:00
While PAWS is a little bit off topic, if you have an interest in Wikipedia, please do see this 23m 42s video ["Intro to PAWS/Jupyter notebooks for Python beginners" ](https://www.youtube.com/watch?v=AUZkioRI-aA&list=PLeoTcBlDanyNQXBqI1rVXUqUTSSiuSIXN&index=8 ) by Chico Venancio, from 2021-06-01.
2021-08-07 17:56:21 +00:00
2022-07-05 16:05:17 +00:00
He explains PAWS as a "powerful Python execution environment https://paws.wmcloud.org = https://wikitech.wikimedia.org/wiki/PAWS [allowing] ordinary folks to write interactive scripts to work with Wikimedia content."