Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker distribution #410

Open
almereyda opened this issue May 13, 2024 · 6 comments
Open

Docker distribution #410

almereyda opened this issue May 13, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@almereyda
Copy link

almereyda commented May 13, 2024

Problem

Wanting to create a new JupyterLab on Jupyverse instance, passing by the conversation in #301, I've found a nice example on how to run the authentication dependency Fief through Docker Compose.

As a Jupyverse user, I am now left to imagine the same for it.

Proposed Solution

Add a section about running Jupyverse in a container to the documentation page

Additional context

This assumes the existence of an example Container image capable of running the Jupyverse collaboration server, best enriched with a useful Compose environment.

JupyterLab has top-level support from Docker, as seen in the official guide Data science with JupyterLab | Docker Docs.

Jupyverse should be similarly easy to employ as the jupyter/docker-stacks.

@almereyda almereyda added the enhancement New feature or request label May 13, 2024
Copy link

welcome bot commented May 13, 2024

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@davidbrochart
Copy link
Collaborator

Thanks for opening an issue @almereyda.
Would you like to contribute with this enhancement to the documentation?

@almereyda
Copy link
Author

Right at it.

@davidbrochart
Copy link
Collaborator

Awesome, looking forward to it 🎉

@almereyda
Copy link
Author

almereyda commented May 13, 2024

I was able to run Jupyverse with this patch

diff --git a/images/base-notebook/Dockerfile b/images/base-notebook/Dockerfile
index 07903b94..b05aad79 100644
--- a/images/base-notebook/Dockerfile
+++ b/images/base-notebook/Dockerfile
@@ -42,8 +42,10 @@ RUN mamba install --yes \
     'jupyterlab' \
     'notebook' \
     'jupyterhub' \
-    'nbclassic' && \
-    jupyter server --generate-config && \
+    'nbclassic' \
+    'jupyverse' \
+    'fps-auth' \
+    'fps-jupyterlab' && \
     mamba clean --all -f -y && \
     npm cache clean --force && \
     jupyter lab clean && \
@@ -51,6 +53,12 @@ RUN mamba install --yes \
     fix-permissions "${CONDA_DIR}" && \
     fix-permissions "/home/${NB_USER}"
 
+RUN pip install --user -U \
+                https://github.com/jupyterlab/jupyter-collaboration/releases/download/v3.0.0alpha2/jupyter_collaboration-3.0.0a2-py3-none-any.whl \
+                https://github.com/jupyterlab/jupyter-collaboration/releases/download/v3.0.0alpha2/jupyter_collaboration_ui-1.0.0a2-py3-none-any.whl \
+                https://github.com/jupyterlab/jupyter-collaboration/releases/download/v3.0.0alpha2/jupyter_docprovider-1.0.0a2-py3-none-any.whl \
+                https://github.com/jupyterlab/jupyter-collaboration/releases/download/v3.0.0alpha2/jupyter_server_ydoc-1.0.0a2-py3-none-any.whl
+
 ENV JUPYTER_PORT=8888
 EXPOSE $JUPYTER_PORT
 
diff --git a/images/base-notebook/start-singleuser.py b/images/base-notebook/start-singleuser.py
index c80339f5..2d85f780 100755
--- a/images/base-notebook/start-singleuser.py
+++ b/images/base-notebook/start-singleuser.py
@@ -6,11 +6,30 @@ import shlex
 import sys
 
 # Entrypoint is start.sh
-command = ["jupyterhub-singleuser"]
+command = ["jupyverse"]
 
-# set default ip to 0.0.0.0
-if "--ip=" not in os.environ.get("NOTEBOOK_ARGS", ""):
-    command.append("--ip=0.0.0.0")
+# set default listening host to 0.0.0.0
+if "--host=" not in os.environ.get("NOTEBOOK_ARGS", ""):
+    command.append("--host=0.0.0.0")
+
+# set default host port to 8000
+if "--port=" not in os.environ.get("NOTEBOOK_ARGS", ""):
+    command.append("--port=8000")
+
+# set default jupyterlab.server_side_execution to true
+if "jupyterlab.server_side_execution=" not in os.environ.get("NOTEBOOK_ARGS", ""):
+    command.append("--set")
+    command.append("jupyterlab.server_side_execution=true")
+
+# set default kernels.require_yjs to true
+if "kernels.require_yjs=" not in os.environ.get("NOTEBOOK_ARGS", ""):
+    command.append("--set")
+    command.append("kernels.require_yjs=true")
+
+# set default auth mode to noauth
+if "auth.mode=" not in os.environ.get("NOTEBOOK_ARGS", ""):
+    command.append("--set")
+    command.append("auth.mode=noauth")
 
 # Append any optional NOTEBOOK_ARGS we were passed in.
 # This is supposed to be multiple args passed on to the notebook command,

on top of jupyter/docker-stacks@996fae12 with these commands:

cd  images/base-notebook
podman build --format docker -t jupyverse .
podman run --rm -it -e NOTEBOOK_ARGS="--set auth.mode=token" -p 8000:8000 jupyverse start-singleuser.py

While it was possible to create and save a notebook which returned upon reopening, it was not possible to replicate server side execution.

Needs further investigation.

@almereyda
Copy link
Author

almereyda commented May 13, 2024

The installation of the collaboration features should probably be their own FROM: overlay, plus the addition of the two associated --set parameters/of the different entrypoint.

Also I was unsure which entrypoint to apply, both start-notebook.py and start-singleuser.py didn't really fit, other than for the default --auth.mode=noauth mode. Should we delete both and start anew with start-jupyverse.py?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants