Custom html template not showing

Hello all, :slight_smile:

release : v0.2.0-9f83710

We are trying to set up our own template from https://github.com/neurolibre/binderhub-template (it is basically the same as mybinder, with just few changes to see if it works…).
I followed the tutorial here but have lot of problem to let it work…
I also check what they did here and don’t see why it would not work for me…

When I check the data inside the hub pod(kubectl exec -n=binderhub hub-8f89c86cf-4rvqx ls /etc/binderhub/custom), the folder /etc/binderhub/custom is empty.

here is my config.yaml

jupyterhub:
  ingress:
    enabled: true
    hosts:
      - conp8.calculquebec.cloud
    annotations:
      ingress.kubernetes.io/proxy-body-size: 64m
      kubernetes.io/ingress.class: nginx
      kubernetes.io/tls-acme: 'true'
  
  hub:
    baseUrl: /jupyter/
    initContainers:
      - name: git-clone-templates
        image: alpine/git
        args:
          - clone
          - --single-branch
          - --branch=master
          - --depth=1
          - --
          - https://github.com/neurolibre/binderhub-template.git
          - /etc/binderhub/custom
        securityContext:
          runAsUser: 0
        volumeMounts:
          - name: custom-templates
            mountPath: /etc/binderhub/custom
    extraVolumes:
    - name: custom-templates
      emptyDir: {}
    extraVolumeMounts:
    - name: custom-templates
      mountPath: /etc/binderhub/custom

  cull:
    timeout: 900
    every: 120 
  proxy:
    service:
      type: NodePort
  singleuser:
    storage:
      extraVolumes:
      - name: shared-data
        hostPath:
          path: /DATA
      extraVolumeMounts:
      - name: shared-data
        mountPath: /home/jovyan/data  # where each user can reach the shared data
        readOnly : true
    memory:
       guarantee: 2G
    cpu:
       guarantee: 2

# BinderHub config
config:
  BinderHub:
    template_path: /etc/binderhub/custom/templates
#    extra_static_path: /etc/binderhub/custom/static
#    extra_static_url_prefix: /extra_static/
#    template_variables:
#       EXTRA_STATIC_URL_PREFIX: "/extra_static/"
    hub_url: https://conp8.calculquebec.cloud/jupyter
    use_registry: true
    image_prefix: cmdntrf/conp8.calculquebec.cloud-

service:
  type: NodePort

storage:
  capacity: 2G

ingress:
  enabled: true
  hosts:
    - conp8.calculquebec.cloud
  annotations:
    kubernetes.io/ingress.class: nginx
  https:
    enabled: true
    type: kube-lego
  config:
    # Allow POSTs of upto 64MB, for large notebook support.
    proxy-body-size: 64m

Thanks,

1 Like

Hey - could you be a bit more specific about what exactly is going wrong? Is BinderHub working, just not showing your template?

Hi,

The binderhub is working, but it is not showing our templates.
When I ls into the binder container, there is no /etc/binderhub/custom

thanks,

Does inspecting the pod reveal correct or missing values? What about inspecting the logs, does the init container run as expected?

You might also try mounting one directory above the clone path, rather than the path to clone itself. I’m not sure if that would be relevant or not.

I think initContainers needs to be a top level key in the config to get a html template for BinderHub to work. So your config.yaml would look like:

config:
  BinderHub:
    template_path: /etc/binderhub/custom/templates
    extra_static_path: /etc/binderhub/custom/static
    extra_static_url_prefix: /extra_static/
    template_variables:
        EXTRA_STATIC_URL_PREFIX: "/extra_static/"

initContainers:
  - name: git-clone-templates
    image: alpine/git
    args:
      - clone
      - --single-branch
      - --branch=master
      - --depth=1
      - --
      - https://github.com/neurolibre/binderhub-template.git
      - /etc/binderhub/custom
    securityContext:
      runAsUser: 0
    volumeMounts:
      - name: custom-templates
        mountPath: /etc/binderhub/custom
extraVolumes:
  - name: custom-templates
    emptyDir: {}
extraVolumeMounts:
  - name: custom-templates
    mountPath: /etc/binderhub/custom

That is to say, initContainers shouldn’t be under the jupyterhub.hub key.

2 Likes