Monday, February 05, 2007

Rails in Mongrel

Been playing with Ruby on Rails lately.
Actually have tried my hand on Curt Hibb's legendary Rolling with Rails tutorial sometimes ago
while I am also playing with Django, but stop playing with it for a while until last December I saved up enough to buy David Black "Ruby for Rails"



Still have long way to go before finishing the book. But so far, I think this is quite a good book, not just for learning Rails, but also picking up Ruby, the language behind Rails.

I have tried to setup two environments for my rails adventure, one in Windows XP, and another in Fedora Core 6. There are tons of Tutorials online on how to setup RoR in XP and Fedora , so installing rail, creating a simple application, and then launching the rails apps with the standard WEBricks server shouldn't be that big a problem.

But as I tried to install Mongrel as the web server instead in XP environment, even though there are instructions available in Mongrel as well as Ruby on Rails HowTo on the installation, still there some surprises along the way.

From the Mongrel site, installation steps are as follow

  1. $ gem install win32-service (pick the most recent one)
  2. $ gem install mongrel (pick the win32 pre-built)
  3. $ gem install mongrel_service

But, somehow installing one gem will trigger for the message that another gem not listed above is needed. And installing that gem will trigger yet another gem. After a bit of wondering and googling around, I found some bits and pieces here and there, and manage to install mongrel eventually.

Here are the list of gems need to be installed, and in the listed sequence as well.

  1. fastthread-0.6.2-mswin32.gem This is not listed in the official mongrel instruction. Apparently, this is something to do with memory leak management. Here is the reason for this gem.
  2. gem_plugin-0.2.2.gem
  3. cgi_multipart_eof_fix-1.0.0.gem, this is related to DOS vulnerability, see here .
  4. mongrel-1.0.1-mswin32.gem
  5. win32-service-0.5.2-mswin32.gem
  6. mongrel_service-0.3.1-mswin32.gem

After installation, just start the rails application as usual, it will start with Mongrel by default. The sequence of rails looking for web servers is as below,
  1. Mongrel
  2. lighttpd
  3. WEBrick

If you happen to wanna tried out Rails with Mongrel in Windows, this list might save you a little bit of time.


Note: as pointed out by arjen, you could actually do a
gem install mongrel --include-dependencies
the installation will pretty much taking care of itself, but the thing is I am sitting behind a firewall, so have to do the gem installation manually, which lead to this rather messy situation.

7 comments:

Anonymous said...

Use the "--include-dependencies" switch to automaticly install the other gems, like this:

gem install mongrel --include-dependencies

It's pretty self explanatory. Good luck!

Kahfei said...

Hi Arjen, unfortunately I am sitting behind a firewall, and have to do most installation manually, and can't do gem install mongrel -include-dependencies

thanks for the advice though.

mr. c said...

if yer just doing development and not deploying, InstantRails is a pretty good solution for XP and it comes with everything already packages up for you (including mongrel).

Kahfei said...

mr.c, thanks for the tips on instantRails. Well, the impression I have with InstantRails still stay at my early days Rails learning experience, which is pretty bad. Perhaps that is much to do with my own knowledge on RoR at that point than InstantsRails itself.

Maybe I should give another try sometime.

boemitsu said...

Thanks for posting all dependencies for people sitting behind firewalls.

Saved me some research.

Cheers,

Kahfei said...

no problem at all, boemitshu.

Kahfei said...

Oops..sorry, should be boemitsu.