Ruby on Rails tips, tricks and hints for the aspiring rails hero.

Tuesday, June 20, 2006

How to setup Mongrel as a native Window's service

Being that I have to do my Ruby on Rails development in a Windows environment, I jumped at the chance to use the impressive, somewhat-new, lil web server that could Mongrel. I thought it was pretty cool that you could run it as a Windows service. "mongrel_rails start" is just way too much for me to type...seriously, it's like I type "mongrel_rai...what was I doing again?". Adult ADD is real and here to stay people. All semi-kidding aside, here's how to go from zero to mongrel hero in as fast as it takes you to type these next steps:

1. From a command prompt type in

"gem install mongrel" and hit enter...'ll get a whole slew of versions to install and that's normal. Right now, 3.13 for mswin32 is out and that should be #1 so pick that one.

2. After mongrel is installed, test it to make sure you're good to go. "cd" into your application's directory and type in "mongrel_rails start" to make sure Mongrel boots up as it should...

3. If it looks all good and sorted, you'll need to install the win32-service gem, via "gem install win32-service" (pick the most recent one...)

4. Sweet, now install the mongrel_service gem...i'm sure you know the drill by now, it's

gem install mongrel_service

(no screenshots for this step because i'm lazy)

5. Now for the good stuff, actually creating the service...

"mongrel_rails service::install -N MyAppsServiceName -c c:\app\myapp -p 4000 -e production"

I'm sure you can guess the params, but for the sake of completeness I'll go through what they mean. The-N MyAppsServiceName is what the service will be called, -p is the port number it'll run through (you'll probably want to change it if you have multiple apps on your box) and -e is the "mode" you want your app to run in.

6. Bam! Now you should be good to go...


  • At 6:44 AM, Anonymous shane said…

    Does install as a gem inside of your application? Will it cause problems when deploying the app?

    Great write up BTW!

  • At 9:08 PM, Blogger Curtis said…

    it doesn't install as a gem inside of your app. doing the gem install once will allow you to use it for future apps. it shouldn't affect deployment since once deployed.

  • At 12:36 PM, Blogger David J Barnes said…

    Is this with Rails version 2?


Post a Comment

<< Home