DEV Community

Cover image for Push Button Publishing for Shiny Apps
Peter Solymos for Analythium

Posted on • Updated on • Originally published at hosting.analythium.io

Push Button Publishing for Shiny Apps

By: Peter Solymos

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)
Official deployment options for Shiny by RStudio
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 ApplicationShiny 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!Hosting Data AppsPeter Solymos

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
Steps to deploy the hello app to Shinyapps.io / © Analythium

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.

Application settings and monitoring in the Shinyapps.io dashboard

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

Top comments (0)