# Notebooks Hub Compose This section documents the local deployment for the Notebooks Hub application using [Docker Compose](https://docs.docker.com/compose/), including the mongo database, the API, the UI, and Jupyterhub. | Launch Mode | Description | | ----------- | ----------- | | node | install node modules in preparation for dev mode | | conda | install default jupyter kernel for LMOD | | runtime | launch notebooks hub from remote dockerhub | | dev | launch notebooks hub from local filesystem with file watching | ## Launch Mode - Runtime This mode runs the the Notebooks Hub ecosystem with latest API and UI images pulled from our PolusAI Docker Hub. If necessary, a specific application version can be run by modifying the following environment variables in the [.env](../../../deploy/Compose/.env) file. - UI_IMAGE_VERSION - API_IMAGE_VERSION ### Pre-Launch Steps First, ensure that Docker [Docker Desktop](https://www.docker.com/products/docker-desktop/) is running. Then verify Dockerhub access to the [polusai organization](https://hub.docker.com/?namespace=polusai), and login to Docker using `docker login` or via the Docker Desktop sign in button. Install default Jupyter kernel using conda via launch script (Optional). Collecting the initial package data takes 2-5 minutes before logging in the console begins. ``` ./launch-notebooks-hub.sh -m conda ``` ### Launch Action launch notebooks hub in runtime mode ``` ./launch-notebooks-hub.sh -m runtime ``` ## Launch Mode - Dev This mode runs the the Notebooks Hub ecosystem with API and UI images built from local files and include a file watch that update the application automatically as code is modified. ### Pre-Launch Steps Set necessary environment variables in the [.env](../../../deploy/Compose/.env) file. Set the Npm authentication token for local development with the automation type. ``` NPM_AUTOMATION_TOKEN= ``` Install node modules via launch script. ``` ./launch-notebooks-hub.sh -m node ``` Install default Jupyter kernel using conda via launch script (Optional). Collecting the initial package data takes 2-5 minutes before logging in the console begins. ``` ./launch-notebooks-hub.sh -m conda ``` ### Launch Action Launch notebooks hub in file watch developer mode. ``` ./launch-notebooks-hub.sh -m dev ``` Sync the shared modules by running the following curl request in your terminal. ``` curl --location --request PUT 'http://127.0.0.1:8002/modules' --data '' ``` Note: The launch takes a moment. Please wait until you see the following in your terminal: "Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/" ## Post-Launch Steps The localhost ports for each application can be referenced below: - [Jupyterhub](http://localhost:8000) - [Notebooks Hub UI](http://localhost:4200) - [Notebooks Hub API](http://localhost:8002) - Login with the default local user (polus@example.com) in Jupyterhub, configurable in the [.env](../../../deploy/Compose/.env) file via the JUPYTERHUB_USER variable. No password is required. - Login to Polus Notebooks Hub Stop the application by navigating to the Compose folder and running the following command ``` docker compose -p notebooks-hub down ``` ## General FAQ | Question | Answer | | ----------- | ----------- | | How to auto-install a new module? | A new module can be auto-installed by changing the file name from [default-env.yaml](Compose/Volumes/modules/shared/default-env.yaml) to your name of choice, while also changing the internal module name and modifying the dependencies before re-launching with the launch script. | | How does authentication work for this implementation? | This installation implements a no-auth-flow and can be run fully offline when the necessary. | | What does the down command do? | When running the `docker compose -p notebooks-hub down` command to remove the notebooks hub deployment, some named Jupyter containers may have to be manually deleted after being orphaned, and external volumes are not deleted until the next launch. | | Are there configurable environment variables? | Yes, you can navigate to the [.env](../../../deploy/Compose/.env) file to update variables such as the Jupyter User.