Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Host App Shiny-server

I am trying to host an app over the web using R, shiny and shiny-server. As a preface, I have only used Linux OS (of any flavor) for a day-or-two and have no networking experience. So please bear with me. And I apologize in advance if I've overlooked something that is incredibly simple.

I followed the examples given in the links below to install Ubuntu 12.04, R (precise), shiny and shiny-server.

  • http://withr.me/blog/2013/07/23/configure-shiny-server-under-ubuntu/
  • https://github.com/rstudio/shiny-server/wiki/Ubuntu-step-by-step-install-instructions

All the commands execute fine with no complaints. Ubuntu appears to have installed fine. R runs fine. All the R libraries install. I can host shiny applications locally using runApp and runGist pointing to appropriate file locations.

As a test, I copy the shiny examples to shiny-server/www folders:

sudo cp -R /usr/local/lib/R/site-library/shiny/examples /var/shiny-server/www/

If I open R in the terminal, and run the following code. Things run fine.

runApp("/var/shiny-server/www/examples/01_hello/")

This time the app runs in http://localhost:4251/. One weird thing I notice is that if I quit R and run the same code in a new session, the app runs in a different "port" (i.e. not 4251). Maybe this is usual behavior in Ubuntu??? But coming from Windows I am used to the app always running in the same http://localhost:8100/.

Now when I try:

sudo start shiny-server. And try to open the same example over the web (i.e. not locally in R). One thing I notice is that the process always starts at a different "port". This time it is shiny-server start/running, process 4463. But this process number changes with every sudo start shiny-server and sudo stop shiny-server sequence. And is not 3838 like I would expect from the example documents cited above. Is this normal?

With the server started, if I try (replacing hostname with my IP address) to enter the following URL (in Firefox) I get:

  • http://<hostname>:3838/examples/ Results in "Page not found Error".
  • http://<hostname>:4463/examples/ Results in "Unable to Connect to Server Error"

Do the hints given above provide enough information for determining what I am doing wrong in setting up shiny-server?

Do I need other software/libraries installed besides Ubuntu 12.04, R, shiny, shiny-server, node.js, upstart script, etc. listed in the posts above?

I am running all of the above off a standalone desktop style machine, itself part of a larger Departmental network (at University). Is my departments network firewall, or my personal firewall blocking my access? How would I disable/adjust settings if this is the case in Ubuntu?

Really I'm a rookie and have no idea why it's not working, and would appreciate any help the group could provide. Thanks in advance, and below is the version of R, shiny and shiny-server I am using:

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
[3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
[5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
[7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
[9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rCharts_0.3.51 shiny_0.8.0   

loaded via a namespace (and not attached):
[1] bitops_1.0-6    caTools_1.16    digest_0.6.3    grid_3.0.2     
[5] httpuv_1.2.0    lattice_0.20-24 plyr_1.8        Rcpp_0.10.6    
[9] RJSONIO_1.0-3   tools_3.0.2     whisker_0.3-2   xtable_1.7-1   
[13] yaml_2.1.8

This is where/how I got shiny-server http://www.rstudio.com/shiny/server/install-opensource

like image 437
Chris Avatar asked Dec 04 '13 21:12

Chris


People also ask

Can I host a Shiny app on AWS?

In the amazon console, go to your running EC2 instance. Copy the Public DNS (Ipv4) e.g. : ec2–34–215–115–68.us-west-2.compute.amazonaws.com. Copy this in the browser and suffix: 3838/myapp like below and press enter. Your R shiny app is hosted successfully!!!!

Can I host a Shiny app on GitHub?

GitHub is a great place to organise and share your code using version control. You can also use it to host Shiny app code for others to download and run on their own computer.

Can you run Shiny app locally?

You might be eager to deploy your Shiny app to a remote server. But the simplest way to run a Shiny app is to run it locally. You only need the shiny R package installed, and you can run the app in your browser.


1 Answers

Sorry you're having trouble. I think (hope) you'll have more luck with the precompile binaries we've prepared for Ubuntu 12.04. You can grab them from our download page.

The goal of the binaries is to simplify the installation process for users. Be sure to follow the instructions in our official guide which should walk you through the process.

If you do need to customize the port, you can override the default configuration file by placing an alternate file in /etc/shiny-server/shiny-server.conf, as some commenters suggested. If you want to use the default config file to get you started, you can copy it there using the command:

sudo cp /opt/shiny-server/config/default.config /etc/shiny-server/shiny-server.conf

When you restart/reload Shiny Server, it should pick up that configuration file and use whatever settings you specify there (like custom ports).

like image 96
Jeff Allen Avatar answered Sep 20 '22 03:09

Jeff Allen