Skip to content

Commit de37eca

Browse files
committed
Updated J-hub to v5.4, fixed issues with singleuser container startup.
1 parent f69e142 commit de37eca

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

Dockerfile_hub

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM jupyterhub/jupyterhub:5
1+
FROM jupyterhub/jupyterhub:5.4
22

33
ARG HTTP_PROXY
44
ARG HTTPS_PROXY
@@ -97,7 +97,7 @@ RUN pip3 install --no-cache-dir setuptools wheel virtualenv cython netifaces
9797

9898
# jupyterhub stuff
9999
RUN pip3 install --no-cache-dir ipywidgets importlib_metadata jupyterhub-firstuseauthenticator dockerspawner jupyterhub-nativeauthenticator
100-
RUN pip3 install --no-cache-dir jupyterlab_widgets dask-labextension
100+
RUN pip3 install --no-cache-dir jupyterlab_widgets dask-labextension jupyter_contrib_nbextensions
101101
RUN pip3 install --no-cache-dir jupyterhub-firstuseauthenticator jupyterhub-systemdspawner jupyterhub-jwtauthenticator jupyterhub-client jupyterhub-kerberosauthenticator --ignore-installed PyYAML
102102
RUN pip3 install --no-cache-dir jupyterhub-ldapauthenticator jupyterhub-nanowireauthenticator jupyterhub-kubespawner jupyterhub-idle-culler
103103

@@ -107,8 +107,7 @@ RUN mkdir -p /home/jovyan/scratch
107107
RUN chmod -R 777 /home/jovyan/scratch
108108
RUN chmod g+s /home/jovyan/scratch
109109

110+
RUN chown -R 1000:1000 /srv/jupyterhub
111+
110112
# copy scripts and config files
111113
COPY config/jupyterhub_config.py /etc/jupyterhub/
112-
113-
ENV NB_UID=1000
114-
USER $NB_UID

Dockerfile_singleuser

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM jupyterhub/singleuser:5
1+
FROM jupyterhub/singleuser:5.4
22

33
ARG HTTP_PROXY
44
ARG HTTPS_PROXY
@@ -249,4 +249,4 @@ RUN echo "cd /home/jovyan/work" >> /home/jovyan/.bashrc
249249
# Configure container startup
250250
ENTRYPOINT ["tini", "-g", "--"]
251251

252-
CMD ["jupyterhub-singleuser"]
252+
CMD ["start-singleuser.py"]

config/jupyterhub_config.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class LocalNativeAuthenticator(NativeAuthenticator, LocalAuthenticator):
2424
# jupyter/docker-stacks *-notebook images as the Docker run command when
2525
# spawning containers. Optionally, you can override the Docker run command
2626
# using the DOCKER_SPAWN_CMD environment variable.
27-
SPAWN_CMD = os.environ.get("DOCKER_SPAWN_CMD", "start-singleuser.sh")
27+
SPAWN_CMD = os.environ.get("DOCKER_SPAWN_CMD", "start-singleuser.py")
2828

2929
# Connect containers to this Docker network
3030
# IMPORTANT, THIS MUST MATCH THE NETWORK DECLARED in "services.yml", by default: "cogstack-net"
@@ -65,7 +65,7 @@ class LocalNativeAuthenticator(NativeAuthenticator, LocalAuthenticator):
6565
os.environ["http_proxy"] = ""
6666
os.environ["https_proxy"] = ""
6767

68-
c: Config = get_config() #noqa
68+
c: Config = get_config()
6969

7070
# Spawn containers from this image
7171
# Either use the CoGstack one from the repo which is huge and contains all the stuff needed or,
@@ -207,8 +207,12 @@ def per_user_limit(role):
207207

208208
# set DockerSpawner args
209209
c.DockerSpawner.extra_create_kwargs = {"user": "root"}
210-
c.DockerSpawner.cmd = [SPAWN_CMD] if isinstance(SPAWN_CMD, str) else SPAWN_CMD
210+
c.DockerSpawner.args = [
211+
"--allow-root",
212+
"--NotebookApp.token=''",
213+
]
211214

215+
c.DockerSpawner.cmd = [SPAWN_CMD] if isinstance(SPAWN_CMD, str) else SPAWN_CMD
212216

213217
c.DockerSpawner.notebook_dir = NOTEBOOK_DIR
214218

@@ -277,20 +281,20 @@ def per_user_limit(role):
277281
c.FirstUseAuthenticator.create_users = True
278282
c.JupyterHub.authenticator_class = "firstuseauthenticator.FirstUseAuthenticator"
279283

280-
281-
282284
# User containers will access hub by container name on the Docker network
283285
c.JupyterHub.ip = "0.0.0.0"
284286
c.JupyterHub.hub_ip = "0.0.0.0"
285287
c.JupyterHub.hub_connect_ip = HUB_CONTAINER_IP_OR_NAME
286288

287-
288289
jupyter_hub_port = int(os.environ.get("JUPYTERHUB_INTERNAL_PORT", 8888))
289290
jupyter_hub_proxy_api_port = int(os.environ.get("JUPYTERHUB_INTERNAL_PROXY_API_PORT", 8887))
290291
jupyter_hub_ssl_port = int(os.environ.get("JUPYTERHUB_SSL_PORT", 443))
291292
jupyter_hub_proxy_url = str(os.environ.get("JUPYTERHUB_PROXY_API_URL", "http://127.0.0.1:"))
292293

293294
c.ConfigurableHTTPProxy.api_url = jupyter_hub_proxy_url + str(jupyter_hub_proxy_api_port)
295+
# c.JupyterHub.hub_connect_url = f"https://{HUB_CONTAINER_IP_OR_NAME}:{jupyter_hub_ssl_port}"
296+
# c.DockerSpawner.hub_connect_url = c.JupyterHub.hub_connect_url
297+
294298
# ideally a private network address
295299
# c.JupyterHub.proxy_api_ip = "10.0.1.4"
296300
# c.JupyterHub.proxy_api_port = jupyter_hub_proxy_api_port

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ wheel==0.45.1
22
virtualenv==20.31.2
33
ipywidgets==8.1.7
44
jupyter==1.1.1
5+
jupyterlab==4.4.10
56
jupyterlab_widgets==3.0.15
67
jupyter_contrib_core==0.4.2
78
jupyter_contrib_nbextensions==0.7.0

0 commit comments

Comments
 (0)