asmacdo
February 27, 2025, 7:38pm
1
I’ve been asked to add some text to our /hub/login page.
I’m using Z2JH. First of all, is there a way to modify the login html (and possibly other web templates) in config only?
If not, could I get a sanity check on my naive approach below?
the actual code that I’d modify would be here (or, at least somewhere in this repo) jupyterhub/share/jupyterhub/templates/login.html at 3885affd68ad348a28736d03034351c2f6ebdc95 · jupyterhub/jupyterhub · GitHub
then I’d modify the Hub image zero-to-jupyterhub-k8s/images/hub/Dockerfile at 6eedd18bfdee593f8d5bd538b665c3be1847efdf · jupyterhub/zero-to-jupyterhub-k8s · GitHub to use my custom jupyterhub/jupyterhub code.
then I’d use that hub image in the jupyterhub config. Configuration Reference — Zero to JupyterHub with Kubernetes documentation
Here are the docs for customizing HTML templates. Here is an example for the reference!
1 Like
asmacdo
February 27, 2025, 10:14pm
3
@mahendrapaipuri thanks you! I suppose I don’t actually need to carry a jupyterhub/jupyterhub fork if I can add template_paths into the config.
The awkward problem remains how to get that config to work with z2jh-- but I’ve now found Smooth JupyterHub template customization · Issue #1266 · jupyterhub/zero-to-jupyterhub-k8s · GitHub . When we find the time to try this out, maybe it would be useful to add a section to the z2jh customization guide? Customization Guide — Zero to JupyterHub with Kubernetes documentation
I guess that issue you mentioned is outdated? I mean, you can put custom templates in a persistent volume and set proper permissions so that user running JupyterHub inside the container can read them. We will not need an init container to do that job. Is it not the case?
We pass the custom templates via hub.extraFiles .
Thus, we can pass the templates during the Helm deployment, which does not require an extra volume.
config.yaml
hub:
extraFiles:
landing_page:
mountPath: /usr/local/share/jupyterhub/templates/login.html
(Local) ./templates/login.html
{% extends "page.html" %}
...
Deployment
helm upgrade --cleanup-on-fail \
--install jupyterhub jupyterhub/jupyterhub \
--namespace dev \
--version 4.1.0 \
--values config.yaml \
--set-file hub.extraFiles.landing_page.stringData=./templates/login.html
1 Like