Internal 500 server error – Dreamhost – Rails 3.0.3 – Capistrano

Problem
You want to deploy your Rails 3.0.3 in Dreamhost with capistrano, but even though you follow the steps from a previous post here, when you go to the application’s main page you still get an error:

500 Internal Server Error

Solution
Thanks to a blog post from Brendon Wilson here, the last missing piece from the puzzle in order to have your application running is to add the following line to the top of your deploy.rb file:

require 'bundler/capistrano'

and redo your cap deploy.

Thanks Brendon.

Rails 3 – Bundler – Dreamhost – Capistrano

Problem
You want to deploy your Rails (3.0.3) application to Dreamhost using Capistrano, but you get errors like:

bundle command not found
or
Enter your password to install the bundled RubyGems to your system:

Solution
You may be able to see in your deploy.rb file a commented section that says the following:

As Capistrano executes in a non-interactive mode and therefore doesn’t cause
any of your shell profile scripts to be run ….

So in order for capistrano to be able to find your bundle command you should add in your deploy.rb file a line with your paths (ie):

default_environment['PATH']='/usr/lib/ruby/gems/1.8/bin:/home/your_name/.gems/bin:/usr/local/bin:/usr/bin:/bin'

If you have the previous line your bundle command can run, but if you try to do cap:deploy your bundler will probably give you an error as it would ask for your sudo password. In order to avoid this error and to make it work you have to add another line with your gem path (ie):

default_environment['GEM_PATH']='/home/your_name/.gems:/usr/lib/ruby/gems/1.8'

making sure that your home directory path for your gems is first in the list.