RStudio server and Shiny server

I would like to install the open source version of RStuio server in a LINUX remote machine that I can access through windows PC. Additionally, I would like to install Shiny server. Could you please tell me how should RStudio server be installed with Shiny server? Is Shiny server a package that I can install once I have RStudio server installed or does Shiny require its own server?

They have to be installed separately. If you want to access them both from the same port, you will likely have to set up a reverse proxy. I would recommend nginx, unless you already have a different web server set up on that machine that you want to use.

1 Like

Thank you! Do I have to do any thing to integrate RStudio with Shiny? I am going to create a GUI for an existing R program and there will be event listening.

Hi @giuseppa.cefalu, you can install both RStudio Server and Shiny Server in the same box. Shiny will be available in port 3838 by default, and RStudio will be available in port 8787. If you haven't used RStudio Server, the web interface looks just like the RStudio installed in your laptop. I have a step-by-step tutorial in my blog that may be of help, it also shows you a technique to publish your apps into Shiny, it is focused on AWS, so you can skip the EC2 setup steps if you have a local box you're going to work on: https://www.edgarsdatalab.com/2016/08/25/setup-a-shiny-server-in-aws/

5 Likes

Thank you Edgar! To make sure I understand correctly, Shiny server interacts with RStudio server. RStudio server does the statistical analysis while Shiny server allows me to write the GUI that interacts with RStudio server code. Afterwrads, I host the entire application into Shiny. Is this correct?

So, there's a shiny R package that let's us create apps. The analysis and the apps are developed, in this case, inside the RStudio Server IDE, using the shiny package and whatever other packages needed for the analysis. The Shiny Server is then used to deploy the app. These two particular Server product do not interact, the way you deploy an application is by taking the Shiny app you developed in the RStudio IDE and copying it into the appropriate folder inside Shiny Server. Hope this helps.

2 Likes

Thanks again Edgar! This is great and it helps.

The R program we have calls other open source proteomics programs. These programs are installed in the scientists PCs and we were wondering if we could install the main R program in the server and leave the other programs in the PC. Will the R application be able to find the paths of the PC programs while running in the server?

I have installed RStudio server to Ubuntu 17.10 running on the virtual player. The installation went well and there were not any error, however I cannot access the web site at http<hostname -I>:8787. Do you have any sugestions.

This are the commands I used in order to install RStudio:
sudo apt-get install gdebi-core libapparmor1
wget http://download2.rstudio.org/rstudio-server-0.98.1091-amd64.deb
sudo gdebi rstudio-server-0.98.1091-amd64.deb

At this point I should be able to access RStudio on the web, but it is nopt working.

Yes, I believe that you'll need to "forward" the Virtual Machine's 8787 port to a port in your machine. I usually use my laptop's 8787 port, so I can access RStudio using 127.0.0.1:8787. Here's a how-to forward the port from I found from a quick search: https://www.howtogeek.com/122641/how-to-forward-ports-to-a-virtual-machine-and-use-it-as-a-server/

Hi Edgar,

The R program that I am going to use RStuido server calls/executes OpenMS. The only version of Linux in which I can install OpenMS is Ubuntu 17.04. I read in the download page that in order to use the Linux version of RStudio server I have to install ubuntu 12.04 (or higher). Also RStudio server only runs on linux and not in windows. Is Ubuntu 17.04 a higher version than Ubuntu 12.04? In other words can I install RStudio in ubuntu 17.04?

Thanks

Hi @giuseppa.cefalu, in short yes, RStudio should work on Ubuntu v17.04

1 Like

Thank you very much.

Hello Edgararuiz,

So Is the shiny server dependent on RStudio server??Without RStudio server, shiny server cannot run an app right?

Sorry, I do not understand.

Hi, there is a separate product called Shiny Server that can serve your apps without the need to use the IDE

1 Like

Yes, In know, but I like the IDE for development. I will deploy my app. using the Sniny Server.
On the mean time, could you please help me with this issue?

I have written utilities. R in utilityFoler which is a subfolder in my working directory.

checkParams <- function(PARAMSfullFile = NULL){
params = PARAMSfyllFile
return(params)
 

  
}

I have a utility function outside the server function and outside the UI function which is calls the checkPARAMS function and sends the filename

glycoPipe <- function(filename){

  pass <- checkParams(filename)

}

I am working from the getwd() directory and I sourced the file using
source("utilityFoler/utilities.R", local = TRUE)
I can get the returned value of pass, but I cannot get the value of the function parameter (filename) of the function. Am I doing any thing wrong?

I forgot to write the server function:
observeEvent(input$value,{
if(input$value == 'Y'){
inFileName = input$file$name
result <- glycoPipe("inFileName")
returnedValue = result$params
output$box <- renderText({
paste("Your result is", inFileName)
}
)
}
})

I just read that "name" returns the name of the file input by the browser. In my case, the file is selected from the file dialog and uploaded. How could I get the file name in this case?

So if i have a shiny server, then i do not necessarily have to use the RSTUDIO SERVER right? I can make code changes in the shiny server and run the app.