Win32 deployment

2 views
Skip to first unread message

Marlon Moyer

unread,
Feb 5, 2007, 3:58:30 PM2/5/07
to rubyonrails...@googlegroups.com
Has anyone hacked their way through microsoft version of FastCGI for IIS?

http://www.iis.net/default.aspx?tabid=1000051

I'm trying to get it to work, but it's giving me fits, keeps reporting error 0x80004005


--
"Tradin' my time for the pay I get,
Livin' on money that I ain't made yet,
Gotta keep going, gotta find my way,
But I'll live for the end of the day."

Robby Russell

unread,
Feb 5, 2007, 11:24:20 PM2/5/07
to rubyonrails...@googlegroups.com
Marlon Moyer wrote:
> Has anyone hacked their way through microsoft version of FastCGI for IIS?
>
> http://www.iis.net/default.aspx?tabid=1000051
> <http://www.iis.net/default.aspx?tabid=1000051>
>
> I'm trying to get it to work, but it's giving me fits, keeps reporting
> error 0x80004005
>

I'm not very familiar with the win32 platform, but I hear that Mongrel
runs on it. Have you considered running your application on mongrel and
using IIS (does it do load balancing/proxying?) in front of it rather
than have IIS directly run the application?

Robby

--
Robby Russell
http://www.robbyonrails.com/
http://www.planetargon.com/

Wesley Moxam

unread,
Feb 6, 2007, 1:32:41 AM2/6/07
to rubyonrails...@googlegroups.com
On 2/5/07, Robby Russell <robby...@planetargon.com> wrote:
>
> Marlon Moyer wrote:
> > Has anyone hacked their way through microsoft version of FastCGI for IIS?
> >
> > http://www.iis.net/default.aspx?tabid=1000051
> > <http://www.iis.net/default.aspx?tabid=1000051>
> >
> > I'm trying to get it to work, but it's giving me fits, keeps reporting
> > error 0x80004005
> >
>
> I'm not very familiar with the win32 platform, but I hear that Mongrel
> runs on it. Have you considered running your application on mongrel and
> using IIS (does it do load balancing/proxying?) in front of it rather
> than have IIS directly run the application?

