From a601753448accd449c7453e4640f63fecaa4dcac Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 8 May 2026 22:47:28 +0800 Subject: [PATCH 1/4] add devhub-traefik --- .github/workflows/build-docker.yml | 13 +++++++++++++ docker_devbox/hub.Dockerfile | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index d9b1943..a269b62 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -67,6 +67,19 @@ jobs: --build-arg "BASE_IMG=node" \ --build-arg "ARG_PROFILE_JUPYTER=hub" push_image dev-hub + + job-dev-hub-traefik: + name: "dev-hub-traefik" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - run: | + source ./tool.sh + build_image dev-hub latest docker_devbox/hub.Dockerfile \ + --build-arg "BASE_IMG=base" \ + --build-arg "ARG_PROFILE_JUPYTER=hub" \ + --build-arg "ARG_KEEP_NODEJS=false" + push_image dev-hub ## OpenResty as gateway job-openresty: diff --git a/docker_devbox/hub.Dockerfile b/docker_devbox/hub.Dockerfile index 24df020..d28dc55 100644 --- a/docker_devbox/hub.Dockerfile +++ b/docker_devbox/hub.Dockerfile @@ -24,11 +24,11 @@ RUN set -eux \ echo "Installing Traefik to server as proxy:" && source /opt/utils/script-setup-net.sh && setup_traefik ; \ else \ echo "Keep NodeJS as ARG_KEEP_NODEJS defiend as: ${ARG_KEEP_NODEJS}" ; \ + curl -fsSL -o /usr/local/bin/start-configurable-http-proxy.sh https://raw.githubusercontent.com/jupyterhub/configurable-http-proxy/refs/heads/main/chp-docker-entrypoint \ fi \ ## network-tools https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/main/images/network-tools/Dockerfile && apt-get update && apt-get install -y --no-install-recommends \ iptables dnsutils libcurl4 libpq5 sqlite3 \ - && curl -fsSL -o /usr/local/bin/start-configurable-http-proxy.sh https://raw.githubusercontent.com/jupyterhub/configurable-http-proxy/refs/heads/main/chp-docker-entrypoint \ && mv /opt/utils/start-*.sh /usr/local/bin/ \ && chmod +x /usr/local/bin/start-*.sh \ ## Clean up and display components version information... From 661b386b017877de414cf0806db743277c657a2e Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 8 May 2026 22:52:19 +0800 Subject: [PATCH 2/4] debug --- docker_devbox/hub.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker_devbox/hub.Dockerfile b/docker_devbox/hub.Dockerfile index d28dc55..f20afb2 100644 --- a/docker_devbox/hub.Dockerfile +++ b/docker_devbox/hub.Dockerfile @@ -24,7 +24,7 @@ RUN set -eux \ echo "Installing Traefik to server as proxy:" && source /opt/utils/script-setup-net.sh && setup_traefik ; \ else \ echo "Keep NodeJS as ARG_KEEP_NODEJS defiend as: ${ARG_KEEP_NODEJS}" ; \ - curl -fsSL -o /usr/local/bin/start-configurable-http-proxy.sh https://raw.githubusercontent.com/jupyterhub/configurable-http-proxy/refs/heads/main/chp-docker-entrypoint \ + curl -fsSL -o /usr/local/bin/start-configurable-http-proxy.sh https://raw.githubusercontent.com/jupyterhub/configurable-http-proxy/refs/heads/main/chp-docker-entrypoint ; \ fi \ ## network-tools https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/main/images/network-tools/Dockerfile && apt-get update && apt-get install -y --no-install-recommends \ From 7c0f365919bf386b5260b80c095f3662453fba3f Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 8 May 2026 22:59:34 +0800 Subject: [PATCH 3/4] typos --- .github/workflows/build-docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index a269b62..fde4f6c 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -75,11 +75,11 @@ jobs: - uses: actions/checkout@v5 - run: | source ./tool.sh - build_image dev-hub latest docker_devbox/hub.Dockerfile \ - --build-arg "BASE_IMG=base" \ + build_image dev-hub-traefik latest docker_devbox/hub.Dockerfile \ + --build-arg "BASE_IMG=base" \ --build-arg "ARG_PROFILE_JUPYTER=hub" \ --build-arg "ARG_KEEP_NODEJS=false" - push_image dev-hub + push_image dev-hub-traefik ## OpenResty as gateway job-openresty: From a8362c4c900f77e7766326d58423e506efd50638 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 8 May 2026 23:06:59 +0800 Subject: [PATCH 4/4] debug jupyterhub --- docker_devbox/hub.Dockerfile | 14 ++++++++++---- docker_devbox/work/script-devbox-jupyter.sh | 7 ------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/docker_devbox/hub.Dockerfile b/docker_devbox/hub.Dockerfile index f20afb2..e052373 100644 --- a/docker_devbox/hub.Dockerfile +++ b/docker_devbox/hub.Dockerfile @@ -20,11 +20,17 @@ RUN set -eux \ && for profile in $(echo $ARG_PROFILE_JUPYTER | tr "," "\n") ; do ( setup_jupyter_${profile} ) ; done \ ## If not keeping NodeJS, remove NoedJS to reduce image size, and install Traefik instead && if [ ${ARG_KEEP_NODEJS} = "false" ] ; then \ - echo "Removing Node/NPM..." && rm -rf /usr/bin/node /usr/bin/npm /usr/bin/npx /opt/node ; \ - echo "Installing Traefik to server as proxy:" && source /opt/utils/script-setup-net.sh && setup_traefik ; \ + # Using Traefik to server as proxy, which is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy. + echo "Removing Node/NPM..." && rm -rf /usr/bin/node /usr/bin/npm /usr/bin/npx /opt/node ; \ + echo "Installing Traefik to server as proxy:" && source /opt/utils/script-setup-net.sh && setup_traefik ; \ else \ - echo "Keep NodeJS as ARG_KEEP_NODEJS defiend as: ${ARG_KEEP_NODEJS}" ; \ - curl -fsSL -o /usr/local/bin/start-configurable-http-proxy.sh https://raw.githubusercontent.com/jupyterhub/configurable-http-proxy/refs/heads/main/chp-docker-entrypoint ; \ + # Using NodeJS to install configurable-http-proxy, which is a dependency of JupyterHub, and also used as the default proxy for JupyterHub. + echo "Keep NodeJS as ARG_KEEP_NODEJS defiend as: ${ARG_KEEP_NODEJS}" ; \ + curl -fsSL -o /usr/local/bin/start-configurable-http-proxy.sh https://raw.githubusercontent.com/jupyterhub/configurable-http-proxy/refs/heads/main/chp-docker-entrypoint ; \ + which npm && ( npm install -g npm configurable-http-proxy ) || ( echo "NPM not found!" && return 255 ) ; \ + # Notes: there is also an python version of configurable-http-proxy available but has limited compatibility. + ln -sf $(which configurable-http-proxy) /usr/local/bin/configurable-http-proxy ; \ + type configurable-http-proxy && echo "@ Configurable HTTP Proxy version: $(configurable-http-proxy --version)" || return -1 ; \ fi \ ## network-tools https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/main/images/network-tools/Dockerfile && apt-get update && apt-get install -y --no-install-recommends \ diff --git a/docker_devbox/work/script-devbox-jupyter.sh b/docker_devbox/work/script-devbox-jupyter.sh index acc9da5..c85064d 100644 --- a/docker_devbox/work/script-devbox-jupyter.sh +++ b/docker_devbox/work/script-devbox-jupyter.sh @@ -103,8 +103,6 @@ setup_jupyter_hub() { # ref1: https://github.com/jupyterhub/jupyterhub # ref2: https://github.com/jupyterhub/jupyterhub/blob/main/Dockerfile # ref3: https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/main/images/hub/unfrozen/requirements.txt - which npm && ( npm install -g npm configurable-http-proxy ) || ( echo "NPM not found!" && return 255 ) ; - pip install -Uq --pre jupyterhub jupyter_client \ dockerspawner jupyterhub-kubespawner jupyterhub-systemdspawner wrapspawner \ jupyterhub-ldapauthenticator jupyterhub-kerberosauthenticator \ @@ -115,10 +113,5 @@ setup_jupyter_hub() { psutil pycurl py-spy \ jupyterhub-traefik-proxy ; - # Notes: there is also an python version of configurable-http-proxy available but has limited compatibility. - ln -sf $(which configurable-http-proxy) /usr/local/bin/configurable-http-proxy ; - - type configurable-http-proxy && echo "@ Configurable HTTP Proxy version: $(configurable-http-proxy --version)" || return -1 ; - type jupyterhub && echo "@ JupyterHub version: $(jupyterhub --version)" || return -1 ; }