Containerised RStudio with bells+whistles for HPC and everywhere
rocker-ultra
aims to simplify launching an RStudio server in Singularity with a single wrapper script,
with managment of package directories per-version in your home directory, auto-free port finding,
per-session password generation and SSH port forwarding instructions for free. It is based on the
containers developed by the
rocker project (but not affiliated).
By default rocker-ultra
uses a custom image based on rocker/rstudio
but with Seurat
dependencies pre-installed.
Run:
# Download the `rstudio.sh` from this repo
wget https://raw.githubusercontent.com/MonashBioinformaticsPlatform/rocker-ultra/main/rstudio.sh
chmod +x ./rstudio.sh
./rstudio.sh
It may take some time to download images. Eventually you'll be presented with instructions to login, including a generated password, eg
INFO: Creating SIF file...
INFO: Build complete: rstudio_3.6.0.sif
Finding an available port ...
Got one !
On you local machine, open an SSH tunnel like:
ssh -N -L 8787:localhost:8787 [email protected]
or
ssh -N -L 8787:localhost:8787 [email protected]
Point your web browser at http://localhost:8787
Login to RStudio with:
username: myusername
password: Y9qmTCxlM30ArhY7biC5
Protip: You can choose your version of R from any of the tags listed here: https://hub.docker.com/r/rocker/rstudio/tags
and set the environment variable IMAGE, eg
IMAGE=rocker/rstudio:3.5.3 rstudio.sh
Starting RStudio Server (R version 3.6.0)
If you'd like to select your R version, set the IMAGE
environment variable like this:
IMAGE=rocker/rstudio:3.5.3 ./rstudio.sh
As long as there is a corresponding versioned container provided by Rocker, most common R versions should work.
Note that by default the script uses a custom image based on rocker/rstudio
that has the Seurat package and required dependencies pre-installed.
You can find available versions under 'Packages' in the sidebar on Github (eg, the rocker-seurat releases).
Specific instructions for the M3 HPC site are here.
You probably don't need to build these containers yourself, since pre-built versions already exist on Dockerhub / Github Pacakges, and are automatically build via CI. However, you may want to build one to generate a custom version for some purpose.
For example:
REGISTRY="pansapiens"
VERSION_TAG="4.2.3-4.3.0"
docker build \
-t "${REGISTRY}/rocker-seurat:latest" \
-t "${REGISTRY}/rocker-seurat:${VERSION_TAG}" \
-f "dockerfiles/rocker-seurat/${VERSION_TAG}/Dockerfile" \
"dockerfiles/rocker-seurat/${VERSION_TAG}"
# Generate a Singularity image file
singularity build "rocker-seurat_${VERSION_TAG}.sif" "docker-daemon://${REGISTRY}/rocker-seurat:${VERSION_TAG}"
# Run with your custom Singularity image
IMAGE="./rocker-seurat_${VERSION_TAG}.sif" ./rstudio.sh
rocker-ultra
began with this gist