-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation
The jupyterhub is running in a container and is using jupyterhub/jupyterhub's docker image. The jupyterhub is responsible to spawn jupyterlab containers for the user connecting and does so using the spawner_class "dockerspawner.SystemUserSpawner"
, and the configuration for which image to use for the jupyterlab is written in env.sh (LOCAL_NOTEBOOK_IMAGE
) which is read by jupyterhub_config.py.
Jupyterhub admins are assigned by assigning users to RBAG_jupyterhub_admins
in active directory.
There are two fields for limiting memory in jupyterhub_config.py which is configurable, and can be customized further to allow some users to use even more resources.
mem_guarantee guarantees user to have atleast 1G memory
c.DockerSpawner.mem_guarantee = "1G"
mem_limit allows user to surpass the guarantee but sets a limit at 2G
c.DockerSpawner.mem_limit = "2G"
in the docker-compose one is responsible for mounting /ssb to the jupyterhub container, which contains stamme01, stamme02, stamme03, stamme04, bruker and share. stamme{1..4} contain data, share contains files that are shared between users and bruker is the root directory for all the home directories for the users.
volumes in docker-compose which runs the jupyterhub-container:
# Bind Docker socket on the host so we can connect to the daemon from within the container
- "/var/run/docker.sock:/var/run/docker.sock:rw"
# Bind Docker volume on host for JupyterHub database and cookie secrets
- "data:${DATA_VOLUME_CONTAINER}"
# Mounting ssb nfs shares
- "/ssb:/ssb"
# Mounting /var/lib/sss so we can use sssd users from host
# Mounting /var/lib/sss so we can authenticate using sssd
- "/var/lib/sss:/var/lib/sss"
The code below mounts /ssb from the jupyterhub container to the jupyterlab container being spawned, ensuring each user container has access.
The configuration is written in jupyterhub_config.py.
c.DockerSpawner.volumes = { "/ssb": "/ssb" }
Home directory is set to mount /ssb/bruker/{username} to /home/{username}, which means users can access /ssb/bruker/{username} at /home/{username}
Config in jupyterhub_config.py
c.SystemUserSpawner.host_homedir_format_string = "/ssb/bruker/{username}"
I have enabled prometheus support and disabled authentication needed. There are no sensitive information in the metrics and makes it easier in the prometheus configuration when requesting the data.
c.JupyterHub.authenticate_prometheus = False
Idle-culler-service culls every jupyterlab server every two minutes and if the jupyterlab server has been inactive for one hour the server will be terminated.
# Jupyterhub idle-culler-service
import sys
c.JupyterHub.services = [
{
"name": "jupyterhub-idle-culler-service",
"command": [
sys.executable,
"-m", "jupyterhub_idle_culler",
"--timeout=3600",
],
"admin": True,
}
]