IIS does not have a builtin reverse proxy. There are various ways that
this can be done. There are commerical products (aka: MS ISA Server ~
$1500/processor
(http://www.microsoft.com/isaserver/howtobuy/default.mspx)). There is
also an open source (MIT licenced) ASP.NET application that will do
this for you, but I'm not certain what the performance hit will be
(http://www.saltypickle.com/Home/16)

I'm guessing that you want your rails apps to work through IIS so that
you can run rails apps along side ASP/ASP.NET apps on the same server,
otherwise you'd just use win32 Apache. If that's the case then you're
best option for performance might be to run win32 apache and proxy
your IIS apps through it.

-- Wes

Marlon Moyer

unread,
Feb 6, 2007, 8:46:53 AM2/6/07
to rubyonrails...@googlegroups.com
yes.  Aside from ColdFusion and the new RoR apps that I'm creating, we're a 100% microsoft shop.  Is it possible to run both IIS and Apache on the same win32 server?  I've never tried that, but as long as it wouldn't interfere with the normal IIS operation, I think I could get that done.

As for the reverse proxy, that would only hit 1 mongrel process right? 

Robby Russell

unread,
Feb 6, 2007, 9:00:32 AM2/6/07
to rubyonrails...@googlegroups.com
Marlon Moyer wrote:
> yes. Aside from ColdFusion and the new RoR apps that I'm creating,
> we're a 100% microsoft shop. Is it possible to run both IIS and Apache
> on the same win32 server? I've never tried that, but as long as it
> wouldn't interfere with the normal IIS operation, I think I could get
> that done.
>
> As for the reverse proxy, that would only hit 1 mongrel process right?

Apache (2.2) has a proxy balancer, so you could proxy several mongrel
instances.

Here is a blog post that I just found from a quick google search.

* http://rubyurl.com/z1M

You'll want to look at these sections.

<Proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001
BalancerMember http://127.0.0.1:8002
</Proxy>

and where it's using rewrite to talk to the balancer.

Putting Apache on port 80 and hiding IIS behind it might be a good
solution for many of your hosting needs in your all-windows environment.

Good luck!

Wesley Moxam

unread,
Feb 6, 2007, 12:42:45 PM2/6/07
to rubyonrails...@googlegroups.com
On 2/6/07, Marlon Moyer <marlon...@gmail.com> wrote:
> yes. Aside from ColdFusion and the new RoR apps that I'm creating, we're a
> 100% microsoft shop. Is it possible to run both IIS and Apache on the same
> win32 server? I've never tried that, but as long as it wouldn't interfere
> with the normal IIS operation, I think I could get that done.

Yeah, I've done it so I could run Subversion through Apache, and still
run IIS apps. It means that you have to run your IIS apps on another
port, and proxy through apache.
The downside is that you have to maintain two server configurations
for your IIS apps.

BTW, I looked at the dotNet reverse proxy, but it doesn't seem to
handle relative URLs properly. Otherwise, it might not be a bad choice
for an MS only shop. If you can get it to work it will save you from
having to maintain two web server configurations.

> As for the reverse proxy, that would only hit 1 mongrel process right?

You'll want to have at least two mongrel processes, maybe more
depending on the amount of traffic that your app will receive.

-- Wes

Aníbal Rojas

unread,
Feb 6, 2007, 3:30:24 PM2/6/07
to Deploying Rails
I have run Apache on W2K, it is really easy to install, and stable.
Its configuration is the same than linux so it should not be a
problem. Putting IIS behind is a very good idea.

--
Aníbal Rojas
http://www.rubycorner.com
http://www.hasmanydevelopers.com

On Feb 6, 10:00 am, Robby Russell <robby.li...@planetargon.com> wrote:
> Marlon Moyer wrote:
> > yes. Aside from ColdFusion and the new RoR apps that I'm creating,
> > we're a 100% microsoft shop. Is it possible to run both IIS and Apache
> > on the same win32 server? I've never tried that, but as long as it
> > wouldn't interfere with the normal IIS operation, I think I could get
> > that done.
>
> > As for the reverse proxy, that would only hit 1 mongrel process right?
>
> Apache (2.2) has a proxy balancer, so you could proxy several mongrel
> instances.
>
> Here is a blog post that I just found from a quick google search.
>

> *http://rubyurl.com/z1M


>
> You'll want to look at these sections.
>
> <Proxy balancer://mongrel_cluster>
> BalancerMemberhttp://127.0.0.1:8000
> BalancerMemberhttp://127.0.0.1:8001

> BalancerMemberhttp://127.0.0.1:8002

Brian Hogan

unread,
Feb 8, 2007, 11:09:17 AM2/8/07
to rubyonrails...@googlegroups.com
I'll plug my stuff again

http://www.napcs.com/howto/rails/deploy/index.html

And there's a book coming out that will cover this topic shortly.


On 2/6/07, Aníbal Rojas <aniba...@gmail.com> wrote:

I have run Apache on W2K, it is really easy to install, and stable.
Its configuration is the same than linux so it should not be a
problem. Putting IIS behind is a very good idea.

--
Aníbal Rojas
http://www.rubycorner.com
http://www.hasmanydevelopers.com

On Feb 6, 10:00 am, Robby Russell <robby.li...@planetargon.com > wrote:
> Marlon Moyer wrote:
> > yes.  Aside from ColdFusion and the new RoR apps that I'm creating,
> > we're a 100% microsoft shop.  Is it possible to run both IIS and Apache
> > on the same win32 server?  I've never tried that, but as long as it
> > wouldn't interfere with the normal IIS operation, I think I could get
> > that done.
>
> > As for the reverse proxy, that would only hit 1 mongrel process right?
>
> Apache (2.2) has a proxy balancer, so you could proxy several mongrel
> instances.
>
> Here is a blog post that I just found from a quick google search.
>

Marlon Moyer

unread,
Feb 8, 2007, 11:19:12 AM2/8/07
to rubyonrails...@googlegroups.com
Hey Brian,

I must say that I definitely gleaned a lot of knowledge from your site.  I ended up going with an Apache front to several mongrel processes.  This really is an easy way to deploy.  Luckily our last asp app is on it's way out and I think I'll be able to replace IIS with Apache.  I just need to figure out how to do ssl client certs with it now. 

I had first tried to use Lighttpd as the balancer with your instructions, but I guess they've changed up the syntax of the configuration file.

I also found some additional information here:

http://brainspl.at/articles/2006/06/12/apache2-2-vhost-template-for-mongrel-clusters

Brian Hogan

unread,
Feb 8, 2007, 11:24:09 AM2/8/07
to rubyonrails...@googlegroups.com
Yeah... well lighttpd as the balancer is crappy anyway. It just doesn't perform well cos there are serious bugs in the proxy system.  Apache + mod_proxy_balancer is the way to go.

David Backeus

unread,
Feb 8, 2007, 11:33:28 AM2/8/07
to Deploying Rails
We're actually going to deploy a ROR service this sunday using the
"Integrate Rails into an Existing IIS Web infrastructure using
Mongrel" strategy found on your site (big thanks for sharing that
knowledge btw). Which means we're using ISAPI Rewrite to forward
requests to one mongrel instance.

But looking at how people are usually deploying on *nix platforms with
mongrel_cluster using many mongrel instances on the same machine, I'm
wondering if just having one mongrel instance behind IIS is a bad
idea. Or rather, a non optimal solution.

I haven't really figured out what makes clustered mongrels better than
just having one mongrel though. It's not like I would put up a bunch
of IIS instances on the same machine to serve a .NET app, or a bunch
of Apaches on the same machine to serve a php app. But a bunch of
mongrels are apparently the way to go. How come?

In our case we can't replace IIS with Apache since it would probably
freak out the server administrator completely. And we do have som .NET
stuff on there as well ;)

Ideas of what the best deployment scenario with IIS in front would be
would be much appreciated.

Wesley Moxam

unread,
Feb 8, 2007, 11:51:16 AM2/8/07
to rubyonrails...@googlegroups.com
From the Mongrel FAQ:

"Ruby on Rails is not thread safe so there is a synchronized block
around the calls to Dispatcher.dispatch. This means that everything is
threaded right before and right after Rails runs. While Rails is
running there is only one controller in operation at a time. This is
why people typically have to run a small set of Mongrel processes (a
"Pack of Mongrels") to get good concurrency.

If you have long running actions then you'll most likely have
performance problems. You should look at BackgrounDRB as a very nice
way to offload work to another process so that your Rails app can keep
working."

So if you expect to have more than one concurrent user, then you'll
want multiple mongrels to keep the response time low. If you are
setting up a low usage app (say for internal use) then one mongrel may
be sufficient.

As for running IIS on the front end ... there are a couple of ways
that I can think of:
1) Use apache to reverse proxy the mongrels to a high numbered port.
Then use ISAPI Rewrite to forward requests to apache.
2) Use a proxy application built for IIS that supports multiple back
ends. I found one (http://www.saltypickle.com/Home/16) which is a .NET
app, but in the 15 minutes I played with it, I was not able to get it
working properly (URLs got mangled). You might have better luck than I
did.

There may be better reverse proxy options for IIS out there, and
they'll probably cost you some money. You'll have to do some research.
The official MS solution would be to buy MS ISA server, which costs
$1500/processor.

Good luck!

-- Wes

Brian Hogan

unread,
Feb 8, 2007, 4:21:13 PM2/8/07
to rubyonrails...@googlegroups.com
You'll need more than one instance of Mongrel.  The articles I wrote are all being redone and will be in the Rails Deployment book, so I can't update those on the web. 

Install Apache 2.2 with mod_proxy_balance, make that balance your multiple Mongrels on Windows, and point ISAPI_REWRITE to Apache instead of a single Mongrel.

Or, if you don't like configuration, you can just use Pen, which has a Windows port. Get that running as a service and just point ISAPI_Rewrite to that.

If you really need detailed setups and can't wait for the beta book, contact me off-list.






On 2/8/07, David Backeus <duzt...@gmail.com> wrote:

David Backeus

unread,
Feb 9, 2007, 10:17:31 AM2/9/07
to Deploying Rails
Thanks for all your input.

Going to attempt using Pen.

Right now having problems starting the mongrel cluster. Here's some
output...

C:\ruby\apps\STREAM~1>mongrel_rails cluster::start --verbose
Starting 10 Mongrel servers...
mongrel_rails start -d -e production -p 8000 -P log/mongrel.8000.pid
c:/ruby/lib/ruby/gems/1.8/gems/mongrel_cluster-0.2.1/lib/
mongrel_cluster/init.rb
:53:in ``': Exec format error - mongrel_rails start -d -e production -
p 8000 -P
log/mongrel.8000.pid (Errno::ENOEXEC)

Don't get what the problem is here. I can copy/paste the commandline
(mongrel_rails start -d -e production -p 8000 -P log/mongrel.8000.pid)
and run it just fine.

Luis Lavena

unread,
Feb 9, 2007, 10:31:07 AM2/9/07
to rubyonrails...@googlegroups.com
On 2/9/07, David Backeus <duzt...@gmail.com> wrote:
>
> Thanks for all your input.
>
> Going to attempt using Pen.
>
> Right now having problems starting the mongrel cluster. Here's some
> output...
>
> C:\ruby\apps\STREAM~1>mongrel_rails cluster::start --verbose
> Starting 10 Mongrel servers...
> mongrel_rails start -d -e production -p 8000 -P log/mongrel.8000.pid
> c:/ruby/lib/ruby/gems/1.8/gems/mongrel_cluster-0.2.1/lib/
> mongrel_cluster/init.rb
> :53:in ``': Exec format error - mongrel_rails start -d -e production -
> p 8000 -P
> log/mongrel.8000.pid (Errno::ENOEXEC)
>

The problem is Win32 lacks forking (or daemonize) which is used by
mongrel with -d parameter, to detach from the console and stay
running.

No mongrel_cluster for win32 (yet).

> Don't get what the problem is here. I can copy/paste the commandline
> (mongrel_rails start -d -e production -p 8000 -P log/mongrel.8000.pid)
> and run it just fine.

The workaround is create multiple mongrel_services definitions and set
them to start automatic.

Please refer to Mongrel win32 specific docs at
http://mongrel.rubyforge.org/docs/win32.html

--
Luis Lavena
Multimedia systems
-
Leaders are made, they are not born. They are made by hard effort,
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi

David Backeus

unread,
Feb 9, 2007, 10:36:25 AM2/9/07
to Deploying Rails
Thanks for the quick reply, ironically I was just reading your replies
in this thread:
http://rubyforge.org/forum/forum.php?thread_id=7056&forum_id=5450

A bunch of services it is then! :)

