So I spent a little time a while back trying to figure out the nuances of what was allowed on Dreamhost when using mod_rails for a Rack based application. First since Sinatra wasn’t a DH supplied gem I setup my own rubygems install store following this walk through: http://wiki.dreamhost.com/index.php/RubyGems
Then I installed the Sinatra gem. Finally I created a sinatra application and pointed a DH subdomain @ the public folder of the app. Unfortunately DH doesn’t support putting Rack or Rails apps in sub-directories.
Now, even though I was declaring the GEM_HOME & GEM_PATH variables in the config.ru file Passenger wasn’t picking up them up and so wasn’t finding my sinatra gem. To get around this I used the SetEnv apache declaration declaration in a .htaccess file in the public folder of the app ala:
SetEnv GEM_HOME /home/username/.gems
SetEnv GEM_PATH /home/username/.gems:/usr/lib/ruby/gems/1.8
Also since Dreamhost spins down the application handler pretty quickly and my little test site doesn’t recieve much traffic, the initial startup is slow, but subsequent refreshes make this quick. To get over this initial launchtime I setup a cron job to tickle the app every 5 minutes:
*/5 * * * * /usr/bin/curl http://my.domain.com/ -s -o /dev/null
Now the app loads up quick every time!