Skip to content
David Cook edited this page Jul 22, 2024 · 7 revisions

Bugsnag

We are using Bugsnag to track bugs and errors for both the Rails server app, and JavaScript in the browser. It's free for open source projects. Follow their getting-started guide to sign up for an account.

The bugsnag gem is already part of the OFN bundle. You just need to set the variable bugsnag_key and bugsnag_js_key in your host's secrets.yml file and run the deployment playbook to activate error reporting to Bugsnag.

You can test the Rails key by running the following command in the app directory on your server (normally ~/apps/openfoodnetwork/current).

bundle exec rake bugsnag:test_exception RAILS_ENV=staging
## or:
# bundle exec rake bugsnag:test_exception RAILS_ENV=production

If you want to test it locally on your development computer, place the following content into the file config/initializers/bugsnag.rb:

Bugsnag.configure do |config|
  config.api_key = "your-api-key-from-the-bugsnag-website"
  config.notify_release_stages = %w(production staging development)
  config.use_ssl = true
end

Slack integration

Once you have set up bugsnag on your server, you will need to integrate the slack channel from the bugsnag settings page. Choose settings > projects > 'your OFN project' > Integrations > Slack . To create a new integration you will need to confirm your identity (login) and choose a slack channel (#devops-notifications or #devops-notifications-js). Use the default notification settings in the configuration wizard and choose save. For example: Screenshot 2024-07-22 at 12 12 11 pm