On 9 Feb, 16:31, "Luis Lavena" <luislav...@gmail.com> wrote:


> On 2/9/07, David Backeus <duztdr...@gmail.com> wrote:
>
>
>
>
>
> > Thanks for all your input.
>
> > Going to attempt using Pen.
>
> > Right now having problems starting the mongrel cluster. Here's some
> > output...
>
> > C:\ruby\apps\STREAM~1>mongrel_rails cluster::start --verbose
> > Starting 10 Mongrel servers...
> > mongrel_rails start -d -e production -p 8000 -P log/mongrel.8000.pid
> > c:/ruby/lib/ruby/gems/1.8/gems/mongrel_cluster-0.2.1/lib/
> > mongrel_cluster/init.rb
> > :53:in ``': Exec format error - mongrel_rails start -d -e production -
> > p 8000 -P
> > log/mongrel.8000.pid (Errno::ENOEXEC)
>
> The problem is Win32 lacks forking (or daemonize) which is used by
> mongrel with -d parameter, to detach from the console and stay
> running.
>
> No mongrel_cluster for win32 (yet).
>
> > Don't get what the problem is here. I can copy/paste the commandline
> > (mongrel_rails start -d -e production -p 8000 -P log/mongrel.8000.pid)
> > and run it just fine.
>
> The workaround is create multiple mongrel_services definitions and set
> them to start automatic.
>

