Multple rails sites in IIS?

Topics: Developer Forum, User Forum
Aug 17, 2007 at 11:58 PM
I would like to setup multiple rails sites (not multiple Virtual directories as some demos have shown). Is this possible? I have several different webapps (running off entirely different domains & sub domains). Anyone got any ideas?

Thanks
Josh
Coordinator
Oct 10, 2007 at 7:01 PM
Hi Josh,

The Microsoft IIS team has released their FCGI ISAPI module go-live (meaning production beta) and I am in the process of testing it. If things work as expected, I plan in the future to replace the current isapi fcgi library with the IIS one.

Here is a link to the site: http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1521

Thanks,
Brent
Jan 17, 2008 at 10:44 PM
Is there any updated documentation on deploying multiple rails sites sites (on different ports) with the current version? Any information would be greatly appreciated.

Thanks,
Jon
Coordinator
Jan 18, 2008 at 12:21 AM
Hey Jon,

I appreciate you asking. Here are the steps for what its worth...
Also note: there is a bug in the isapi_fcgi.dll implementation that I have yet to repair. Assume the following scenario:

(where StartServers = X is the setting in the cooresponding instance's .fcgX registry key)
First Server: StartServers = 2 ruby processes
Second Server: StartServers = 3 ruby processes

When each app runs for the first time:
First Server will spawn 2+3 processes.
Second Server will spawn 2+3 processes.

Now assume you had a Third Server: StartServers = 5 ruby procs
First Server will spawn 235 processes.
Second Server will spawn the same as well as the third.

For a total of 30 ruby processes. I haven't done any extensive testing on the behavior of these "orphaned" ruby procs but it can't be good. So if you use 1 or 2 per instance you will probably be ok depending upon the load requirements of your server.

I plan to fix this bug in the near future (within a month or so) as soon as I do I will post the new version of the installer.

Hope this helps you out,
Brent

Instructions for running multiple (rails) servers on same machine using FCGI.
---------------------------------------------------------------------------------------------------------------------

- Note: fcgx denotes that the x is a number. (eg. fcg2, fcg3 etc...) cooresponding with the number of the server instances.

- Make a copy of the IsapiRewrite4.ini and the IsapiRewrite4.dll isapi filters
- they are located in c:\windows\syswow64\inetsrv (x64) and c:\windows\system32\inetsrv (x32)
- create a new subfolder under c:\windows\syswow64\inetsrv\fcgX (x64)
- copy the original files into the new subfolder

- Edit the IsapiRewrite4.ini
- Ensure you change the bind path to Rails-FCGIX (where X denotes the instance)
- Change any references to .fcgi to .fcgX and save it

- Start - Run - Regedit
- save a copy of the HKLM\SOFTWARE\Fast-CGI\.fcgi (note x64 - HKLM\SOFTWARE\Wow6432Node\Fast-CGI) to your desktop
- edit the file changing cooresponding paths and extensions to .fcgX
- save the file and import the changes to the registry

- Create a new website under IIS admin
- Assign it a name
- browse to new applicationX directory/public
- Create a new appliation pool if you wish
- assign app pool to new website under its properties
- set log file path to applicationX/log directory for IIS logs (optional)

- Add rewrite Isapi Filter to new website (where X denotes your instance number)
- name it REWRITE
- x64 - browse to C:\WINDOWS\SysWOW64\inetsrv\fcgX\IsapiRewrite4.dll
- x32 - browse to C:\WINDOWS\System32\inetsrv\fcgX\IsapiRewrite4.dll

- Add extension mapping for new .fcgX extension (note see manual IIS installation instructions for more info)
- Home Directory tab, Configuration button
- Add application extension
- x64 - browse to C:\WINDOWS\SysWOW64\inetsrv\isapi_fcgi.dll
- set extesion to .fcgX

- Navigate to applicationX install directory/public and rename dispatch.fcgi to dispatch.fcgX

- Restart IIS

Jan 18, 2008 at 4:49 AM
I was getting pretty close and didn't realize it.
Thanks for the details.

Cheers,

Jon
May 20, 2008 at 1:49 PM
any news on this process ophaning issue?

Thanks
Josh
Coordinator
May 20, 2008 at 7:26 PM
Hi Josh,

I have ideas what is causing the orphaned ruby processes but no time to fix it as of yet.  We were using isapi_fcgi internally but have since moved away from ROR apps because of this limitation.  I recommend looking into running apache on windows instead of IIS.

If you know any c++ devs or want to go for it yourself, I can send you the source code for the isapi module, i'm sure its a pretty easy fix I just can't justify the time to do it right now.

Let me know if you want the sorce.
Brent