Adam Carlile
Heroku Airbrake post deploy hook

After a lot of trawling around the internet I couldn’t find any reference as to how to set up a post deploy hook for heroku. Even the airbrake:heroku:add_post_deploy_hook rake task didn’t seem to work, so I have managed to piece together my own custom post deploy hook

I hope this can help someone!

Phusion Passenger 3

I have recently upgraded my slicehost box to Ubuntu 10.04 LTS, and upgraded the Passenger version to 3, the difference in performance is incredible, at least a 20% decrease in response times.

However the big great news is the inclusion of a new Apache directive,

PassengerMinInstances

Previously passenger would spool down all of the running instances of an app if it was idle for too long, you could override this behaviour by setting PassengerPoolIdleTime to 0, however this would mean that spawned instances would never spin down, utilising the server even if it was getting no traffic, however on the flip side it meant that application initial load times were kept to a minimum

The new directive allows Passenger to load the Rails framework into memory on the first application hit, and because all the processes will not spin down after that no matter how long between requests the page load will be near instantaneous

For me this was the only thing that made Passenger an issue, and clients often complained about the long load times, however with Passenger 3 this load time is negated to the first time the app is loaded after an Apache restart

If you haven’t already I recommend that you upgrade all of your existing Passenger implementations to version 3

Gravatar helper for Ruby on Rails

So, I was working on a project a while ago with user comments, and wanted each person to have their own avatar, however, the Gravatar plugins that existed for Rails seemed a bit too much overkill for my needs.

So I wrote this simple helper method. Either copy the method into your application_helper.rb, or alternatively drop it into your lib directory and include it.

Usage is as simple as just calling:

gravatize(user.email, :size => 50)

This will just render the Gravatar inside an image tag, simple no!