This add-on is operated by Rollbar
The Continuous Code Improvement Platform |
Last updated 18 November 2020
Table of Contents
This article explains how to provision, configure, and remove the Rollbar add-on for Heroku.
Provisioning the Rollbar add-on
Rollbar can be added to a Heroku application via the CLI:
$ heroku addons:create rollbar:free -a myapp-production Creating rollbar:free on ⬢ myapp-production... free Created rollbar-clean-85894 as ROLLBAR_ACCESS_TOKEN, ROLLBAR_ENDPOINT Use heroku addons:docs rollbar to view documentation
A list of all plans available can be found here.
Once Rollbar has been added, a
ROLLBAR_ACCESS_TOKEN setting will be available in the app configuration and will contain your server-side access token. This can be confirmed using the
heroku config:get command.
$ heroku config:get ROLLBAR_ACCESS_TOKEN a1a1b2b2c3c3d4d4e5e5f6f6e7e7d8d8
After installing Rollbar the application should be configured to fully integrate with the add-on.
Attach Rollbar to Multiple Apps
If you are using Heroku Pipelines for a continuous delivery workflow, then we recommend the following configuration:
- First create the Rollbar add-on on your production app (see the previous section);
- Then attach the same Rollbar add-on to the other apps in the pipeline.
To attach the same Rollbar add-on to multiple apps, first determine the add-on name:
$ heroku addons Owning App Add-on Plan Price State ---------------- ------------------- ------------ -------- -------- myapp-production rollbar-clean-85894 rollbar:free free created
Then use the
addons:attach command to attach it to additional to additional apps:
$ heroku addons:attach rollbar-clean-85894 -a myapp-staging Attaching rollbar-clean-85894 to ⬢ myapp-staging... done Setting ROLLBAR config vars and restarting ⬢ myapp-staging... done, v3
Exception data from each app to which you attached the add-on will be sent to the same Rollbar project. We recommend to configure a different environment value for each app so you can differentiate between exceptions from production, staging, etc.
After provisioning the add-on, it’s necessary to locally replicate the config vars so your development environment can operate against the service.
Though less portable, it’s also possible to set local environment variables using
Use Foreman to configure, run and manage process types specified in your app’s Procfile. Foreman reads configuration variables from an .env file. Use the following command to add the
ROLLBAR_ACCESS_TOKEN values retrieved from heroku config to
$ heroku config -s | grep ROLLBAR_ACCESS_TOKEN >> .env $ more .env
Credentials and other sensitive configuration values should not be committed to source-control. In Git exclude the .env file with:
echo .env >> .gitignore.
For more information, see the Heroku Local article.
For detailed information about how to configure and use the different client libraries, please head over to Rollbar’s docs.
For more information on the features available within the Rollbar dashboard please see the docs at rollbar.com/features.
The dashboard can be accessed via the CLI:
$ heroku addons:open rollbar
or by visiting the Heroku apps web interface and selecting the application in question. Select Rollbar from the Add-ons menu.
Migrating between plans
heroku addons:upgrade command to choose a new plan. This is a downtime-free operation.
$ heroku addons:upgrade rollbar:hobby Upgrading rollbar:small to sharp-mountain-4005... done, v18 ($12.00/mo) Your plan has been updated to: rollbar:hobby
Removing the Rollbar add-on
Rollbar can be removed via the CLI.
This will destroy all associated data and cannot be undone!
$ heroku addons:destroy rollbar -----> Removing rollbar from sharp-mountain-4005... done, v20 (free)