> Please refer to Mongrel win32 specific docs athttp://mongrel.rubyforge.org/docs/win32.html

Luis Lavena

unread,
Feb 9, 2007, 10:38:56 AM2/9/07
to rubyonrails...@googlegroups.com
On 2/9/07, David Backeus <duzt...@gmail.com> wrote:
>
> Thanks for the quick reply, ironically I was just reading your replies
> in this thread:
> http://rubyforge.org/forum/forum.php?thread_id=7056&forum_id=5450
>
> A bunch of services it is then! :)
>

Yeah, still need to tweak cluster support built into mongrel_service.
But want ship the new version *batteries included*, ala, ship with a
lightweight TCP balancer just for your mongrels :-)

Until then... a bunch of services :-P

Brian Hogan

unread,
Feb 9, 2007, 11:27:44 AM2/9/07
to rubyonrails...@googlegroups.com
Luis:

Can you email me off list about the balancer? Want to know about more for my book.

andre in LA

unread,
Mar 8, 2007, 3:28:04 PM3/8/07
to Deploying Rails
Hi, I have been following this discussion as I am about to deploy a
rails app in an IIS + ISAPIRewrite + Mongrel environment.

You say that multiple instances of mongrel servers as services will
work out but I am wondering how to make ISAPIRewrite use anything but
the first instance. If the mongrel1 is running at port 7000, then
mongrel2 is running at 7001 then who or what decides which instance
will handle an incoming request?

