btubbs / heroku-buildpack-shiny

For deploying apps running on R's "Shiny" web framework
55 stars 9 forks source link

Notice

Heroku has changed their stack since the time that this buildpack was developed, and the custom compiled-for-Heroku version of R used by this buildpack does not work for newly-built apps.

You may have better luck with heroku-buildpack-r, whose maintainer is more diligent about building a new R version each time Heroku breaks the old one.

Heroku Buildpack Shiny

This is a Heroku buildpack for the Shiny web framework that runs on R.

Check it out: http://shiny-example-1.herokuapp.com/. The source for that is at https://github.com/btubbs/shiny-example-1.

Instructions

These instructions assume that you have already signed up for an Heroku Account and installed the Heroku Toolbelt

Create App

The first step is to create the Shiny application to deploy.

  1. Create a Git repository.
  2. Put functioning ui.R and server.R files in your repository, like those in the Shiny Tutorial.
  3. Optionally, add a packages.R file to install more R packages at build time. (Here's an example.)

If you want to quickly test things, you can directly clone my example application

Deploy App

To deploy the app on Heroku using this buildpack, you need to

  1. Create your app on Heroku.
  2. Enable Heroku websockets support.
  3. Tell Heroku to use a custom buildpack for your app
  4. Push application to heroku

The commands to be run from the commandline are shown below. Make sure to replace APPNAME with the name of your application.

$ heroku apps:create APPNAME
$ heroku config:set BUILDPACK_URL=https://github.com/btubbs/heroku-buildpack-shiny.git
$ heroku labs:enable websockets -a APPNAME
$ git push heroku

Notes

This buildpack does not use shiny-server. That might change in the future if just running plain old Shiny turns out to be problematic.

The version of R installed by this buildpack is 3.0.2.

The real heavy lifting of getting R to build on Heroku was done by Chris Stefano (aka virtualstaticvoid) in his buildpack for R. Thanks Chris!