For security reasons, Domino workspace sessions are only accessible on one port. For example, Jupyter typically uses port 8888. When you launch a Jupyter workspace session, a Domino executor starts the Jupyter server in a Run, and opens port 8888 to serve the Jupyter application to your browser. If you used the Jupyter terminal to start another application on a different port, it would not be accessible.
Note
| Domino workspaces reserve port 80 for nginx and port 9000 for the executor. |
However, you might want to run multiple applications in the same workspace session. For example, you might want to:
-
Edit and debug Dash or Flask apps live.
-
Use Tensorboard to view progress of a live training job.
Domino supports this with Jupyter Server Proxy and JupyterLab.
By default, Domino standard environments have Jupyter Server Proxy installed. If you are not on the recent version of the Domino Standard Environment, use the following steps to install it in your Domino environment.
Add the following lines to your environment’s Dockerfile instructions.
USER root
# Install NodeJS
# You can omit this step if your environment already has NodeJS installed
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - &&
apt-get install nodejs -y &&
rm -rf /var/lib/apt/lists/*
# Install jupyterlab-server-proxy (omit if already installed)
RUN if [ -x /opt/conda/bin/conda ]; then
/opt/conda/bin/conda install -y -c conda-forge jupyter-server-proxy;
else
pip install --no-cache-dir jupyter-server-proxy;
fi
# Update JupyterLab config
RUN mkdir -p /home/ubuntu/.jupyterlab/ &&
echo "c.ServerProxy.servers = {" >> /home/ubuntu/.jupyterlab/jupyter_lab_config.py &&
echo " 'code': {" >> /home/ubuntu/.jupyterlab/jupyter_lab_config.py &&
# VS Code example. Replace this command with what you want to proxy to
echo " 'command': ['code-server', '--port', '{port}', '--auth', 'none']" >> /home/ubuntu/.jupyterlab/jupyter_lab_config.py &&
echo " }" >> /home/ubuntu/.jupyterlab/jupyter_lab_config.py &&
echo "}" >> /home/ubuntu/.jupyterlab/jupyter_lab_config.py
USER ubuntu
It can be accessed via a URL in the form: https://your-domino-url/project-owner/project-name/notebookSession/run-ID/proxy/app-port/ This URL can be generated using Domino environment variables as follows:
echo -e "import os\nprint('https://your-domino-url/{}/{}/notebookSession/{}/proxy/8501/'.format(os.environ['DOMINO_PROJECT_OWNER'], os.environ['DOMINO_PROJECT_NAME'], os.environ['DOMINO_RUN_ID']))" | python3
Ensure you change the your-domino-url
and port number to match your deployment and app.