Zero-to-jupyterhub-k8s: Document how to customize images/branding in a JupyterHub

Created on 29 May 2018  路  5Comments  路  Source: jupyterhub/zero-to-jupyterhub-k8s

At the team meeting @betatim mentioned that he'd be willing to discuss how to modify branding etc in a JupyterHub deployment. We'll sit down sometime this week to document how to do this in z2jh.

Most helpful comment

To modify the look&feel you need to modify things in at least two places:

  • pages served by JupyterHub are customised in the hub config and container
  • pages served by the single user notebook server need to be customised in the single user container/image

An example of modifying the hub image

FROM jupyterhub/k8s-hub:v0.6

USER root
COPY templates/error.html /usr/local/share/jupyter/hub/templates/error.html
COPY templates/my-logo.png /usr/local/share/jupyter/hub/static/images/my-logo.png

USER ${NB_USER}

This will give you a custom error page and a new logo. To actually use the logo you need to configure the hub. Below I just put it in the extraConfig, check if this can be done via a chart config option as well:

hub:
  extraConfig: |
    c.JupyterHub.logo_file = '/usr/local/share/jupyter/hub/static/images/my-logo.png'

I don't have an example handy for configuring the looks of a classic notebook. For JupyterLab you need to make a new theme. Need to think how we can make some short and complete example for this.

All 5 comments

To modify the look&feel you need to modify things in at least two places:

  • pages served by JupyterHub are customised in the hub config and container
  • pages served by the single user notebook server need to be customised in the single user container/image

An example of modifying the hub image

FROM jupyterhub/k8s-hub:v0.6

USER root
COPY templates/error.html /usr/local/share/jupyter/hub/templates/error.html
COPY templates/my-logo.png /usr/local/share/jupyter/hub/static/images/my-logo.png

USER ${NB_USER}

This will give you a custom error page and a new logo. To actually use the logo you need to configure the hub. Below I just put it in the extraConfig, check if this can be done via a chart config option as well:

hub:
  extraConfig: |
    c.JupyterHub.logo_file = '/usr/local/share/jupyter/hub/static/images/my-logo.png'

I don't have an example handy for configuring the looks of a classic notebook. For JupyterLab you need to make a new theme. Need to think how we can make some short and complete example for this.

We might want to think about these kind of "pull stuff directly into an image" approaches https://github.com/jupyterhub/jupyterhub/issues/1927#issue-327065043. Not sure what I think of them yet

A quick question: I tried to customize the hub image and override it in config.yaml by setting:

jupyterhub:
  hub:
    image:
      name: mjuric/k8s-hub-dirac
      tag: 0.8.2-mjuric1

But after running helm upgrade, it's still picking up the jupyterhub/k8s-hub:0.8.2 image. Can you tell if there's something obviously wrong that I'm doing?

Figured it out (h/t to @stevenstetzler) -- the hub section should be top-level, not under jupiterhub. Leaving it up there in case someone else has the same problem!

This issue relates to https://github.com/jupyterhub/zero-to-jupyterhub-k8s/issues/691, my recommended path is to mount templates and files, like described under option 3 in that issue.

I'm closing this and summarizing our wish to have this kind of docs in another issue.

Was this page helpful?
0 / 5 - 0 ratings