Support

Shiny Server Quick Start: Let users manage their own applications

Follow

This article is adapted from the Shiny Server Administrator's Guide for version 1.4.2.


 

Some administrators of Shiny Server would prefer to give users -- or some trusted subgroup of users -- the ability to manage and host their own Shiny applications. This allows users to work directly with their applications rather than requiring an administrator to deploy and update applications on their behalf. This guide will document how to create such an environment, using the user_dirs directive documented in the Host Per-User Application Directories section of the Shiny Server Administrator's Guide.

Shiny Server is configured by a file stored at /etc/shiny-server/shiny-server.conf. in this Quick Start guide, we will be using a shiny-server.conf file that contains the following:


# Specify the authentication method to be used.
# Initially, a flat-file database stored at the path below.
auth_passwd_file /etc/shiny-server/passwd;

# Tell Shiny Server that we want to run as the user whose
# home directory we find the application in.
run_as :HOME_USER:;

# Define a server that listens on port 3838
server {
  listen 3838;

  # Define a location at the base URL
  location / {
    # Allow users to host their own apps in ~/ShinyApps
    user_dirs;
    
    # Optionally, you can restrict the privilege of hosting Shiny applications
    # only to members of a particular Linux group.
    # members_of shinyUsers;    
  }
}

# Provide the admin interface on port 4151.
admin 4151 {
  # Restrict the admin interface to the usernames listed here. Currently
  # just one user named "admin"
  required_user admin;
}

Lines beginning with a # are treated as comments and not parsed when configuring the server.

This configuration enables all users on the system to host their own applications by creating a ShinyApps directory in their home directory; you can always alter the configuration file to tailor it to your needs.

To see how this works, you could deploy an application under your username by copying an example that comes with Shiny Server into your own ShinyApps directory. To do this, copy the entire /opt/shiny-server/samples/sample-apps/hello/ directory into ~/ShinyApps using the following commands:

mkdir ~/ShinyApps
sudo cp -R /opt/shiny-server/samples/sample-apps/hello ~/ShinyApps/

If those commands succeed, you have successfully installed a user_dirs Shiny application!

By default, Shiny Server listens on port 3838, so your new application will be available at http://<server-address>:3838/<your_username>/hello, where <your_username> is your Linux username.

If you wanted to restrict the privilege of running Shiny applications to a particular set of users on your system, you can uncomment the members_of line in the configuration file. You can then specify the Linux group name of which a user must be a member before he or she would be allowed to host Shiny applications.

Have more questions? Submit a request

Comments

Powered by Zendesk