What is Airbrake
In addition to New Relic I have also added Airbrake to my blog. Again, Airbrake is very simple to add add to any Rails App.
The Airbrake App tells you if any of your projects throw and error, and also notifies you which of your app environments did so. You have the option of the error notifying you via email, only receive emails for the production environment or to participate in Airbrake's beta program.
It also has Lighthouse & Github integration as well as tracking your deployments which is nice and convenient.
Installation and Use
Adding the Airbrake app is easy and I'll even go over an error and solution that occurred for me. First create an airbrake account and create your first project. When you create the project directions for adding Airbrake to your app will be visible.
Add airbrake to your Gemfile. I found this did not play nicely when I put the app in only my production environment.
bundle install. Then run
script/rails generate airbrake --api-key YOUR_API_KEY_HERE. You can get your api key from that first screen when you create your first project. If this runs successfully you will see the airbrake test run in your terminal, followed by your configuration options which contain your api key, etc.
Now if you're using Capistrano you're probably wondering if there is anything special you need to do for your deploy. The good news is that Airbrake will add
require 'airbrake/capistrano' to your deploy.rb automatically. The bad news is that my capistrano script broke after the addition of airbrake. Previous apps we have Airbrake installed on run fine so I'm not sure if it's certain versions of gems, ruby or rails that throws the errors.
If you see an error that says
`require': no such file to load -- rvm/capistrano (LoadError)" then you probably have the same problem I have. After a little bit of research I found others had the same problem and reported that removing
require './config/boot' from the deploy.rb fixed the problem. Once I removed this it ran fine and airbrake noted my deploy. The problem I found is a know issue reported on github as Issue #26 - if you'd like to follow the progress of this error you can read up on it here.