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?
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With