From ab5f61a051a229c9bd6f67f55938a092fb96609a Mon Sep 17 00:00:00 2001 From: Rishabh Chowdhary Date: Tue, 28 Apr 2026 14:50:28 -0700 Subject: [PATCH 1/5] Add dbm-example custom Jupyter app template Creates a new custom app template based on Jupyter base-notebook with integrated Workbench tools (gcsfuse, wb CLI) and cloud CLIs (AWS, GCP). Configured for user rishbahc with Java 17 support. Co-Authored-By: Claude Sonnet 4.5 --- src/dbm-example/.devcontainer.json | 29 +++++++++++++++ src/dbm-example/README.md | 43 ++++++++++++++++++++++ src/dbm-example/devcontainer-template.json | 20 ++++++++++ src/dbm-example/docker-compose.yaml | 36 ++++++++++++++++++ tests/dbm-example.sh | 6 +++ 5 files changed, 134 insertions(+) create mode 100644 src/dbm-example/.devcontainer.json create mode 100644 src/dbm-example/README.md create mode 100644 src/dbm-example/devcontainer-template.json create mode 100644 src/dbm-example/docker-compose.yaml create mode 100755 tests/dbm-example.sh diff --git a/src/dbm-example/.devcontainer.json b/src/dbm-example/.devcontainer.json new file mode 100644 index 00000000..51c8dd1f --- /dev/null +++ b/src/dbm-example/.devcontainer.json @@ -0,0 +1,29 @@ +{ + "name": "dbm-example", + "dockerComposeFile": "docker-compose.yaml", + "service": "app", + "shutdownAction": "none", + "workspaceFolder": "/workspace", + "postCreateCommand": [ + "./startupscript/post-startup.sh", + "rishbahc", + "/home/rishabhc", + "${templateOption:cloud}", + "${templateOption:login}" + ], + "postStartCommand": [ + "./startupscript/remount-on-restart.sh", + "rishbahc", + "/home/rishabhc", + "${templateOption:cloud}", + "${templateOption:login}" + ], + "features": { + "ghcr.io/devcontainers/features/java:1": { + "version": "17" + }, + "ghcr.io/devcontainers/features/aws-cli:1": {}, + "ghcr.io/dhoeric/features/google-cloud-cli:1": {} + }, + "remoteUser": "root" +} diff --git a/src/dbm-example/README.md b/src/dbm-example/README.md new file mode 100644 index 00000000..0d36e9d8 --- /dev/null +++ b/src/dbm-example/README.md @@ -0,0 +1,43 @@ +# dbm-example + +Custom Workbench application based on quay.io/jupyter/base-notebook. + +## Configuration + +- **Image**: quay.io/jupyter/base-notebook +- **Port**: 8888 +- **User**: rishbahc +- **Home Directory**: /home/rishabhc + +## Access + +Once deployed in Workbench, access your terminal at the app URL (port 8888). + +For local testing: +1. Create Docker network: `docker network create app-network` +2. Run the app: `devcontainer up --workspace-folder .` +3. Access at: `http://localhost:8888` + +## Customization + +Edit the following files to customize your app: + +- `.devcontainer.json` - Devcontainer configuration and features +- `docker-compose.yaml` - Docker Compose configuration (change the `command` to customize ttyd options) +- `devcontainer-template.json` - Template options and metadata + +## Testing + +To test this app template: + +```bash +cd test +./test.sh dbm-example +``` + +## Usage + +1. Fork the repository +2. Modify the configuration files as needed +3. In Workbench UI, create a custom app pointing to your forked repository +4. Select this app template (dbm-example) diff --git a/src/dbm-example/devcontainer-template.json b/src/dbm-example/devcontainer-template.json new file mode 100644 index 00000000..282fd19a --- /dev/null +++ b/src/dbm-example/devcontainer-template.json @@ -0,0 +1,20 @@ +{ + "id": "dbm-example", + "version": "1.0.0", + "name": "dbm-example", + "description": "Custom Workbench app: dbm-example (Image: quay.io/jupyter/base-notebook, Port: 8888, User: rishbahc)", + "options": { + "cloud": { + "type": "string", + "enum": ["gcp", "aws"], + "default": "gcp", + "description": "Cloud provider (gcp or aws)" + }, + "login": { + "type": "string", + "description": "Whether to log in to workbench CLI", + "proposals": ["true", "false"], + "default": "false" + } + } +} diff --git a/src/dbm-example/docker-compose.yaml b/src/dbm-example/docker-compose.yaml new file mode 100644 index 00000000..b953db84 --- /dev/null +++ b/src/dbm-example/docker-compose.yaml @@ -0,0 +1,36 @@ +services: + app: + # The container name must be "application-server" + container_name: "application-server" + # This can be either a pre-existing image or built from a Dockerfile + image: "quay.io/jupyter/base-notebook" + # build: + # context: . + restart: always + volumes: + - .:/workspace:cached + - work:/home/rishabhc/work + # The port specified here will be forwarded and accessible from the + # Workbench UI. + ports: + - 8888:8888 + # The service must be connected to the "app-network" Docker network + networks: + - app-network + # SYS_ADMIN and fuse are required to mount workspace resources into the + # container. + cap_add: + - SYS_ADMIN + devices: + - /dev/fuse + security_opt: + - apparmor:unconfined + +volumes: + work: + +networks: + # The Docker network must be named "app-network". This is an external network + # that is created outside of this docker-compose file. + app-network: + external: true diff --git a/tests/dbm-example.sh b/tests/dbm-example.sh new file mode 100755 index 00000000..35ec19a8 --- /dev/null +++ b/tests/dbm-example.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -o errexit +export TEST_USER="jovyan" +export TEST_USER_HOME="/home/jovyan" + +bats tests/common/base.bats From 1516cdd7061a23b081cb95c836a7420c96ba8031 Mon Sep 17 00:00:00 2001 From: Rishabh Chowdhary Date: Wed, 29 Apr 2026 10:18:21 -0700 Subject: [PATCH 2/5] Update user in devcontainer configuration --- src/dbm-example/.devcontainer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dbm-example/.devcontainer.json b/src/dbm-example/.devcontainer.json index 51c8dd1f..1d2d9f53 100644 --- a/src/dbm-example/.devcontainer.json +++ b/src/dbm-example/.devcontainer.json @@ -6,8 +6,8 @@ "workspaceFolder": "/workspace", "postCreateCommand": [ "./startupscript/post-startup.sh", - "rishbahc", - "/home/rishabhc", + "jovyan", + "/home/jovyan", "${templateOption:cloud}", "${templateOption:login}" ], From 60aab81b575a52d4c6ee851277970230ca1784f7 Mon Sep 17 00:00:00 2001 From: Rishabh Chowdhary Date: Wed, 29 Apr 2026 10:18:41 -0700 Subject: [PATCH 3/5] Update .devcontainer.json --- src/dbm-example/.devcontainer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dbm-example/.devcontainer.json b/src/dbm-example/.devcontainer.json index 1d2d9f53..f42d3b7f 100644 --- a/src/dbm-example/.devcontainer.json +++ b/src/dbm-example/.devcontainer.json @@ -13,8 +13,8 @@ ], "postStartCommand": [ "./startupscript/remount-on-restart.sh", - "rishbahc", - "/home/rishabhc", + "jovyan", + "/home/jovyan", "${templateOption:cloud}", "${templateOption:login}" ], From 8e328365d8f83b7515d8aed42a71b835508cf72b Mon Sep 17 00:00:00 2001 From: Rishabh Chowdhary Date: Wed, 29 Apr 2026 10:19:45 -0700 Subject: [PATCH 4/5] Update docker-compose.yaml --- src/dbm-example/docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbm-example/docker-compose.yaml b/src/dbm-example/docker-compose.yaml index b953db84..d5975834 100644 --- a/src/dbm-example/docker-compose.yaml +++ b/src/dbm-example/docker-compose.yaml @@ -9,7 +9,7 @@ services: restart: always volumes: - .:/workspace:cached - - work:/home/rishabhc/work + - work:/home/jovyan/work # The port specified here will be forwarded and accessible from the # Workbench UI. ports: From 5bd42e8d04404e5f55844204fe4ab27b22b11ee0 Mon Sep 17 00:00:00 2001 From: Rishabh Chowdhary Date: Wed, 29 Apr 2026 10:20:23 -0700 Subject: [PATCH 5/5] Update README.md --- src/dbm-example/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dbm-example/README.md b/src/dbm-example/README.md index 0d36e9d8..43007f49 100644 --- a/src/dbm-example/README.md +++ b/src/dbm-example/README.md @@ -6,8 +6,8 @@ Custom Workbench application based on quay.io/jupyter/base-notebook. - **Image**: quay.io/jupyter/base-notebook - **Port**: 8888 -- **User**: rishbahc -- **Home Directory**: /home/rishabhc +- **User**: rishabhc +- **Home Directory**: /home/jovyan ## Access