Apple, Computers, Events, Linux, Open-source, Ruby, Software, Web

Rails – One Step Closer to Enterprise

I have jumped back into the exciting world of Ruby on Rails the last few days to make a few optimizations to my wife’s website,

The problem is that Rails runs so dog-ass slow compared to other interpreted languages like PHP. After a few heated debates on who is to blame with a few Rails fans at work, I concluded that Rails needs the native speed of an Apache module. I wondered how long the Rails community would take to just bite the bullet and develop the module. Its not their job (exactly), but Apache is also open-source.

Without the module, all of the solutions involve passing out the Ruby code requests to yet another server (in my case Mongrel) to process the requests.

That is, until I read about a Ruby gem named Passenger. This was the mod_rails solution I was looking for with Apache natively serving the requests!

Curiosity got to me after watching their screencast. I saw that Ubuntu was well supported (among many other OS choices) as an added bonus. The installation was absolutely painless. I performed a few steps to get the website up and running:

sudo gem1.8 install passenger
sudo apt-get install ruby1.8-dev
sudo apt-get install apache2-prefork-dev
sudo apt-get install libapr1-dev
sudo passenger-install-apache2-module

I then pointed to the compiled module from inside Apache’s configuration files (copy and paste from the setup), and deleted a lot of garbage from my old Mongrel cluster VirtualHost section. My new configuration now looks like this:

     DocumentRoot /home/bsimpson/public_html/crittersdelight/public

     <Directory "/home/bsimpson/public_html/crittersdelight">
          Options FollowSymLinks
          AllowOverride None
          Order allow,deny
          Allow from all

     RewriteEngine On

A quick Apache restart, and now I am natively serving this Rail’s application. Thanks to Phusion for taking the biggest Rails pain in the ass away!