Recently, we quietly added an important pair of new apps to our complement of one-click installers based on Phusion Passenger. Passenger’s also known as mod_rails ormod_rack, but in the time I’ve spent playing with it, I’ve come to call it nifty.

Passenger is a module which works with nginx to make it easy to setup and run a wide variety of web applications, but Passenger shines while running Ruby and Ruby on Rails applications. But as you’re about to find out, it’s capable of a lot more.

In the control panel you’ll find two new application types available for installation:

  • Passenger 2.2.8 (nginx 0.7.64/Ruby Enterprise Edition 1.8.7)
  • Rails 2.3.5 (nginx 0.7.64/Passenger 2.2.8/Ruby Enterprise Edition 1.8.7)

The Rails application is a new (and, in many respects, improved) way of setting up your Rails applications; the Passenger application is a more generalized tool for deploying other kinds of applications.

Gems, Rack, and You

One of the great things about both new applications is how easy it is to install Ruby Gems. For example, here’s how I installed Sinatra, a light-weight web application framework:

[ddbeck@web100 ~]$ cd webapps/passenger_app/
[ddbeck@web100 passenger_app]$ export GEM_HOME=$PWD/gems
[ddbeck@web100 passenger_app]$ export PATH=$PWD/bin:$PATH
[ddbeck@web100 passenger_app]$ gem install sinatra
Successfully installed sinatra-0.9.4
1 gem installed
Installing ri documentation for sinatra-0.9.4...
Installing RDoc documentation for sinatra-0.9.4...

Another great feature of Passenger is that it supports the Rack interface which allows Ruby and Ruby frameworks to easily work with web servers. For example, I can use the Sinatra framework I just installed to create a simple web application:

[ddbeck@web100 passenger_app]$ mkdir frank
[ddbeck@web100 passenger_app]$ mkdir frank/public
[ddbeck@web100 passenger_app]$ mkdir frank/tmp
[ddbeck@web100 passenger_app]$ touch frank/config.ru
[ddbeck@web100 passenger_app]$ touch frank/myapp.rb 

Then I paste the following code (from Sinatra’s Getting Started guide) into myapp.rb:

require 'rubygems' require 'sinatra' get '/' do 'Hello WebFactioneers!' end 

Next, I put these lines into my config.ru:

require 'rubygems' require 'sinatra' require 'myapp' run Sinatra.application 

Finally, I update this line in ~/webapps/passenger_app/nginx/conf/nginx.conf:

root /home/ddbeck/webapps/passenger_app/hello_world/public; 

to:

root /home/ddbeck/webapps/passenger_app/frank/public; 

and reboot my application with ./bin/restart and voila!

[ddbeck@web100 passenger_app]$ curl ddbeck.webfactional.com Hello, WebFactioneers! 

With the flexibility and other improvements that Passenger provides, we invite you to give the new apps a try. We can’t wait to see what uses you find.