November 22, 2024, Friday, 326

Using RoR Passenger on DH

From NeoWiki

Jump to: navigation, search

As of May 13, 2008 DreamHost provides a feature called Passenger for Ruby on Rails. It is also known as mod_rails, though that is a bit of a misnomer. The software is developed by a small company called Phusion. This is now the preferred way to deploy and host Ruby on Rails applications across all DreamHost servers.

  • Only enable this option if you are running a Ruby on Rails application under the particular domain or website. It conflicts with some of our other features so it's best to leave it off if you do not actually need it.
  • To enable Passenger, edit any of your fully hosted domains or add a new domain from the Manage Domains area of our web panel, and check the Ruby on Rails Passenger (mod_rails)? option.
  • This feature does require that your domain is being hosted on an Apache version 2 server. If that is not already the case our web panel will migrate it for you. If that is necessary it will take a few extra hours for the necessary DNS change to take effect.
  • Once Passenger is enabled on your domain just set the web directory to the 'public' directory of the Ruby on Rails application.
  • There is no next step! It's that easy.
  • When the code for your Ruby on Rails application has changed, creating or modifying the file tmp/restart.txt in the Rails application's root folder will tell Passenger to automatically restart the application.


A couple of technical notes:

  • Passenger and Mongrel fulfill very much the same roles so you most likely do NOT want to be using both of them on the same domain or website.
  • In the interest of ease of use and 'Upload and Go' functionality, Passenger disables some mod_rewrite functionality. That means it will automatically override an existing 'dispatch.fcgi' setup you have in place. This is not a problem for your Rails application but it may have other side effects (such as breaking other mod_rewrite rules you have set up). If this causes a problem for your website, contact our support team and we can probably get things working like they did previously for you.
  • Passenger automatically launches applications and leaves them running as long as they are not idle. It also caches the code for Ruby on Rails itself to speed up application launching.
  • You can use your local gem repository if you set
ENV['GEM_PATH'] = 'path-to-your-gem-repository'

in the config/environment.rb file. The same path should be set in shell's environment variables GEM_HOME and GEM_PATH so you can use the gem program to install/upgrade your own gems.