Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy packaged shiny app on shiny server

When having a shiny app set up like this for the shiny server

+---/srv/shiny-server
|   +---shinyApp1
|       +---server.R
|       +---ui.R

all works fine. However, how can I do the same, when the above files (ui.R, server.R) are included in a packages inst/shiny folder? (see, for example, my gridsampler repo).

How can I deploy a packaged shiny app on shiny server?

like image 937
Mark Heckmann Avatar asked Aug 21 '16 13:08

Mark Heckmann


2 Answers

You can do what I do.

I host a lot of shiny apps from packages on my shiny server and what I do is just setwd() to the directory of the shiny app and then call shinyAppDir(".").

As an example: this code is responsible for this app


Edit 2.5 years later: note that this will not work if you have a global.R file - see this issue on github https://github.com/rstudio/shiny/issues/1063

My workaround for that is to explicitly source global.R

like image 98
DeanAttali Avatar answered Oct 04 '22 21:10

DeanAttali


I went for the easy way and just cloned the package from GitHub into the shiny-server directory and have to manually link to the inst/shiny subdirectory, see my hosted version of gridsampler as an example (notice the non-pretty URL). The shiny-server is set up to host a directory of apps, hence the overview when visiting the root URL where you need to click through to the app.

Other possibilities might include cloning the repository somewhere outside the shiny-server folder and symlinking the inst/shiny folder into the shiny-server folder as gridsampler, which afaik should work if appropriate permissions are set.

like image 32
Jemus42 Avatar answered Oct 04 '22 21:10

Jemus42