Rstudio Server app using non-local R

Hello,

I’ve gotten a OOD RStudio Server app to work that is completely container based (i.e. R and RStudio Server were installed into the Singularity container) however I was hoping to deploy a RStudio Server app that uses a centrally installed R-- one that is installed on our compute cluster and managed via lmod-- with RStudio Server locally installed on the compute node. The instructions here

suggest that R should be locally installed on the compute node; other example RStudio Server apps I’ve seen seem to install R into the container. In my first attempt I simply changed

setenv(“SINGULARITY_BINDPATH”,"/etc,/media,/mnt,/opt,/srv,/usr,/var")

to

setenv(“SINGULARITY_BINDPATH”,"/etc,/media,/mnt,/opt,/srv,/usr,/var,/nas")

in my rstudio container module file; /nas is where we install the research applications (such as R) used on our cluster which are managed using lmod. Then in script.sh.erb I
load the appropriate R module and the rstudio container module:

module load r/4.0.1
module load rstudio_singularity/0.0.1

When I run a single instance of this app it runs fine but if I simultaneously start a separate second OOD session using this app the second session throws the below error upon start up. Not only this but as soon as I exit the second session the the first session, which started up and ran normally, starts throwing error messages as well. I’ve noticed this behavior when the OOD sessions are each running on different compute nodes or the same one. RStudio Server is locally installed on each compute node.

I’m wondering if deploying a RStudio Server app this way should work? I.e. with a locally installed RStudio Server but a centrally installed version of R accessed via a module file.

Thanks,
Sandeep

We run the OOD RStudio Server app with RStudio Server 1.3.### and R 4.## both installed in a central NFS mount across the cluster. We then use module files to load both at run time. Some details of our installation are here, https://github.com/mcw-rcc/bc_rcc_rstudio_server.

For reference, we previously used Singularity to run RStudio Server because older versions didn’t allow for multiple sessions on the same compute node. More recently in version 1.3.###, the RStudio devs added some extra rserver options to fix this issue.

Great this was really helpful! We were using an older version of rstudio server so that might have been part of the problem before.

Being able to have a module for rstudio server as is better for us. I tried out your implementation, using rstudio-server-rhel-1.2.5033-x86_64, and when I connect to RStudio Server I get asked for login credentials (see below).

When I ssh into the compute node the RStudio Server session is running on I see a

/tmp/tmp.wDMIURY69Z/rstudio-server/secure-cookie-key

file. When I enter in the key in the above file along with my user id I can’t get logged in (not that I want to have to log in this way but thought I’d give it a try). Did you have the problem of being prompted for credentials when connecting to the RStudio Server session? Not sure why this is happening.

Your auth script probably needs updating. It should match this:

#!/usr/bin/env bash

# Confirm username is supplied
if [[ $# -lt 1 ]]; then
  echo "Usage: auth USERNAME"
  exit 1
fi
USERNAME="${1}"

# Confirm password environment variable exists
if [[ -z ${RSTUDIO_PASSWORD} ]]; then
  echo "The environment variable RSTUDIO_PASSWORD is not set"
  exit 1
fi

# Read in the password from user
read -s -p "Password: " PASSWORD
echo ""

if [[ ${USERNAME} == ${USER} && ${PASSWORD} == ${RSTUDIO_PASSWORD} ]]; then
  echo "Successful authentication"
  exit 0
else
  echo "Invalid authentication"
  exit 1
fi

Note the change from -ne to -lt in the first function.

Awesome that solved the problem. Thanks so much again! I really appreciate it.