Shiny by RStudio

Introduction to Shiny Server

Shiny Server is a back end program that makes a big difference. It builds a web server specifically designed to host Shiny apps. With Shiny Server you can host your apps in a controlled environment, like inside your organization, so your Shiny app (and whatever data it needs) will never leave your control. You can also use Shiny Server to make your apps available across the Internet when you choose. Shiny Server will host each app at its own web address and automatically start the app when a user visits the address. When the user leaves, Shiny Server will automatically stop the app.

The professional version of Shiny Server offers even more features. With Shiny Server Pro, you can password protect your apps and use an administrative dashboard to learn who is using your apps and how (below).

Shiny Server Pro Login and Admin Dashboard

This article will demonstrate some of the features of Shiny Server and introduce you to the deep literature that is waiting to help you download, install, and configure your own Shiny Server.

Shiny Server, Shiny Server Pro, and shinyapps.io

You can use the free Community Edition of Shiny Server to begin hosting your Shiny applications, or you can leverage Shiny Server Professional to scale your applications to a broader audience, restrict access to particular applications, or control the resources consumed by your Shiny applications. You can see a full breakdown of the differences between the two editions here; we’ll discuss the features of both editions of Shiny Server in this article. We hope to highlight some features of Shiny Server here, but for a full discussion on how to manage and configure your server, please see the official Admin Guide.

Shiny Server runs on a variety on Linux distributions. If you’re not comfortable with Linux or would prefer to have someone else manage the server on which your Shiny applications are hosted, check out ShinyApps.io to learn about hosting your applications in an environment that is managed and maintained by RStudio for you. ShinyApps.io lets you use a pay-as-you-go model to tap into some of the features only available in Shiny Server Professional, an arrangement that is more approachable for some organizations.

Shiny Server Professional offers a variety of nice features that build on top of the open source Shiny Server including:

  • A dashboard to help understand the activity on your server (as shown above)
  • The ability to secure your Shiny applications using SSL (HTTPS)
  • The ability to control which users are allowed to access which applications
  • Priority support from RStudio
  • Controls to fine-tune resource consumption per Shiny application

Below we’ll demonstrate a few examples of using Shiny Server to make your Shiny applications available in different ways.

Host a Directory of Applications

(See this page for a complete step-by-step walkthrough of this example.)

Shiny Server allows you to host a directory full of Shiny applications and other web assets (HTML files, CSS files, etc.) using the site_dir configuration. By default, Shiny Server will use a site_dir to make any applications and assets stored in /srv/shiny-server/ available. You can begin placing Shiny applications inside this directory then referencing them on your server. For instance, a Shiny application stored in /srv/shiny-server/myApp would be available at http://myserver.org:3838/myApp, (where myserver.org is the name of your server) by default. You could also place HTML files in this directory to make them available on your server, as well.

Let Users Manage Their Own Applications

(See this page for a complete step-by-step walkthrough of this example.)

In some cases, it may be desirable to allow users on a system to manage and update their own Shiny applications stored in their home directories; the user_apps configuration allows you to do just that. Shiny applications hosted inside users’ ShinyApps directory will be available online. For instance, a user who stored a Shiny application in /home/kim/ShinyApps/myApp would be able to access it at http://myserver.org:3838/kim/myApp on a server configured to use user_apps.

Require User Authentication On An Application

(See this page for a complete step-by-step walkthrough of this example.)

Shiny Server Professional supports various forms of user authentication which can be used to require your users to login before being able to access particular Shiny applications on your server.

As of Shiny Server v1.1.0, you can even change the appearance of the login page using the template_dir configuration to make your login page look something like this:

Blue Shiny Server Pro Login

(Inspired by Thibaut Courouble and Orman Clark.)

Or this:

Badge Shiny Server Pro Login

(Inspired by Ionut Zamfir.)

Summary

To recap, Shiny Server is a useful way to share your Shiny applications in a controlled environment. It lets you

  • Automatically start and stop your applications as needed on a Linux server
  • Provide a unique URL for each application
  • Restrict access to particular applications, if using Shiny Server Professional

If you have any questions or would like more information, please visit http://www.rstudio.com/shiny/server/ or email us at sales@rstudio.com.



We love it when R users help each other, but RStudio does not monitor or answer the comments in this thread. If you'd like to get specific help, we recommend the Shiny Discussion Forum for in depth discussion of Shiny related questions and How to get help for a list of the best ways to get help with R code.

comments powered by Disqus