I’ve been setting monit up to keep an eye on the various parts associated with a Rails app (2.3.x but patched to use Bundler for gem management) and ran into a problem getting my Gemfile recognised properly.

The essential piece I’d missed was the BUNDLE_GEMFILE environment variable. So for, say, delayed_job what was needed was:

start program = "/usr/bin/env RAILS_ENV=production
BUNDLE_GEMFILE=/var/www/my_app/current/Gemfile
PATH=/opt/ruby/bin:$PATH
/var/www/my_app/current/script/delayed_job  start"

Hopefully that’ll save someone a few minutes.