# UI for building ZTJH ready images with repo2docker / binderhub?

**URL:** <https://discourse.jupyter.org/t/ui-for-building-ztjh-ready-images-with-repo2docker-binderhub/22610>\
**Category:** Zero to JupyterHub on Kubernetes\
**Created:** [November 29, 2023, 9:13am UTC](https://discourse.jupyter.org/t/ui-for-building-ztjh-ready-images-with-repo2docker-binderhub/22610 "2023-11-29T09:13:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtp](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jtp/32/19100_2.png) [@jtp](https://discourse.jupyter.org/u/jtp)\
**Post date:** [November 29, 2023, 9:13am UTC](https://discourse.jupyter.org/t/ui-for-building-ztjh-ready-images-with-repo2docker-binderhub/22610/1 "2023-11-29T09:13:26Z")

</div>

Starting this discussion to get an idea if such tool already exists, or if there is an issue about it somewhere already.

It would be great if the JupyterHub admins could have a UI to pre-build a set of images to make them available to users of a JupyterHub.

For reference there is already a plugin for The Littlest JupyterHub (TLJH) that offers a way to build images:

- Repo: [GitHub - plasmabio/tljh-repo2docker: Plugin for The Littlest JupyterHub to build multiple user environments with repo2docker](https://github.com/plasmabio/tljh-repo2docker).
- Discourse post: [A TLJH Plugin to build user environments with repo2docker](https://discourse.jupyter.org/t/a-tljh-plugin-to-build-user-environments-with-repo2docker/4258)

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/6/69366dd2772af560f6c48e8ff0bc2b9cfbb459cf.png)

But this plugin is for TLJH, and the images are built on the server where TLJH is deployed, with `repo2docker`.

The idea would be to have something similar, but for a JupyterHub deployed via ZTJH. With the UI, admin users could create environments from repositories just like with BinderHub. But they could also delete them or change a few other options if needed such as memory and CPU limits. Technically this could be implemented as a JupyterHub service like BinderHub.

Then users of the JupyterHub could choose the image they want via the server options:

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/8/88b69ca232a52e8747fbae774ab70ef538bfbfe9.png)

Currently BinderHub proposes only one UI to build (and launch) a server:

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/7/75ce60b75fb580d16e2fb8cad2d2487487d263cd.png)

But I’m not sure if something similar to `tljh-repo2docker` already exists, but for ZTJH, or has already been explored?

Thanks!

---

<div class="post-metadata">

**Author:** ![manics](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/manics/32/85_2.png) [@manics](https://discourse.jupyter.org/u/manics)\
**Post date:** [November 29, 2023, 12:00pm UTC](https://discourse.jupyter.org/t/ui-for-building-ztjh-ready-images-with-repo2docker-binderhub/22610/2 "2023-11-29T12:00:10Z")

</div>

BinderHub recently had an API-mode added

> <https://github.com/jupyterhub/binderhub/pull/1647>
>
> (PR written and made by @GeorgianaElena, it was just initialized by @consideRati…o to get a branch to reference)
> 
> This PR adds a feature that offers the option of an API only mode, and in this mode, it allows opting-out of launching directly after build.
> 
> It adds:
> \- \[x\] a traitlet called \`enable\_api\_only\_node\` that defaults to False to preserve existing default behavior. When enabled, there will be no UI, with the only registered endpoints being:
> - \`/metrics\`
> - \`/versions\`
> - \`/build\`
> - \`/health\`
> - \`/\_config\`
> - \`/\*\` -\> shows a custom 404 page
> \- \[x\] a query parameter called \`build\_only\` to be passed to individual requests to enable the build only \*\*only\*\* when \`enable\_api\_only\_node\` is True
> 
> \`\`\`mermaid
> flowchart LR
> subgraph API only mode enabled
> direction TB
> id1{{false}}
> id2{{false}}
> id3{{false}}
> id4{{true}}
> id5{{true}}
> id6{{true}}
> end
> 
> subgraph \`build\_only\` query param
> direction TB
> id1 ---|and|id11{{missing}}
> id2 ---|and|id12{{false}}
> id3 ---|and|id13{{true}}
> id4 ---|and|id14{{missing}}
> id5 ---|and|id15{{false}}
> id6 ---|and|id16{{true}}
> end
> 
> subgraph Outcome
> direction TB
> id11 ==\> id21{{OK, image will be launched after build}}
> id12 ==\> id22{{OK, image will be launched after build}}
> id13 ==\> id23{{ERROR, building but not launching is not permitted when API only mode is not enabled}}
> id14 ==\> id24{{OK, image will be launched after build}}
> id15 ==\> id25{{OK, image will be launched after build}}
> id16 ==\> id26{{OK, image will NOT be launched after build}}
> end
> \`\`\`
> 
> \- \[x\] tests
> - \[x\] for the configuration corner cases that generate errors
> - \[x\] for the actual build only config
> 
> It also updates the \`auth\` tests for consistency to expect a more descriptive pytest request parameter value in order for the app fixture to load the extra auth configuration. This is for consistency with the build only extra config that was added in this PR.
> 
> \### Todo
> \- \[\] Document this once there's agreement on naming an evaluation of the the traitlet and query parameter values to come to an outcome.
> 
> \### Background
> 
> This is meant as a building block for the https://github.com/2i2c-org/binderhub-service project. In brief, its positioning itself to be relevant specifically for situations when a binderhub UI is relevant together with a JupyterHub behind authentication and that also provides user home folder storage.

That PR also links to [GitHub - 2i2c-org/binderhub-service](https://github.com/2i2c-org/binderhub-service)
