Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lsloan/c4cb42284a36cc8e826f3b6035f77ae4 to your computer and use it in GitHub Desktop.
Save lsloan/c4cb42284a36cc8e826f3b6035f77ae4 to your computer and use it in GitHub Desktop.
## Initial setup you should only have to do this once
# Checkout docker stacks project
git clone https://github.com/jupyter/docker-stacks
cd docker-stacks/base-notebook
# Clone the telemetry in this directory, this is currently a private repo.
git clone https://github.com/educational-technology-collective/hwf-jupyterlab-telemetry
# git needs to be added to base image
sed -i '' 's/ca-certificates/ca-certificates git/g' Dockerfile
# Build and tag this image
docker build . -t base-notebook
# Remove it if it already exists
docker rm base-notebook
# Run the base-notebook adding in the telemetry
docker run --name base-notebook -v "$(pwd)"/hwf-jupyterlab-telemetry:/home/jovyan/hwf-jupyterlab-telemetry:z -p 8888:8888 base-notebook start-notebook.sh --autoreload
###### END OF INITIAL SETUP
## You may have to do these steps below each time you need to re-create the container
# If you just stop the container you can start it with
# docker start base-notebook -a
# TODO: Create a new Dockerfile that extends this one and adds this telemetry?
# Not sure how auto reload works yet
# Install telemetry now (could be in an earlier phase)
docker exec -it base-notebook /bin/bash
# Build the extension, this will take a few minutes
cd hwf-jupyterlab-telemetry && pip install . && jupyter labextension develop . --overwrite && npm install typescript && npm run build
# Copy the URL that's in the window, use the 127.0.0.1 one and go to that!
# After doing this go to /lab (You have to do the copy/paste for the token first)
http://127.0.0.1:8888/lab
# Click the puzzle piece icon on the left and click enable
# The code is currently hardcoded to use lti.tools to capture events, you can see them there
https://lti.tools/caliper/event?key=hwf-jupyter&limit=0
# TODO: Document how to re-build/reload. Since this directory is mounted it probably just involves doing the step again to build the extension
@lsloan
Copy link
Author

lsloan commented May 24, 2021

For the docker run command (line 20), include the --env JUPYTER_ENABLE_LAB=yes argument to start JupyterLab by default. Then it won't be necessary to go into Jupyter Notebook first, followed by editing the URL to access JupyterLab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment