Skip to content

Instantly share code, notes, and snippets.

@jonespm
Last active May 24, 2021 18:45
Show Gist options
  • Save jonespm/791eb71984fbc2d10e444aae8853fb0a to your computer and use it in GitHub Desktop.
Save jonespm/791eb71984fbc2d10e444aae8853fb0a 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 && jupyter serverextension enable hwf-jupyterlab-telemetry
# 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. This may have changed and is a WIP.
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

lsloan commented May 20, 2021

I'd not gotten quite that far.

I had created a short docker-compose.yaml (https://gist.github.com/lsloan/e6ba9bdca5363f88ccf2738cdf586de9).

My next step was going to be trying the install steps.

@lsloan
Copy link

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