The proxy rule in the ISAPIRewrite module is

[ISAPI_Rewrite]
RewriteProxy (.*) http://localhost:7000$1 [I,U]

How will the mongrel instance at localhost:7001 get a request?

Thank you!

Andre


On Feb 9, 7:31 am, "Luis Lavena" <luislav...@gmail.com> wrote:


> On 2/9/07, David Backeus <duztdr...@gmail.com> wrote:
>
>
>
>
>
> > Thanks for all your input.
>
> > Going to attempt using Pen.
>
> > Right now having problems starting the mongrel cluster. Here's some
> > output...
>
> > C:\ruby\apps\STREAM~1>mongrel_rails cluster::start --verbose
> > Starting 10 Mongrel servers...
> > mongrel_rails start -d -e production -p 8000 -P log/mongrel.8000.pid
> > c:/ruby/lib/ruby/gems/1.8/gems/mongrel_cluster-0.2.1/lib/
> > mongrel_cluster/init.rb
> > :53:in ``': Exec format error - mongrel_rails start -d -e production -
> > p 8000 -P
> > log/mongrel.8000.pid (Errno::ENOEXEC)
>
> The problem is Win32 lacks forking (or daemonize) which is used by
> mongrel with -d parameter, to detach from the console and stay
> running.
>
> No mongrel_cluster for win32 (yet).
>
> > Don't get what the problem is here. I can copy/paste the commandline
> > (mongrel_rails start -d -e production -p 8000 -P log/mongrel.8000.pid)
> > and run it just fine.
>
> The workaround is create multiple mongrel_services definitions and set
> them to start automatic.
>

> Please refer to Mongrel win32 specific docs athttp://mongrel.rubyforge.org/docs/win32.html

Luis Lavena

unread,
Mar 8, 2007, 3:35:57 PM3/8/07
to rubyonrails...@googlegroups.com
On 3/8/07, andre in LA <andr...@gmail.com> wrote:
>
> Hi, I have been following this discussion as I am about to deploy a
> rails app in an IIS + ISAPIRewrite + Mongrel environment.
>
> You say that multiple instances of mongrel servers as services will
> work out but I am wondering how to make ISAPIRewrite use anything but
> the first instance. If the mongrel1 is running at port 7000, then
> mongrel2 is running at 7001 then who or what decides which instance
> will handle an incoming request?
>

ISAPIRewrite don't know anything about if you have one or a bunch of mongrels.

So, you ned to drop Pen [1] into the equation. Pen will handle the
balance between instances.


[1] http://siag.nu/pen/

andre in LA

unread,
Mar 8, 2007, 3:59:53 PM3/8/07
to Deploying Rails
Thank you for the quick reply. I see that the windows version of Pen
requires Cygwin. Unfortunately I couldn't find any documentation on
Pen configuration.

Any suggestions for a configuration running Pen between ISAPIRewrite
and a bunch of Mongrels? They'll be running on a win2k machine with
IIS serving a number of static IPs, the rails website being run at one
of the IPs.

-- Andre

On Mar 8, 12:35 pm, "Luis Lavena" <luislav...@gmail.com> wrote:

Brian Hogan

unread,
Mar 12, 2007, 2:46:01 PM3/12/07
to rubyonrails...@googlegroups.com
I've posted solutions to this on the list... if you can't find them feel free to email me directly.

andre in LA

unread,
Mar 18, 2007, 6:33:16 PM3/18/07
to Deploying Rails
Brian, I looked for the solutions (pen + cygwin + mongrel + iis or
windows) but couldn't find the thread I think you are referring to.

Could you please post a link?

I emailed you a week ago but I am not sure my message reached you.

Thank you.

On Mar 12, 11:46 am, "Brian Hogan" <bpho...@gmail.com> wrote:
> I've posted solutions to this on the list... if you can't find them feel
> free to email me directly.
>

Reply all
Reply to author
Forward
0 new messages