Steps to Deploy Rails
I'm muddling my way through production deployment for Rails. There are quite a few options. I'd eventually like to get over to lighttpd, but I need to stick with Apache 2 for now. With that decided, it looks like I can choose from the following:1. mod_fastcgi
2. mod_fcgi
3. mod_scgi
4. acgi
There's a lot of talk about how mod_fastcgi is ancient code, so that's out. The mod_fcgi module appears to be a new implementation of the FastCGI module, so that's slightly better. I'm not sure how well either of these work with Apache 2. The acgi option looks promising, but it's still fairly new and apparently not as fast as the other options. It's easier to setup and written in Ruby, so maybe I can revisit this later.
For now, mod_scgi seems to be the best choice. But there's actually a sub-option within this option, which is use mod_scgi with the SCGI Rails Runner (SRR). Perhaps this is the only option, it's hard to tell from the docs I've seen. In any case, this is the one I'm going with. I'm going to try to document this a bit, and update as things happen.
There's a page on a Rails wiki that discusses this, but even though it has "Rails Runner" in the title, it doesn't appear to directly discuss installing the runner itself, just mod_cgi.
To this point, I've grabbed this file scgi-1.8.tar.gz, uncompressed it, and built it as such:
cd scgi-1.8/apache2
apxs -i -c mod_scgi.c
Then I added this to httpd.conf, though I need to better understand the second directive. I don't think "dynamic" is what I want.
LoadModule scgi_module libexec/apache2/mod_scgi.so
SCGIMount /dynamic 127.0.0.1:4000
Then restarted Apache (yes, I know about 'restart'):
apachectl stop
apachectl start
I tried to run the demo as such:
cd ..
python scgi/scgi_server.py 4000
But then I got this:
Traceback (most recent call last):
File "scgi/scgi_server.py", line 14, in ?
from scgi import passfd
ImportError: No module named scgi
This is really vague. No idea what to make of this, but I'm going to continue on.
Update 1
Now to get the SRR side of things working. First, I have to install two gems that SRR is dependent on.
gem install cmdparse
gem install highline
Next, grab the SRR gem itself and install it:
curl -O "http://www.zedshaw.com/downloads/scgi_rails/scgi_rails-0.4.3.gem"
gem install scgi_rails-0.4.3.gem
Now I'm reading about how to actually use this thing, looking at this page right now: http://www.zedshaw.com/projects/scgi_rails/howto.html
I know what you're thinking. This all seems too complicated. I agree. :)
I'll update as progress continues.

Steps to Deploy Rails
Posted Oct 24, 2005 — 4 comments below
Posted Oct 24, 2005 — 4 comments below
Jo — Oct 28, 05 468
Scott Stevenson — Oct 28, 05 473
jef — Nov 03, 05 505
Some more RoR & FreeBSD sources you may want to check out: www.flpr.org, www.planetrubyonrails.org, blog.jimvanfleet.com and www.jeremyhubert.com (Installing FastCGI & RoR on FreeBSD).
Jo — Nov 08, 05 519