Rails 3 on Dreamhost via Capistrano

Dreamhost has started rolling out Rails 3.0.3 to its servers; however, there’s a couple of snags that may prevent you from quickly and easily deploying a Rails app. I’ve spent the better part of a couple of hours overcoming these challenges, some of which might have been due to me climbing the Rails 3 deployment learning curve. I was running into all kinds of problems with “500 Internal Server Error”, as well as being unable to get the required gems installed properly, including the required native extensions.

Allow me to save you some time.

First problem: the bundle executable isn’t in your PATH environment by default, either for login shells or non-login shells. The fix is simple – just add the right path to your .bashrc and .bash_profile: export PATH="/usr/lib/ruby/gems/1.8/bin:$PATH"

Second problem: you need to make sure to use bundle install properly to resolve and install your dependency gems. Simplest solution is to add require 'bundler/capistrano' to the top of your deploy.rb.

Those two small additions will resolve problems deploying Rails 3 apps via Capistrano on Dreamhost. Happy coding!