Skip to content

A containerization example that takes a interactive visualization in a Jupyter notebook and turns it in to a containerized web server

License

Notifications You must be signed in to change notification settings

carl-drews/nbviz-to-container

 
 

Repository files navigation

nbviz-to-container

A containerization example that takes a interactive visualization in a Jupyter notebook and turns it in to a containerized web server

Workshops

Hybrid workshops were held to go over the content contained in this repository.

The first workshop was held on June 20th, 2024. To watch a recording of that workshop, see Tutorial: From Jupyter Notebook to Web Server: Containerizing Interactive Visualizations. The content covered during that workshop is captured in the walkthrough.ipynb file in the June-20-2024 directory in this repository.

A second workshop is going to be held on August 8th, 2024. For additional details on that workshop, see From Jupyter Notebook to Web Server: Automating Container Deployments with GitHub Actions.The content that will be covered during that workshop is captured in the walkthrough.ipynb file in the August-08-2024 directory in this repository.

Prerequisites

Note: If Docker is already installed there is a container image available that contains everything else

In order to work through this example on your local machine make sure you have installed the following programs:

Notebook Example

Creating an interactive visualization in a container

For an interactive example that takes an existing notebook and creates a web server running in a container to display an interactive visualization, see the walkthrough.ipynb file located in the June-20-2024 directory.

Automating container builds and deployments

For an interactive example that takes a container image file and automates building an image from it while updating an actual deployment configuration to use the new image, see the walkthrough.ipynb file located in the August-08-2024 directory.

How to get started

Note: There is a section on creating a GitHub Action to build the container and push it to Docker Hub. This requires a GitHub account, a Docker Hub account, and for the example repository to be forked.

Via Docker

There is a container image available that contains all the prerequisites. Please note it is run via Docker, but only Podman is available to build inside the container.

docker run --privileged -p 8888:8888 docker.io/ncote/podman-notebook:2024-06-20 jupyter lab --ip 0.0.0.0

When it starts there will be a link displayed that starts with http://127.0.0.1:8888/lab?token=. This link must be used to launch the application as it contains a required security token. Once inside the Jupyter Lab session this repository, or a forked version, needs to be cloned. This can be done via the Terminal included in Jupyter Lab or via an extension. More information on how to use the Git extension can be found at this link to jupyterlab-git GitHub. Once the repository contents have been added open the nbviz-to-container directory and the walkthrough.ipynb to follow the rest of the content.

Via personal computer

Run the following in a terminal/command line. Use the Operating Systems search function to look for terminal if this is unfamiliar.

git clone https://github.com/NicholasCote/nbviz-to-container.git

The best way to run the content is inside a Jupyter environment. Jupyter Lab is more robust than Notebook, but either can be used. Change the directory to be inside the git repository

cd nbviz-to-container

jupyter lab walkthrough.ipynb

This should start a Jupyter Lab session with the walkthrough notebook which can be used to ensure the perquisites that haven't been used yet are installed prior to starting the content.

Note: If additional software is required after Jupyter Lab is started it may need to be restarted in a new terminal session to make sure it can use the newly installed applications.

About

A containerization example that takes a interactive visualization in a Jupyter notebook and turns it in to a containerized web server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 97.7%
  • Dockerfile 1.2%
  • Other 1.1%