Push Button Publishing for Shiny Apps

[This article was first published on R - Hosting Data Apps, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Push Button Publishing for Shiny Apps

In a previous post you saw how to run Shiny apps locally. Certain use cases need to be run locally, most web applications deserve to be hosted on the web. The official Shiny documentation on the RStudio website offers 3 ways of putting Shiny applications on the web:

  1. Shinyapps.io: free or paid cloud hosting with push button publishing
  2. RStudio Connect: paid self hosted option for authoring Shiny apps among many other things with push button or git based publishing
  3. Shiny Server: free self hosted option with file transfer based publishing (the paid Pro version is discontinued in favour of RStudio Connect)
Push Button Publishing for Shiny Apps
Official deployment options for Shiny by RStudio

Push button publishing is available for Shinyapps.io and RStudio Connect from the RStudio IDE (desktop or server edition) or from any R console using the rsconnect R extension package.

Shinyapps.io

Shinyapps.io is the easiest and quickest way for sharing Shiny apps with the world. Apps are hosted in the cloud on shared servers operated by RStudio. Apps are self contained and isolated from each other. Connections are encrypted (HTTPS) by default.

The Anatomy of a Shiny Application
Shiny lets you quickly build web applications using the R programming language. In this post I will walk you through how a Shiny application is structured. The goal is simply to have the most basic and dependency free app that we can deploy. Let’s get going!
Push Button Publishing for Shiny Apps

To be able to take advantage of push button publishing from RStudio IDE, complete the following prerequisites:

The following image gallery shows how to deploy the Hello app to the Shinyapps.io service:

  1. Open up the project in RStudio IDE, click the Publish button at the top of the file editor pane then click Publish Application
  2. Select the account you wish to deploy to if you set up multiple accounts, name the app (here we use 'hello'), and select what files to deploy as part of the app
  3. Wait until the deployment is complete, you can follow the process in the Deploy pane
  4. The browser is launched with the new deployment by default, check that everything works as expected

Your newly deployed app will be available at https://username.shinyapps.io/appname. The dashboard in your Shinyapps.io account will list the 'hello' app. Click on the app to see usage statistics and settings. This is the place where you can archive or delete the app too.

The deployApp() command from the rsconnect package is used in the background to deploy the app to Shinyapps.io. The command works from the command line to initially deploy and later to redeploy the app.

Keep in mind that Shinyapps.io is a managed service and comes with some limitations regarding dependencies: required R packages need to be able to run on Ubuntu Linux and cannot rely on graphical display only (Tcl/Tk). Installing packages from Bioconductor needs the repositories set by setRepositories(). If a package has missing system dependencies, you can find available system packages here, or file an issue here.

RStudio Connect

Push button publishing to RStudio Connect works very similarly to the previously described process. The only difference is the publishing account setup. In the RStudio IDE, click the Tools menu item, select Global Options from the dropdown, then click Publishing in the left navigation of the popup window. Now click the Connect button and follow the prompts. If your app needs specific dependencies, talk to your system administrator.

Note: publishing with RStudio Connect requires you or your organization to have a server running RStudio Connect with a valid license.

Further reading

RStudio and Shiny are trademarks of RStudio, PBC

To leave a comment for the author, please follow the link and comment on their blog: R - Hosting Data Apps.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)