Getting Started with Shiny Server (R application hosting)

Deploying an Application

  1. Install the SFU VPN client and connect to the SFU VPN before proceeding.
  2. For this example, we’ll assume you have a Shiny application ready to deploy in a folder called myapp on your computer.
  3. Sign up for the rcg-shiny-users maillist. [tutorial]
  4. Wait ~30 minutes for your maillist membership to become active.
  5. Use an SFTP client to connect to shiny.rcg.sfu.ca with your SFU computing ID (e.g., jsixpack) and password.
  6. You will be placed in your home directory by default: /home/your_username.
  7. Open the ShinyApps folder. Upload the myapp folder you prepared in step 1 inside the ShinyApps folder.
  8. Use a web browser to test your app: https://shiny.rcg.sfu.ca/u/your_username/myapp

 

Installing Packages

Shiny Server will display a generic error page if it can't find one or more of the CRAN packages required by your appliaction. To install packages as required (i.e., to avoid installing packages every time someone views your application) use the following R code:

packages <- c('package_name_1', 'package_name_2') install.packages(setdiff(packages, rownames(installed.packages())))

You can also install packages on shiny.rcg.sfu.ca ahead of time by:

  1. Signing up for the rcg-shiny-users maillist as described above
  2. SSHing to shiny.rcg.sfu.ca
  3. Running R
  4. Inside R, running install.packages('your_package_name_here')


Error Logs

On shiny.rcg.sfu.ca, the most frequent cause of application failures is calling a package that hasn't been installed yet (see "Advanced Users") above.

If something goes horribly wrong with your application, Shiny Server will record some relevant information in /home/your_sfu_computing_id/log.

There may not be any logs recorded if your application responds with “An error has occurred. Check your logs or contact the app author for clarification”. In this case, SSH into shiny.rcg.sfu.ca and run Rscript ~/path/to/server.R to reveal error messages and missing libraries. Repeat for ~/path/to/ui.R.

Shiny application logs are automatically deleted at 11PM on the 1st of every month.

 

Compute Power and Storage

If your application has large storage or heavy computational requirements, please contact research-support@sfu.ca so we can point you to other hosting resources within RCG or elsewhere on campus.


When Your SFU Account Expires

Your application will remain active until you delete it, or until your SFU computing ID expires. R and CRAN package development move at a fairly swift pace, meaning applications tend to break after a several years without maintenance. You will need to plan ahead if you wish to keep your application available indefinitely.


Support

Undergrads taking STAT courses: please contact your professor or TA for assistance. Please be sure to wait 30 minutes after adding yourself to the rcg-shiny-users maillist before your first connection attempt.


Researchers requiring assistance with shiny.rcg.sfu.ca should contact research-support@sfu.ca.

Details

Article ID: 3913
Created
Wed 7/6/22 6:18 PM
Modified
Wed 1/10/24 3:34 PM