Skip to content

Instantly share code, notes, and snippets.

@webcracy
Created March 11, 2021 11:43
Show Gist options
  • Save webcracy/91f6bfc1cae7536526e976af133bfdec to your computer and use it in GitHub Desktop.
Save webcracy/91f6bfc1cae7536526e976af133bfdec to your computer and use it in GitHub Desktop.
How to add a Honeybadger deploy hook/ping to a Dokku deployment

Ping Honeybadger when you deploy a Rails app to Dokku

Define a postdeploy action in your app.json file to ping Honeybadger when you deploy your Rails app to a Dokku instance.

The Honeybadger CLI deploy command requires you set the --repository and --revision options.

You can use environment variables for this, or for example hardcode your repository URL (as in the example below).

Dokku provides a $GIT_REV environment variable by default, which is useful to set the --revision option.

Note that using the release stanza in Procfile for this won't work, as the $GIT_REV environment variable isn't set in that phase of the release.

Example

Here's a sample app.json file that accomplishes this.

{
  "scripts": {
    "dokku": {
      "postdeploy": "bundle exec honeybadger deploy --environment=production --repository <YOUR_REPOSITORY_URL> --revision $GIT_REV"
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment