-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from yambottle/DEV-221-djlabhub-chain-breaker
Dev 221 djlabhub chain breaker
- Loading branch information
Showing
39 changed files
with
2,011 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: singleuser-relase-wip | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
jupyterhub_version: | ||
required: true | ||
default: '4.0.2' | ||
type: choice | ||
options: | ||
- '4.0.2' | ||
- '1.4.2' | ||
jobs: | ||
release-image: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
# following python version end of life: https://devguide.python.org/versions/ | ||
- py_ver: '3.10' | ||
- py_ver: '3.9' | ||
- py_ver: '3.8' | ||
env: | ||
PY_VER: ${{matrix.py_ver}} | ||
JUPYTERHUB_VER: ${{github.event.inputs.jupyterhub_version}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# TODO - use docker build action | ||
# TODO - use conventional commit action to make release and changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
.vscode | ||
*.tar.gz | ||
docs/_build | ||
sphinx-validator.yaml | ||
common | ||
home_user | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
TODO - will make this a proper README.md later | ||
|
||
Pro | ||
- Break the chain of dependencies of self-managed base images | ||
- Reduce image maintenance hell | ||
- Use jupyter/minimal-notebook as base image instead | ||
- Compatible with previous supported feature as many as possible | ||
- Provide simpler way for mainteners to manage system dependencies and for users to install packages | ||
- Provide a way to config jupyter through environment variables | ||
- This can be used as jupyter lab, so we can archive djlab-docker and only focus on this repo | ||
- Add jupyterhub docker for single user image testing at local | ||
|
||
Con | ||
- Username if jovyan by default, consider this is a minor issue, since it's only visible in the terminal | ||
- Larger image size, this can be optimized when it becomes a problem |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ARG JUPYTERHUB_VERSION | ||
FROM jupyterhub/jupyterhub:${JUPYTERHUB_VERSION} | ||
|
||
COPY ./config/jupyterhub_config.py /etc/jupyterhub/jupyterhub_config.py | ||
RUN pip install dockerspawner oauthenticator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import os | ||
import pwd | ||
from traitlets.config import Config | ||
|
||
c = Config() if "c" not in locals() else c | ||
|
||
# get the current user | ||
user = [u for u in pwd.getpwall() if u.pw_uid == os.getuid()][0] | ||
|
||
## Class for authenticating users. | ||
# | ||
# This should be a subclass of :class:`jupyterhub.auth.Authenticator` | ||
# | ||
# with an :meth:`authenticate` method that: | ||
# | ||
# - is a coroutine (asyncio or tornado) | ||
# - returns username on success, None on failure | ||
# - takes two arguments: (handler, data), | ||
# where `handler` is the calling web.RequestHandler, | ||
# and `data` is the POST form data from the login page. | ||
# | ||
# .. versionchanged:: 1.0 | ||
# authenticators may be registered via entry points, | ||
# e.g. `c.JupyterHub.authenticator_class = 'pam'` | ||
# | ||
# Currently installed: | ||
# - default: jupyterhub.auth.PAMAuthenticator | ||
# - dummy: jupyterhub.auth.DummyAuthenticator | ||
# - null: jupyterhub.auth.NullAuthenticator | ||
# - pam: jupyterhub.auth.PAMAuthenticator | ||
# Default: 'jupyterhub.auth.PAMAuthenticator' | ||
c.JupyterHub.authenticator_class = "jupyterhub.auth.DummyAuthenticator" | ||
|
||
# ## TODO - callback_url needs to enable ssl | ||
# c.JupyterHub.authenticator_class = "oauthenticator.generic.GenericOAuthenticator" | ||
# c.GenericOAuthenticator.client_id = os.getenv("OAUTH2_CLIENT_ID") | ||
# c.GenericOAuthenticator.client_secret = os.getenv("OAUTH2_CLIENT_SECRET") | ||
# c.GenericOAuthenticator.oauth_callback_url = "https://127.0.0.1:8000/hub/oauth_callback" | ||
# c.GenericOAuthenticator.authorize_url = "https://keycloak-qa.datajoint.io/realms/datajoint/protocol/openid-connect/auth" | ||
# c.GenericOAuthenticator.token_url = "https://keycloak-qa.datajoint.io/realms/datajoint/protocol/openid-connect/token" | ||
# c.GenericOAuthenticator.userdata_url = "https://keycloak-qa.datajoint.io/realms/datajoint/protocol/openid-connect/userinfo" | ||
# c.GenericOAuthenticator.login_service = "Datajoint" | ||
# c.GenericOAuthenticator.username_claim = "preferred_username" | ||
# c.GenericOAuthenticator.enable_auth_state = True | ||
# c.GenericOAuthenticator.scope = ["openid"] | ||
# c.GenericOAuthenticator.claim_groups_key = "groups" | ||
# c.GenericOAuthenticator.admin_groups = ["datajoint"] | ||
|
||
## The class to use for spawning single-user servers. | ||
# | ||
# Should be a subclass of :class:`jupyterhub.spawner.Spawner`. | ||
# | ||
# .. versionchanged:: 1.0 | ||
# spawners may be registered via entry points, | ||
# e.g. `c.JupyterHub.spawner_class = 'localprocess'` | ||
# | ||
# Currently installed: | ||
# - default: jupyterhub.spawner.LocalProcessSpawner | ||
# - localprocess: jupyterhub.spawner.LocalProcessSpawner | ||
# - simple: jupyterhub.spawner.SimpleLocalProcessSpawner | ||
# Default: 'jupyterhub.spawner.LocalProcessSpawner' | ||
c.JupyterHub.spawner_class = "dockerspawner.DockerSpawner" | ||
|
||
## The ip address for the Hub process to *bind* to. | ||
# | ||
# By default, the hub listens on localhost only. This address must be accessible from | ||
# the proxy and user servers. You may need to set this to a public ip or '' for all | ||
# interfaces if the proxy or user servers are in containers or on a different host. | ||
# | ||
# See `hub_connect_ip` for cases where the bind and connect address should differ, | ||
# or `hub_bind_url` for setting the full bind URL. | ||
# Default: '127.0.0.1' | ||
c.JupyterHub.hub_ip = "" | ||
|
||
c.DockerSpawner.network_name = os.getenv("DOCKER_NETWORK_NAME", "jupyterhub_network") | ||
c.DockerSpawner.start_timeout = 60 | ||
# https://github.com/jupyterhub/jupyterhub/issues/2913#issuecomment-580535422 | ||
c.Spawner.http_timeout = 60 | ||
c.Spawner.start_timeout = 60 | ||
c.DockerSpawner.container_image = "datajoint/djlabhub:singleuser-4.0.2-py3.10-qa" | ||
|
||
c.DockerSpawner.environment = { | ||
## Jupyter Official Environment Variables | ||
"DOCKER_STACKS_JUPYTER_CMD": "lab", | ||
## Extended by Datajoint | ||
## Before Start Hook | ||
"DJLABHUB_REPO": "https://github.com/datajoint/datajoint-tutorials.git", | ||
"DJLABHUB_REPO_BRANCH": "main", | ||
"DJLABHUB_REPO_INSTALL": "TRUE", | ||
## Jupyter Config | ||
# "JUPYTER_SERVER_APP_IP": "0.0.0.0", | ||
# "JUPYTER_SERVER_APP_PASSWORD": "", | ||
# "JUPYTER_SERVER_APP_PORT": "8889", | ||
# "JUPYTER_SERVER_APP_ROOT_DIR": "/home/jovyan", | ||
"JUPYTER_FILE_CONTENTS_MANAGER_ROOT_DIR": "/home/jovyan", | ||
"JUPYTER_YDOCEXTENSION_DISABLE_RTC": "TRUE", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
version: '3.7' | ||
services: | ||
hub: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
- JUPYTERHUB_VERSION | ||
image: datajoint/djlabhub:hub-${JUPYTERHUB_VERSION} | ||
container_name: djlabhub-hub | ||
user: root | ||
env_file: .env | ||
# network to connect the hub and singleusers | ||
networks: | ||
- jupyterhub_network | ||
environment: | ||
- DOCKER_NETWORK_NAME=jupyterhub_network | ||
command: jupyterhub -f /etc/jupyterhub/jupyterhub_config.py | ||
ports: | ||
- 8000:8000 | ||
volumes: | ||
- ./config/jupyterhub_config.py:/etc/jupyterhub/jupyterhub_config.py | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
|
||
networks: | ||
jupyterhub_network: | ||
name: jupyterhub_network | ||
driver: bridge | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# build | ||
JUPYTERHUB_VERSION=4.0.2 | ||
|
||
OAUTH2_CLIENT_ID= | ||
OAUTH2_CLIENT_SECRET= | ||
# Need to generate by `openssl rand -hex 32` | ||
JUPYTERHUB_CRYPT_KEY= |
5 changes: 3 additions & 2 deletions
5
.github/workflows/development.yaml → legacy/.github/workflows/development.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.vscode | ||
*.tar.gz | ||
docs/_build | ||
sphinx-validator.yaml | ||
common | ||
home_user |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.