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!
Thanks for posting this. I’ve been upgrading an app to Rails 3 and I hadn’t even started to think about deployment.
Thanks Brendon,
I was facing the same problems and your post helped me solve them.
I’ve added a link to your post in my blog here:
http://www.42.mach7x.com/2011/01/13/internal-500-server-error-dreamhost-rails-3-0-3-capistrano/
Thanks again