0 -> 60. Airbrake, Rails 3.1 + Heroku
Part I: Setting up new Rails 3.1.x Project with Airbrake
-
Ensure you have the latest Rails 3.1.x gem:
gem install rails
=> Successfully installed rails-3.1.1 (among others) -
Create the rails app:
rails new rails311app -
Add airbrake to the app gems.
cd rails311app
echo "gem 'airbrake'" >> Gemfile
bundle install -
Then signup your project at AirbrakeApp.com and get the magic line:
script/rails generate airbrake --api-key YOUR_API_KEY_GIVEN_ON_THE_WEB -
You'll see a URL in the produced output like:
16192005 http://mysubdomain.airbrakeapp.com/errors/1XXX/notices/2XXX 2XXX -
Copy & Paste that URL (or just return to your AirbrakeApp.com account) and see the error. Welcome to a robust and worry-free production error removal workflow.
http://mysubdomain.airbrakeapp.com/errors/1XXX/notices/2XXX
Part II: Deploying to Heroku (without the addon)
-
Starting from where we left off--in the rails311app directory from above. Make a local git repo:
git init
git add .
git commit -am "Initial import." -
Then create the heroku app:
heroku create rails311app -
And push your code to heroku:
git push heroku master -
Then give the production error reporter a test:
heroku run rake airbrake:test
4a. Aggh! This currently is broke. We're working with Heroku to
debug. You'll see this error:
Started GET "/verify" for at 2011-10-09 11:54:04 -0700
ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished):
4b. Don't worry, your production errors are still caught. And
you can test yourself with:
heroku console
Ruby console for rails311app.heroku.com
Airbrake.notify(:test => true)
=> "1XXX"