There are at least two ways to deploy a dashR app to Heroku: via a build-pack or a docker container. The docker approach is more flexible in that you can completely control the computing environment of your app, but as a result it's a bit more cumbersome. If you have interest in using docker, you may want to build off our minimal base images.
Since dashR builds upon a fiery web server, in order to deploy dashR app(s) to Heroku, we can use an approach similar to the one outlined here. If you are brand new to Heroku, I suggest reading that post first then coming back here for a dashR example.
There are three critical files required to run any dashR app via the Heroku buildpack for R: an Aptfile
for installing system libraries, a init.R
script for installing R packages, and a run.R
script for running the dashR application. For simple applications, you probably won't have to modify the Aptfile
, but if you need R packages that require external system libraries (e.g., sf, leaflet, rmarkdown, etc), you have to add relevant apt packages to this file. There is a nice collection of apt requirements for popular R packages here.
We suggest that you start from our Heroku app template, which you can summon via the heroku_app_template()
function. This copies the template to your current working directory:
library(dashR)
heroku_app_template()
After you've modified those files to run your own dashR app, login to Heroku via the command-line tool:
heroku login
If you know your way around git, you can follow these instructions for deploying to Heroku via git, which the dashR::heroku_app_deploy()
function attempts to automate for you:
dashR::heroku_app_deploy("my-test-app")
On Windows systems waitress
can be a replacement for gunicorn
pip install waitress
waitress-serve --listen=*:8000 run:server
open http://127.0.0.1:8000 in your browser
dashR::heroku_app_deploy("my-test-app")
heroku git:clone -a dashr-docs
heroku plugins:install heroku-repo
heroku buildpacks:set https://github.com/virtualstaticvoid/heroku-buildpack-r.git#heroku-16
heroku stack:set heroku-16
git push heroku master