Skip to content

Commit

Permalink
jupyterhub: allow config override via env.local
Browse files Browse the repository at this point in the history
This is basically the same as `ENABLE_JUPYTERHUB_MULTI_NOTEBOOKS` but at
the bottom of the file so it can override everything.
`ENABLE_JUPYTERHUB_MULTI_NOTEBOOKS` is kept for backward-compat.

First useful application is to enable server culling for auto shutdown
of idle kernels and jupyter single server (fixes #67).
  • Loading branch information
tlvu committed Jun 9, 2021
1 parent 0d3f316 commit 579100b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions birdhouse/config/jupyterhub/jupyterhub_config.py.template
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,5 @@ c.Authenticator.refresh_pre_spawn = True
blocked_users = {'authtest', '${CATALOG_USERNAME}', 'anonymous'}
c.Authenticator.blacklist = blocked_users # v0.9+
c.Authenticator.blocked_users = blocked_users # v1.2+

${JUPYTERHUB_CONFIG_OVERRIDE} # noqa
4 changes: 4 additions & 0 deletions birdhouse/default.env
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export JUPYTER_LOGIN_BANNER_BOTTOM_SECTION=""
# server for the change to take effect.
export JUPYTERHUB_README="$JUPYTERHUB_USER_DATA_DIR/README.ipynb"

# Allow for adding new config or override existing config in
# config/jupyterhub/jupyterhub_config.py.template.
export JUPYTERHUB_CONFIG_OVERRIDE=""

# Folder inside "proxy" container to drop extra monitoring config
export CANARIE_MONITORING_EXTRA_CONF_DIR="/conf.d"

Expand Down
19 changes: 18 additions & 1 deletion birdhouse/env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,23 @@ export POSTGRES_MAGPIE_PASSWORD=postgres-qwerty
# server for the change to take effect.
#export JUPYTERHUB_README="/path/to/README.ipynb"

# Allow for adding new config or override existing config in
# config/jupyterhub/jupyterhub_config.py.template.
#
# Sample below will shutdown idle server after 3 days and idle kernel after 8 hours.
#
#export JUPYTERHUB_CONFIG_OVERRIDE="
#c.Spawner.args.extend([
## Shut down the server after N seconds with no kernels or terminals running and no activity.
#'--NotebookApp.shutdown_no_activity_timeout=259200', # 3d * 24h/d * 60m/h * 60s/m
## Timeout (in seconds) after which a kernel is considered idle and ready to be culled.
#'--MappingKernelManager.cull_idle_timeout=28800', # 8h * 60m/h * 60s/m
## Culling kernels which have one or more connections for idle but open notebooks.
## Otherwise, browser have to be closed for culling to work.
#'--MappingKernelManager.cull_connected=True',
#])
#"

# Extra PyWPS config for **all** WPS services (currently only Flyingpigeon, Finch and Raven supported).
# export EXTRA_PYWPS_CONFIG="
# [logging]
Expand Down Expand Up @@ -354,4 +371,4 @@ export POSTGRES_MAGPIE_PASSWORD=postgres-qwerty
# To enable emu: add './optional-components/emu' to EXTRA_CONF_DIRS above.

# Emu WPS service image if that testing component is enabled
#export EMU_IMAGE="tlvu/emu:watchdog"
#export EMU_IMAGE="tlvu/emu:watchdog"
1 change: 1 addition & 0 deletions birdhouse/pavics-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ OPTIONAL_VARS='
$JUPYTER_LOGIN_BANNER_TOP_SECTION
$JUPYTER_LOGIN_BANNER_BOTTOM_SECTION
$JUPYTER_LOGIN_TERMS_URL
$JUPYTERHUB_CONFIG_OVERRIDE
$AUTODEPLOY_EXTRA_REPOS_AS_DOCKER_VOLUMES
$AUTODEPLOY_PLATFORM_FREQUENCY
$AUTODEPLOY_NOTEBOOK_FREQUENCY
Expand Down

0 comments on commit 579100b

Please sign in to comment.