Ruby on Rails on Windows

By hillemania

Let’s start of by saying that I’m a huge fanatic of Ruby on Rails. I’ve been using it off and on for a year, but mostly in the last 3 months. Compared to any other framework I’ve tried using it seems to be the fastest, and most concise method for getting things done. For me, getting things done is where it’s really at becuase I always feel like I make progress using Rails.

The one thing that has been frustrating for me has been getting rails to run on Windows. I know that I should be using a Mac, or Linux, but frankly I don’t have either readily available, and I really don’t have much experience with those platforms and haven’t had the time to ramp up. So instead I’ve assumed that surely somebody has got this all working on Windows, as it’s just a slightly popular OS. What I found out was that there were a number of varied options, but they were all thrown together and seemed to be missing critical pieces.

Of course for development you can always use WebBrick, but I actually found some issues using webbrick when my application was making system calls.

My first Windows setup involved Apache 2. That was actually pretty easy, Apache ran a rails app just fine and dandy, however it was using the default cgi which was horribly slow. So fast-cgi seemed the way to go. I can go on and on about how many configs I tried, but I won’t, and in the end I found it to be just plain broken. Then there was scgi, basically the same result, config after config I was getting so frustrated I wanted to just quit.

I decided to take a gander at the lighttpd site. I had heard of this, but I didn’t think it was available for Windows. Lucky me, a version had just come out. I was very reluctant to see if it would work, but I was out of options. In the end it wasn’t bad at all, thanks to this great walkthrough.

Now I’ve got Ruby on Rails on Windows, but there is one more step to the process. In order for my current setup to work I have to have a scgi service running that is tied to each rails app, and when I try to start a second one, the first one gets killed. I don’t know if I can fix that by turning them into a service or not, but that’s my next step. I’ll post the solution if I can get it worked out.

5 Responses to “Ruby on Rails on Windows”

  1. David Sissitka Says:

    Have you considered using Mongrel? If not, Mongrel, MySQL, Rails, and Ruby can be set up within 10 minutes.

    Mongrel – gem install mongrel
    MySQL – http://dev.mysql.com/downloads/
    Ruby – http://rubyforge.org/projects/rubyinstaller/
    Rails – gem install rails –include-dependencies

    No configuration, just “mongrel_rails start” from an application’s root directory (Same place you’d do a “ruby script/server”.) and you’re good to go.

  2. hillemania Says:

    You must have read this before I got me next post up. I stumbled across that solution within minutes of my post.

    Do you have any insight on how robust it is. Can I do multiple virtual hosts, and is it meant for production or just development?

  3. David Sissitka Says:

    For production, proxying to Mongrel from Apache, LightTPD, or LiteSpeed (My preference.) has quickly become the deployment environment of choice for a lot of Rails developers. It’s as effecient as FastCGI with a fraction of the problems. It’s not so hot at serving static content, so use Apache, LightTPD, or LiteSpeed to serve the static content. With Apache you can get by with a little bit of ModRewrite trickery, and using LiteSpeed it’s as easy as setting a static content for the relevant content in the public directory. As for load balancing, you can either run multiple instances of Mongrel or use mongrel_cluster (See: http://mongrel.rubyforge.org/docs/mongrel_cluster.html). In either situation you would proxy to the instances of Mongrel or mongrel_cluster, which is pretty straight forward. If it means anything Rick Olson, the man behind acts_as_versioned and Mephisto (See: http://weblog.rubyonrails.com), is rocking the LiteSpeed and mongrel_cluster combination.

  4. hillemania Says:

    Wow,
    Thanks so much for the information, now I’ve got so much more stuff to try. This is exactly what I was looking for.

  5. james Says:

    Hi,

    I have recently taken a new job in a corporation that is IT-challenged. We have several different RDBMS, including Oracle and SQLserver, so I find myself using Access to “universally” query data via ODBC. Basically, I need to serve data to

Leave a Reply