Diamond in the rough: Installing Ruby on Rails with IIS

So I finally got around to watching some Ruby on Rails videos this past weekend, I watch the How to Create a Blog Engine in 15 Minutes demo, and the Evolving your db Schema Without a Sweat demo. After watching both of these demos, I was definitely interested in trying out Rails, so I set out to install it on my home machine, which runs XP Pro.

On the Rails website, it mentions that Rails works best on a *nix OS, and in particular, does not work well with IIS.  I didn’t really want to install Apache on my server, so I set out to try and Rails running without Apache.

In order to get Rails working with IIS, there are a couple of pieces you are going to need.

Now, after you have all of this stuff, there are some steps you need to follow in order to get Rails installed and running properly. The best tutorial I came across in my searching is located here.  I should point out that I have not gotten Rails to run on IIS yet. On either WinXP or Win2003, its got something to do with FastCGI, every time I try to route a page through FastCGI I get the error message “Sorry, unable to connect to FastCGI server”.  Of course, googling for this error message is completely useless.

So now I’m going to bite the bullet and install Apache, which, in the end, isn’t really a bad thing, cause I figure having a working knowledge of Apache is a decent skill to have, so I’ll take the plunge.  Especially if it means I can stop screwing around with all this junk and just starting hacking my first Rails app, which is the whole point of this anyways.

When I come back for round 3 in the fight against Rails on Windows, I’m going to use this tutorial that appears to be detailed enough to help me get Apache and Rails running together on Windows, I will report back after I try that, hopefully running Apache on windows doesn’t bring my system to its knees.

13 Comments so far »

  1. Anonymous said,

    Wrote on February 21, 2006 @ 11:17 am

    Why not just use WEBrick? I think it comes with rails out of the box.

  2. Anonymous said,

    Wrote on February 21, 2006 @ 11:19 am

    For testing and very low-volume sites, I wouldn’t install a server at all. You can just use Ruby’s Webrick (which is what you see in the demos when he types “script/server”, though in windows it would be “ruby script/server” in your website’s root).

    We tried mightily for a few days and couldn’t get RubyIIS to work. I’m fairly convinced the instructions floating around only work with an older version of ActionPack before some sort of change in the Routing (url-rewriting in Rails). I could be wrong of course, but I haven’t seen any claims of success with any 0.13 or later Rails installs.

    Apache is nice of course, but unless you’re planning on public traffic, I wouldn’t bother. You won’t use it during development anyways. Who wants to restart Apache every time you change your environment.rb?

    Still, getting Apache to work with Rails on Windows is pretty easy. Install Apache2. Install ruby-apache or whatever to get the ruby-mod-fcgi bindings. Setup your VirtualDirectory and start Apache.

  3. breichelt said,

    Wrote on February 21, 2006 @ 11:40 am

    Yes, I can use WEBrick, which I have gotten to work and is fine for development, but I would still like to have a decent web server to host web sites if I want to expose them.

    With WEBrick, I would have to run an instance of the server for each website, which I dont like and I dont know how performant it would be hosting multiple sites.

  4. Anonymous said,

    Wrote on February 21, 2006 @ 2:27 pm

    I see… well, that’s basically how Apache w/ FastCGI works anyways. You’ll have generally 4 or 5 fcgi processes spawn for each site. That’s what DHH means when he talks about “easy scaling” since rails apps under fcgi already operate “clustered”.

    But if you want ‘em public, I don’t know that I’d trust Webrick from a security perspective. I don’t know that it’s insecure, but I don’t know that it’s stood up to any sort of formal testing either. So anyways, you’re probably on the right track there… Apache on Windows is really your best bet if you don’t have a *nix available. LightTPD if you do.

    Or you could just not worry about it, and host with TextDrive or PlanetArgon. I host with TD and like ‘em… the plans are reasonable, the SSH access is nice. The support turnaround is quick. They aren’t too stable though. I find myself having to start my LightTPD server at least once a week and my cron job doesn’t seem to run as scheduled. So that’s definitely frustrating. If I had to do it again I’d probably go with PlanetArgon.

  5. Anonymous said,

    Wrote on February 21, 2006 @ 5:30 pm

    You may want to take a look at InstantRails:

    http://rubyforge.org/projects/instantrails/

    Instant Rails is a one-stop Rails runtime solution containing Ruby, Rails, Apache, and MySQL, all preconfigured and ready to run. No installer, you simply drop it into the directory of your choice and run it. It does not modify your system environment.

  6. Anonymous said,

    Wrote on February 22, 2006 @ 5:15 am

    I wrote the tutorial you linked to - I occasionally got an “unable to connect to FastCGI server” when setting things up - it meant that FastCGI could not start Ruby and so terminated. That tended to be because the wrong parameters were being passed to Ruby (or, as I mentioned in the article, the session files were being produced in the wrong place).

    I’m also working on an all-in-one installer - the first version will install your application with WEBrick as a Windows Service and ought to be ready for its first release in about a week. The next version will (hopefully) do a FastCGI IIS installation but that one depends upon one of my customers asking for it …

  7. breichelt said,

    Wrote on February 22, 2006 @ 4:50 pm

    Justin, I saw the InstantRails project, I havent had a chance to try it out, but it seems odd. How can it run a web server and a db server without touching my environment?

    Baz, thanks for the comment, I look forward to an installer. I will take another look at my setup and see if I can iron out the issues.

  8. Baz said,

    Wrote on June 13, 2006 @ 7:39 am

    An alpha release of the reverse proxy is available … it’s not a full install but significantly easier than setting up FastCGI. Nowhere near production quality though.

  9. Randy said,

    Wrote on August 29, 2006 @ 1:40 am

    Yep, I had the same exact problem. “Server Error, unable to connect to fastcgi server.”.

    I’m getting Ruby session files showing up in my temp directory; so I don’t think it’s permissions on the temp directory that’s causing it. Hmmm… don’t know. Any ideas?

  10. ben said,

    Wrote on August 29, 2006 @ 9:22 am

    Randy, I wish I could help you out, but I never got it working quite right, and its been several months since I was messing with it :)
    I got to about the same point you did though, I could see the session files, but got that useless error message.

  11. Peter Boling said,

    Wrote on October 20, 2006 @ 1:25 pm

    I am at the same point as Randy and Ben and have found little ‘recent’ how to’s that can help me out. I must get it working with IIS though, because I need SSO and the ability to access the AUTH_USER server variable… I may post back with success if I am ever successful.

  12. anon said,

    Wrote on January 24, 2007 @ 6:29 pm

    Hi Team,

    I hope the following is useful for getting Ruby on Rails running on IIS.
    http://made-of-stone.blogspot.com/2006/01/rails-on-iis-revisited.html
    Looks like the team there have had some success

  13. Jenn Weller said,

    Wrote on December 6, 2007 @ 2:25 pm

    I would also recommend our white papers, they are a great way of starting up with Ruby Setup: http://www.techcfl.com/ror/white-papers

    Hope it helps.

    Jenn

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Enter my name (ben) in this box, so I know you're a human.

Comment: