Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default defineConfig({
{ label: 'Quick Start', slug: 'quick-start' },
{ label: 'Architecture', slug: 'architecture' },
{ label: 'Shared Storage', slug: 'shared-storage' },
{ label: 'Jupyter Gallery', slug: 'gallery' },
],
},
{
Expand Down
1 change: 1 addition & 0 deletions docs/src/content/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Every derived value can still be overridden explicitly. Values under
| `nebi` | The companion Nebi service — image, external/internal URLs, namespace, release name |
| `rbac.bootstrap` | One-shot Keycloak Job that adds the groups-claim mapper and the shared-mount client role |
| `jupyterhub` | Passed through verbatim to the `jupyterhub` subchart (proxy, hub, singleuser images, auth, etc.) |
| Jupyter Gallery | Curated tutorial tiles in JupyterLab, configured via `jupyterhub.singleuser.extraFiles`. See [Jupyter Gallery](/gallery/) |
Comment thread
viniciusdc marked this conversation as resolved.
Resolved

For the full set of fields and their defaults, read
[`values.yaml`](https://github.com/nebari-dev/data-science-pack/blob/main/values.yaml)
Expand Down
101 changes: 101 additions & 0 deletions docs/src/content/docs/gallery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
title: Jupyter Gallery
description: Configure jupyterlab-gallery exhibits, where the config has to live, and the remote-icon trap on restricted-egress clusters.
Comment thread
viniciusdc marked this conversation as resolved.
Resolved
---

The [`jupyterlab-gallery`](https://github.com/nebari-dev/jupyterlab-gallery)
extension shows a curated set of tutorial "exhibits" as tiles inside
JupyterLab, each backed by a git repository the user can clone with one click.
The extension already ships in the singleuser image, so configuring it is only
a matter of telling the `GalleryManager` which exhibits to show.
Comment thread
viniciusdc marked this conversation as resolved.
Resolved

## Where the config has to live
Comment thread
viniciusdc marked this conversation as resolved.
Resolved

`GalleryManager` only exists in the **singleuser** Jupyter server, not in the
hub. Setting `c.GalleryManager.exhibits` under `jupyterhub.hub.extraConfig`
silently does nothing — the hub never reads it, so the gallery renders empty
with no error.

The config must be a `jupyter_gallery_config.py` file on the singleuser
server's Jupyter config path (one of `jupyter --paths` under `config`, e.g.
`/etc/jupyter/`). In this chart you inject it through the upstream
Zero to JupyterHub `singleuser.extraFiles` mechanism, which mounts the file
into every user pod:

```yaml
jupyterhub:
singleuser:
extraFiles:
gallery-config:
mountPath: /etc/jupyter/jupyter_gallery_config.py
stringData: |
c.GalleryManager.title = "Tutorials"
c.GalleryManager.destination = "tutorials"
c.GalleryManager.exhibits = [
{
"title": "Xarray",
"git": "https://github.com/xarray-contrib/xarray-tutorial.git",
"homepage": "https://github.com/xarray-contrib/xarray-tutorial",
},
]
```

`destination` is the directory (relative to the user's home) that exhibits are
cloned into.
Comment thread
viniciusdc marked this conversation as resolved.
Resolved

## Exhibit schema

Each entry in `c.GalleryManager.exhibits` is a dict. The keys the upstream
Comment thread
viniciusdc marked this conversation as resolved.
Resolved
`GalleryManager` understands:
Comment thread
viniciusdc marked this conversation as resolved.
Resolved

| Key | Purpose |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which of these are required?

|---|---|
| `git` | Clone URL of the exhibit repository (required) |
| `title` | Label shown on the tile |
| `homepage` | Link opened from the tile's "info" affordance |
Comment thread
viniciusdc marked this conversation as resolved.
Resolved
| `description` | Short blurb shown on the tile |
| `icon` | Tile image (see [Tile icons](#tile-icons-and-the-remote-icon-trap) below) |
| `branch` | Branch to clone (defaults to the repo's default branch) |
| `depth` | Clone depth for shallow clones |
| `account` / `token` | Credentials for private repositories |
Comment thread
viniciusdc marked this conversation as resolved.
Resolved

For private repositories, supply `account` and a personal access `token`.
Rather than embedding the token literally in the config, reference it from an
environment variable set on the singleuser pod (for example via

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do I actually set this on my deployment? Its something I have to manually set a the k8s level? Will I lose it if I upgrade NIC?

`jupyterhub.singleuser.extraEnv` backed by a Kubernetes Secret) so the
credential is not committed to Helm values. See the upstream
[`jupyterlab-gallery` README](https://github.com/nebari-dev/jupyterlab-gallery)
for the exact `GalleryManager` traitlets and the PAT-via-env-var pattern.

## Tile icons and the remote-icon trap

The `icon` key controls the image rendered on a tile. When `icon` points at a
**remote** URL (for example a GitHub raw link), the browser fetches it
client-side. On air-gapped or restricted-egress deployments the client cannot
reach the outside network, so that fetch fails and the tile shows the browser's
broken-image placeholder with no fallback.

For those environments, point `icon` at a **local** asset served from within
the deployment — bundled into the singleuser image, or served from the same
origin — so the tile renders without any external fetch:

```python
c.GalleryManager.exhibits = [
{
"title": "JATIC Checkmaite Tutorial",
"git": "https://internal.example.com/jatic/checkmaite.git",
"icon": "/etc/jupyter/gallery-icons/checkmaite.png", # local, no external fetch
},
]
```

## Looking ahead

This page documents the current, hand-rolled approach: a
`jupyter_gallery_config.py` injected through `singleuser.extraFiles`. Work is
in progress to expose a first-class `jupyterhub.singleuser.gallery` values key
that renders the `GalleryManager` config for you
([PR #118](https://github.com/nebari-dev/data-science-pack/pull/118)). Once
that lands, exhibit configuration collapses to a values block and the
`extraFiles` file is no longer needed — this page will be updated to document
the values key instead.
Loading