Deploying with Capistrano

Notify Bugsnag of deploys to using Capistrano.


Add the bugsnag-capistrano Ruby gem to your Gemfile:

gem 'bugsnag-capistrano'

Don’t forget to run bundle install after updating your Gemfile.

Basic configuration

To track deploys automatically require bugsnag-capistrano into your Capfile and configure your API key in by either:

Setting it in your Capfile:

require 'bugsnag-capistrano'

set :bugsnag_api_key, "your-api-key-here"

Or setting the BUGSNAG_API_KEY environment variable.

Notifying of deployments

Bugsnag will automatically be notified of deployments made via Capistrano in the configured repository. If you wish to notify of a deployment manually then call the bugsnag:deploy task.

cap `your_configuration_here` bugsnag:deploy BUGSNAG_API_KEY='your_api_key_here' ...

Configuration options

All of the following configuration options can be set within the projects Capfile. Certain options may also be set using environment variables, as specified.

Variable Environment variable Description
:bugsnag_api_key BUGSNAG_API_KEY Your Bugsnag API key (required)
:app_version BUGSNAG_APP_VERSION The app version of the code being deployed
:branch BUGSNAG_BRANCH The source control branch the code is being deployed from
:bugsnag_endpoint The endpoint to deliver the deployment notification to
:bugsnag_env BUGSNAG_RELEASE_STAGE The release stage (e.g. production, staging)
:current_revision BUGSNAG_REVISION The source control revision of the deploying code
:repo_url BUGSNAG_REPOSITORY The repository URL the code is being deployed from