Further development in continuing here: https://github.com/MonashBioinformaticsPlatform/rocker-ultra
This is an attempt 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.
Loosely based on https://www.rocker-project.org/use/singularity/.
By default uses a custom image based on rocker/rstudio
but with Seurat dependencies pre-installed.
Run:
# Download the rstudio.sh script from this gist
wget https://gist.githubusercontent.com/pansapiens/b46071f99dcd1f374354c1687f7a986a/raw/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
(pansapiens/rocker-seurat:4.1.1-4.0.4
) that has the Seurat package and require dependencies pre-installed.
Now some very specific instructions, for users of the M3 / MASSIVE HPC cluster
You should run your RStudio session on a compute node, via a SLURM job submission, then SSH tunnel to that compute node.
Just commandline, without using ~/.ssh/config
:
# on login node, in tmux/screen (or adapt to sbatch)
srun --mem=1G --time=0-12:00 --job-name=my-rstudio ./rstudio.sh
# once running, find out which compute node it's on with squ or similar
squeue | grep my-rstudio
# we will use m3a002 in this example
# on you local machine
ssh -i ~/.ssh/m3 -J [email protected] -L 8787:localhost:8787 username@m3a002
# open the URL http://localhost:8787 in the browser on your laptop
OR, using the convenience of ~/.ssh/config
:
# ~/.ssh/config
Host m3
HostName m3.massive.org.au
User my_m3_username
IdentityFile ~/.ssh/m3
ForwardAgent yes
LocalForward 8787 127.0.0.1:8787
# Other host wildcards may need to be added here over time
Host m3a* m3b* m3c* m3d* m3e* m3f* m3g* m3h* m3i* m3j*
User my_m3_username
IdentityFile ~/.ssh/m3
ProxyJump m3
LocalForward 8787 127.0.0.1:8787
Then just ssh -i ~/.ssh/m3 username@m3a002
to the compute node from your laptop, and open https://localhost:8787 in your browser.