Dreamhost, Rails and locally installed Gems

February 3, 2007 Link to post  Permalink

I followed the instructions for installing Collaboa on Dreamhost, which includes building and installing local versions of everything interesting – Rails, Subversion, FastCGI, Gems.

The environment can be setup in the .bash_profile, .bashrc and .gemrc files to allow all the tools find these locally installed versions. .bashrc is claimed to be the place for non-interactive apps to get their configuration setup. It seems not, at least for the Dreamhost configuration.

After trying all the tricks in the book to get my Rails app running under FastCGI, I eventually worked out what was missing — my app wasn’t picking up the locally installed Gems.

To make this work, I added the following lines to my dispatch.fcgi file:

1NV['RAILS_ENV'] = 'production'
2ENV["GEM_HOME"]="/home/<username>/.gems"
3ENV["GEM_PATH"]="/usr/lib/ruby/gems/1.8:/home/<username>/.gems"

After killing the existing processes, my app started working as expected. Woot!

I also added Todd’s new Dreamhost Plugin to the app to help improve reliability.