Passenger
From DreamHost
For help with Rails installations using Passenger, check here: Passenger Troubleshooting.
Passenger [1] for ruby on rails has been provided by DreamHost since December 2008. 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 (RoR) application as the main application for a specific domain or sub-domain. It conflicts with some of our other features so it's best to leave it off if you do not actually need it. Eg, you want to access your RoR application via www.myapp.mydomain.com or www.mydomain.com . If you want to access the RoR application at www.mydomain.com/path-to-myapp then use FastCGI instead of passenger.
- To enable Passenger, edit any of your fully hosted domains or add a new domain (or sub-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:
if ENV['RAILS_ENV'] == 'production' # don't bother on dev ENV['GEM_PATH'] = '/home/USERNAME/.gems' #+ ':/usr/lib/ruby/gems/1.8' # Need this or Passenger fails to start require '/home/USERNAME/.gems/gems/RedCloth-4.1.9/lib/redcloth.rb' # Need this for EACH LOCAL gem you want to use, otherwise it uses the ones in /usr/lib end
in the config/environment.rb file after the require boot.rb line. 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. It seems you also need to clear the existing gem paths after setting the path, or it (inconsistently) ignores whatever you've set, according to [the Phusion Blog]. You can reload the config file by typing "touch tmp/restart.txt" in your base directory.
- As of 4 Aug 2008, Passenger only supports Rails 2.0.2. I have set up a couple of sites (October 2008) running with Rails 1.2.6, and they seem to behave nicely.
- For some reason, Passenger will not use the 'rails' installation in your local gems repository. However, it will be able to load all other gems. To run Passenger with Rails 2.1.0, freeze rails into your vendor/ directory. To do that, run the following command on the server. Make sure the current directory is the Rails app directory.
rake rails:freeze:edge TAG=rel_2-1-0
This will work, but having Rails in your local gem directory will not. The same method applies to all Rails versions above 2.1.0 .
Capistrano
Using Capistrano with DH RoR on Passenger works well. Use the Manage Domains area of our web panel to set the domain's web directory to:
# access app 'foo' via www.foo.mydomain.com or via foo.mydomain.com
# Set web directory in the DH panel to:
foo.mydomain.com/apps/foo/current/public
# In your Capistrano deploy/production.rb file:
set :deploy_to, "/home/DH_user_name/foo.mydomain.com/apps/#{application}"
# Where DH_user_name is your CGI-runs-as user field in the domain edit screen from the DH Panel
If you need to use a different rails environment than 'production', take a look at this.
Passenger and Python/WSGI
Passenger provides "proof of concept" support for WSGI-compliant Python applications. See the Passenger WSGI article for more information.

