ISAPI Ruby
How about an ISAPI filter that intercepts all requests to a given IIS site?
- On startup kick-start n WEBrick/Mongrel processes running on ports x to x + n.
- It examines the URL to see if it has a '.' in it.
- If yes
- Pass it to IIS to deal with (so that ASP.NET pages and static files are dealt with)
- If no
- Use a simple load-balancing algorithm (round-robin will do to start with although it would be better to work like FastCGI and have the option of starting new processes when demand is high)
- Proxy the request in its entirety to the selected WEBrick/Mongrel instance
- Return the response in its entirety to the client
- On shutdown, gracefully bring down the N WEBrick/Mongrel processes.
This should mean that there is no Rewriter to set up and no FastCGI.
Installation should consist of installing Ruby, Rails, (maybe Mongrel), your application and the ISAPI filter (all of which ought to be easy).
The ISAPI filter ought to be relatively easy to write - all it does it control the WEBrick/Mongrel processes and proxy requests to them.
It would be even easier using an ISAPI application - however, that would require the rewriter (as the URL would change from /mycontroller/myaction/myid to /RubyISAPI.DLL/mycontroller/myaction/myid for the ISAPI to be invoked. However, that's the easy bit of the install - it's FastCGI that causes the grief, so it may well be worth looking at.
3 comments:
Thanks to all the work done here and I've found in comments, I've got RoR working well except for one major issue. I need to allow periods in the url parameter values. I don't really have a way around this as I don't control the url generation. I've followed the code here (http://made-of-stone.blogspot.com/2006/01/rails-on-iis-revisited.html#c114207895107828036)
and that works great (tho I do wonder if I can't pass * through anymore). Has anyone figured out a way to let periods through without messing up static files?
Thanks!
Chad
I'm thinking of getting my ISAPI to pass all requests through to the back-end server (WEBrick/Mongrel) - so that ought to do it for you, although maybe not at its fastest (I have started work on the DLL by the way - providing nothing else gets in the way I estimate it will be ready in about two weeks).
An alternative is to look at the rewrite string - ignore anything ending in .jpg/.aspx/.html or whatever and send everything else to Rails.
This sounds very good :)
Post a Comment