Lincoln Stoll github

Passenger (A.K.A. mod_rails_)

12/04/2008 – Sydney, NSW, AU.

Passenger is now available for download – . If you haven’t heard of it, is basically an apache module for running rails apps – nice and easily. I’ve just moved it over to this site, and it was incredibly easy. The install on my ubuntu server went like this:

sudo apt-get install apache2-prefork-dev libapr1-dev
sudo gem install passenger

I then added the apache config lines to the end of the apache config, and set my site up like:

<VirtualHost *:80>
DocumentRoot /home/xxx/sites/
ErrorLog /home/xxx/logs/lstoll.net_error.log
CustomLog /home/xxx/logs/lstoll.net_access.log combined

Then, when apache started up it automatically started the rails app, and it just worked. It’s simple to use with capistrano, here’s my deploy tasks from deploy.rb:

namespace :deploy do
  desc "Custom restart task for passenger"
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "touch #{deploy_to}/current/tmp/restart.txt"
  desc "Custom start task for passenger"
  task :start, :roles => :app do
    # Don't need to do anything, it's automatic
  desc "Custom stop task for passenger"
  task :stop, :roles => :app do
    # currently no way I know of to 'stop' the app

Once that is done, capistrano can flag to passenger to restart the app.

A bit of casual benchmarking shows it’s fast too. I’m very happy this is out there, it makes running rails apps as easy as PHP – saving all the messing around with mongrel/thin/monit. It also works with rails caching, so so more messing around with rewrite rules to get cached files to be read right off disk. This should hopefully make rails better on shared hosts, and lower the barrier of entry. Only downside is that this is currently rails only – so for merb/camping/anything else the old way is still needed. I’m hoping that soon passenger will support rack, or mod_rack/mod_rubinius will come out, so this ease is brought to all ruby frameworks.

blog comments powered by Disqus
Lincoln Stoll

This hCard created with the hCard creator.