Skip to content

Jupiterlab Applications

This document explains how to install the JupiterLab package in your plexus applications and use it.

Note: Before continuing with this document, please read the Create Docker Applications article.

Create application

After reading the Create Docker Applications article, you will have enough knowledge to directly configure the application using the JupyterLab theme package provided by Plexus.

Additionally, you can add SSH connection to the container by installing the sshd service.

Configure Ports

This is an interactive application, so you need to configure it as a service and expose a set of ports.

  • JupiterLab: port 8888
  • SSH: port 22

Configure container

You need to configure a set of fields. Remember you need to read before the Create Docker Applications article.

Readiness probe

Configure the readiness script provided by the JupiterLab package: curl 0.0.0.0:8888.

Pre-runscript

First, it's necessary to add the script to configure the aac user, adjust its UID and GID based on host system values, ensure ownership of key directories, and declare the environment variables at the container level in /etc/bash.bashrc:

useradd aac
echo "aac:$PLEXUS_SECRET_KEY" | chpasswd
echo "USERNAME: aac"
echo "PASSWORD: $PLEXUS_SECRET_KEY"
usermod -aG sudo aac
if [ -n "$HOST_USER_ID" ] && [ -n "$HOST_GROUP_ID" ]; then
  groupmod -g $HOST_GROUP_ID aac
  usermod -u $HOST_USER_ID -g $HOST_GROUP_ID  aac
fi


export -p | grep -v "declare -x HOME" >> /etc/bash.bashrc

chown -R aac:aac /tmp
chown -R aac:aac /home/aac
chown -R aac:aac /opt/conda/ 
chown -R aac:aac /tmp
usermod --shell /bin/bash aac

Runscript

Plexus sets up JupyterLab package and exposes its configuration, including the secure access token, through the PLEXUS_SECRET_KEY environment variable.

The script performs the following tasks:

  • Start the SSH service.
  • Install JupyterLab version 4.2.5.
  • Launch JupyterLab with specified configurations, including token-based authentication, Bash terminal settings, and root access.
echo "Starting  SSH service"
apt update && apt-get install openssh-server -y && service ssh start 
echo "SSH service started"

pip install jupyterlab==4.2.5

jupyter lab --notebook-dir=/home/aac --ip 0.0.0.0 --no-browser --allow-root --NotebookApp.token=$PLEXUS_SECRET_KEY --NotebookApp.terminado_settings="{'shell_command': ['/bin/bash']}"

Application execution

Application can be executed in any queue with GPU available.

The available endpoints are displayed on the right side of the workload view.

Jupiterlab

  • Select the JupiterLab endpoint.
  • Copy secret key.
  • Click in connect.

Log in

Use the secret key to log in JupyterLab.

Browser

JupyterLab browser after log in.

SSH

Select the SSH endpoint

  • Click in connect.
  • Copy shell command and execute it in a terminal.
  • Use the password provided in the window.