Running RStudio Server

RStudio Server, a web-based integrated development environment, comes in both Open Source and RStudio Workbench editions. RStudio Server Open Source is distributed under the GNU Affero General Public License (AGPL), while RStudio Workbench requires a commercial license for organizations that are not able to use AGPL software. It comes with official support from RStudio, PBC and many additional enterprise features.

In this tutorial, we demonstrate how to get started with RStudio Server Open Source edition on the DNAnexus platform if your use case satisfies the terms of AGPL.

From the project you wish to work in, launch the ttyd app (Platform account needed for login) from the CLI or the web interface. The port input argument of the ttyd app should be set to port 8080 using a high priority instance using web UI or the CLI command below:

local-laptop$ dx run app-ttyd -iport=8080 --priority high -y

The ttyd shell will appear on port 8080 of the Worker URL, leaving port 443 for the RStudio Server Open Source application. Then, go to the web interface, and from the Monitor tab of your project, find the ttyd job and the corresponding Worker URL. Replace "cloud/" in the "https://job-xyz.dnanexus.cloud/" Worker URL with "cloud:8080/" to access the ttyd shell.

Start RStudio from the ttyd shell by typing:

root@job-G590YB80Qb874V5J4Q340fkG:~# docker run \
  -p 443:8787  \
  -v /mnt/project/:/mnt/project \
  -v /home/dnanexus:/home/rstudio/dnanexus \
  -e DISABLE_AUTH=true \
  --detach \
  rocker/rstudio:4.1.0

You can now access RStudio IDE at the Worker URL (e.g. "https://job-xyz.dnanexus.cloud/"). All ports exposed by the ttyd app are automatically authenticated using DNAnexus Platform credentials, so we have disabled additional RStudio authentication by passing the DISABLE_AUTH environment variable to docker runon line 6 above.

The -v arguments on lines 3 and 4 in the docker run command specify bind mounts that can be used to transfer files between the DNAnexus project and the RStudio environment. For example, files created under the /home/rstudio/dnanexus folder in the RStudio container can be uploaded to the DNAnexus project by invoking dx upload from the ttyd shell. Files from the DNAnexus project can be dx downloaded from the DNAnexus project in the ttyd shell and will be accessible inside the RStudio environment. Additionally, /mnt/project provides read-only FUSE-based access to the DNAnexus project files.

You can further customize your usage of RStudio Server on the DNAnexus platform by creating a standalone DNAnexus Web Applet as described here.

Last updated