Win32 deployment

Has anyone hacked their way through microsoft version of FastCGI for
IIS?

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.”

Marlon M. wrote:

Has anyone hacked their way through microsoft version of FastCGI for IIS?

Installing PHP on Windows Vista with FastCGI | Microsoft Learn
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 R.
http://www.robbyonrails.com/

On 2/5/07, Robby R. [email protected] wrote:

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
(SaltyPickle.com is for sale | HugeDomains)

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

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?

On 2/6/07, Wesley M. [email protected] wrote:

this can be done. There are commerical products (aka: MS ISA Server ~
your IIS apps through it.

– Wes


“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.”

Marlon M. 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.

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

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!

Robby


Robby R.
http://www.robbyonrails.com/

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

On 2/6/07, Marlon M. [email protected] 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

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.

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

On 2/8/07, Brian H. [email protected] wrote:

Marlon M. wrote:

BalancerMemberhttp://127.0.0.1:8000
Good luck!


“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.”

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 :wink:

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

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.

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.

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.

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 (SaltyPickle.com is for sale | HugeDomains) 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

On 2/9/07, David B. [email protected] wrote:

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 L.
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

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! :slight_smile:

On 2/9/07, David B. [email protected] 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! :slight_smile:

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 :slight_smile:

Until then… a bunch of services :stuck_out_tongue:


Luis L.
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

Luis:

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

On 3/8/07, andre in LA [email protected] 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] Pen


Luis L.
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

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