From 2bf1170192217193f02c396c9d3ef98fa9977b4d Mon Sep 17 00:00:00 2001 From: mishaschwartz <4380924+mishaschwartz@users.noreply.github.com> Date: Mon, 20 Jan 2025 11:21:37 -0500 Subject: [PATCH 1/2] upgrade to jupyterhub v5 --- CHANGES.md | 24 ++++++++++++++++++- birdhouse/components/jupyterhub/default.env | 2 +- .../jupyterhub/jupyterhub_config.py.template | 3 +++ birdhouse/env.local.example | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 5d1d4cb7..61c8591d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,7 +15,29 @@ [Unreleased](https://github.com/bird-house/birdhouse-deploy/tree/master) (latest) ------------------------------------------------------------------------------------------------------------------ -[//]: # (list changes here, using '-' for each new entry, remove this when items are added) +## Changes + +- JupyterHub: update `jupyterhub` component default version to [5.2.1](https://github.com/Ouranosinc/jupyterhub/releases/tag/5.2.1-20241114) + + This implements all changes between JupyterHub version + [4.1.6 and 5.2.1](https://jupyterhub.readthedocs.io/en/stable/reference/changelog.html). + + This update requires the following manual upgrade steps: + + - If your local environment file sets the `c.DockerSpawner.image_whitelist` config option in the + `JUPYTERHUB_ENABLE_MULTI_NOTEBOOKS` environnment variable. Change `c.DockerSpawner.image_whitelist` + to `c.DockerSpawner.allowed_images`. + - Update the jupyterhub database with the following command after you have started up the stack: + ``` + birdhouse compose exec jupyterhub jupyterhub upgrade-db + ``` + You can also simply delete the `jupyterhub_data_persistence` volume if you're not storing any custom + information there and if you haven't manually set `c.Authenticator.allow_all` to `False` (ensure that + the stack is stopped and all jupyterlab containers have been stopped and removed first). + + If you have changed any of the default `jupyterhub` settings you may need to consult the [JupyterHub upgrade + guide](https://jupyterhub.readthedocs.io/en/latest/howto/upgrading-v5.html) to see if any of those settings + have been changed. [2.8.0](https://github.com/bird-house/birdhouse-deploy/tree/2.8.0) (2025-01-17) ------------------------------------------------------------------------------------------------------------------ diff --git a/birdhouse/components/jupyterhub/default.env b/birdhouse/components/jupyterhub/default.env index 91f40f08..c49bce48 100644 --- a/birdhouse/components/jupyterhub/default.env +++ b/birdhouse/components/jupyterhub/default.env @@ -5,7 +5,7 @@ # are applied and must be added to the list of DELAYED_EVAL. export JUPYTERHUB_DOCKER=pavics/jupyterhub -export JUPYTERHUB_VERSION=4.1.5-20240426 +export JUPYTERHUB_VERSION=5.2.1-20241114 export JUPYTERHUB_IMAGE='${JUPYTERHUB_DOCKER}:${JUPYTERHUB_VERSION}' export JUPYTERHUB_IMAGE_URI='registry.hub.docker.com/${JUPYTERHUB_IMAGE}' diff --git a/birdhouse/components/jupyterhub/jupyterhub_config.py.template b/birdhouse/components/jupyterhub/jupyterhub_config.py.template index 44521a50..f9289077 100644 --- a/birdhouse/components/jupyterhub/jupyterhub_config.py.template +++ b/birdhouse/components/jupyterhub/jupyterhub_config.py.template @@ -177,6 +177,8 @@ c.Spawner.disable_user_config = True c.DockerSpawner.default_url = '/lab' c.DockerSpawner.remove = True # delete containers when servers are stopped ${JUPYTERHUB_ENABLE_MULTI_NOTEBOOKS} # noqa + +c.DockerSpawner.allowed_images = {c.DockerSpawner.image: c.DockerSpawner.image} # v5.0+ c.DockerSpawner.pull_policy = "always" # for images not using pinned version c.DockerSpawner.debug = True c.JupyterHub.log_level = logging.DEBUG @@ -223,6 +225,7 @@ blocked_users = {'authtest', '${CATALOG_USERNAME}', 'anonymous'} c.Authenticator.blacklist = blocked_users # v0.9+ c.Authenticator.blocked_users = blocked_users # v1.2+ +c.Authenticator.allow_all = True # v5.0+ # ------------------------------------------------------------------------------ # Shutdown idle user server based on configured timeouts. diff --git a/birdhouse/env.local.example b/birdhouse/env.local.example index 3b643412..ca483f68 100644 --- a/birdhouse/env.local.example +++ b/birdhouse/env.local.example @@ -281,7 +281,7 @@ export GEOSERVER_ADMIN_PASSWORD="${__DEFAULT__GEOSERVER_ADMIN_PASSWORD}" # allow jupyterhub user selection of which notebook image to run # see https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html #export JUPYTERHUB_ENABLE_MULTI_NOTEBOOKS=" -#c.DockerSpawner.image_whitelist = { +#c.DockerSpawner.allowed_images = { # os.environ['JUPYTERHUB_IMAGE_SELECTION_NAMES'].split()[0]: os.environ['JUPYTERHUB_DOCKER_NOTEBOOK_IMAGES'].split()[0], # os.environ['JUPYTERHUB_IMAGE_SELECTION_NAMES'].split()[1]: os.environ['JUPYTERHUB_DOCKER_NOTEBOOK_IMAGES'].split()[1], # os.environ['JUPYTERHUB_IMAGE_SELECTION_NAMES'].split()[2]: os.environ['JUPYTERHUB_DOCKER_NOTEBOOK_IMAGES'].split()[2], From d557adcbbce0c3a7d036252a4036929479a5aa8c Mon Sep 17 00:00:00 2001 From: mishaschwartz <4380924+mishaschwartz@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:33:01 -0500 Subject: [PATCH 2/2] review suggestions --- CHANGES.md | 7 ------- .../jupyterhub/jupyterhub_config.py.template | 2 +- docs/source/migration_guide.rst | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 61c8591d..37add6ed 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,13 +27,6 @@ - If your local environment file sets the `c.DockerSpawner.image_whitelist` config option in the `JUPYTERHUB_ENABLE_MULTI_NOTEBOOKS` environnment variable. Change `c.DockerSpawner.image_whitelist` to `c.DockerSpawner.allowed_images`. - - Update the jupyterhub database with the following command after you have started up the stack: - ``` - birdhouse compose exec jupyterhub jupyterhub upgrade-db - ``` - You can also simply delete the `jupyterhub_data_persistence` volume if you're not storing any custom - information there and if you haven't manually set `c.Authenticator.allow_all` to `False` (ensure that - the stack is stopped and all jupyterlab containers have been stopped and removed first). If you have changed any of the default `jupyterhub` settings you may need to consult the [JupyterHub upgrade guide](https://jupyterhub.readthedocs.io/en/latest/howto/upgrading-v5.html) to see if any of those settings diff --git a/birdhouse/components/jupyterhub/jupyterhub_config.py.template b/birdhouse/components/jupyterhub/jupyterhub_config.py.template index f9289077..c58581d6 100644 --- a/birdhouse/components/jupyterhub/jupyterhub_config.py.template +++ b/birdhouse/components/jupyterhub/jupyterhub_config.py.template @@ -176,9 +176,9 @@ c.Spawner.disable_user_config = True c.DockerSpawner.default_url = '/lab' c.DockerSpawner.remove = True # delete containers when servers are stopped +c.DockerSpawner.allowed_images = {c.DockerSpawner.image: c.DockerSpawner.image} # v5.0+ ${JUPYTERHUB_ENABLE_MULTI_NOTEBOOKS} # noqa -c.DockerSpawner.allowed_images = {c.DockerSpawner.image: c.DockerSpawner.image} # v5.0+ c.DockerSpawner.pull_policy = "always" # for images not using pinned version c.DockerSpawner.debug = True c.JupyterHub.log_level = logging.DEBUG diff --git a/docs/source/migration_guide.rst b/docs/source/migration_guide.rst index 956171e9..e46cd899 100644 --- a/docs/source/migration_guide.rst +++ b/docs/source/migration_guide.rst @@ -3,6 +3,21 @@ Migration Guide =============== +Version 2.9 +----------- + +Version 2.9 updates JupyterHub to version 5. + +To upgrade to version 2.9 from an earlier version: + +- If your local environment file sets the `c.DockerSpawner.image_whitelist` config option in the + `JUPYTERHUB_ENABLE_MULTI_NOTEBOOKS` environnment variable. Change `c.DockerSpawner.image_whitelist` + to `c.DockerSpawner.allowed_images`. + + If you have changed any of the default `jupyterhub` settings you may need to consult the [JupyterHub upgrade + guide](https://jupyterhub.readthedocs.io/en/latest/howto/upgrading-v5.html) to see if any of those settings + have been changed. + Version 2.4 -----------