Proxy Web Apps
Contents
Proxy Web Apps#
You can host many web applications by running them on the command line and then accessing them through the jupyter-proxy plugin.
Underneath the hood we are using the Jupyterhub Proxy Plugin in order to access web applications through jupyterhub.
Before we start you’ll need your:
Jupyterhub URL - copy and paste this from the browser
The service prefix, if any
Your username
env |grep JUPYTERHUB_SERVICE_PREFIX
env |grep JUPYTERHUB_BASE_URL
Proxy URLs#
The official docs. Many docs are embedded directly from the source docs.
Starting and Proxying Processes#
Accessing Arbitrary Ports#
More Examples#
Typically, you can grab the url from your browser.
For example, the URL for this browser is:
https://jhub1.bioanalyzedev.io/user/jillian/lab/tree/bioanalyze-hpc/docs/web-apps/proxy-web-apps.md
The base jupyterhub url is:
https://jhub1.bioanalyzedev.io/user/jillian/
The proxy path is:
https://jhub1.bioanalyzedev.io/user/jillian/proxy/${PORT}/
Gotchas#
You always want to make sure that you’re serving your application from 0.0.0.0
, not localhost. Usually this option is available through the CLI to run the program either as --host
or --ip
.
Example - ExCellxGene#
Let’s proxy the ExCellxGene in Jupyterhub.
Excellxgene needs to be installed to it’s own conda environment because it doesn’t play nice with the existing conda env.
Grab the
excellxgene-environment.yaml
from this repo.Create the excellxgene environment
Register the excellxgene environment as a Python Kernel.
git clone https://github.com/dabble-of-devops-bioanalyze/single-cell-saturn-cloud
git clone https://github.com/scverse/scanpy-tutorials
cd single-cell-saturn-cloud
mamba env create -f ./excellxgene-environment.yaml -p ~/.conda/envs/excellxgene
source activate conda activate excellxgene
If you are running on a local system or BioAnalyze HPC I recommend using these settings.
Now that we have some data let’s visualize some clusters!
git clone https://github.com/czbiohub/excellxgene
cd excellxgene
cd example-dataset
wget https://raw.githubusercontent.com/dabble-of-devops-bioanalyze/single-cell-saturn-cloud/main/prepare.py
source activate excellxgene
python ./prepare.py pbmc3k.h5ad --output ./pbmc3k-preprocessed.h5ad --overwrite
Launch the ExCellxGene Web App#
excellxgene launch --host 0.0.0.0 --port 8000 ./pbmc3k-preprocessed.h5ad
The proxy path is:
https://{JHUB_URL}/user/${USERNAME}/proxy/${PORT}/