On Mon, Mar 06, 2006 at 12:29:12PM +0100, Mike D wrote:
} Hi, There''s lots of stuff going on currently with choices of
production
} deployment environments. But I''m not clear on a few things as I need
to
} decide on a production setup where Apache is a given.
}
} A recent thread (http://www.ruby-forum.com/topic/56590) seemed to favor
} Apache 2 with mod_fcgid. And this is supported in articles such as:
}
http://paul.querna.org/journal/articles/2006/01/01/using-mod_fcgid-for-ruby-on-rails-applications
I have had great success with Apache2+fcgid, but then I am not dealing with
a production deployment. When I say success, I mean I was able to put up a
Rails app at a non-root path on my existing Apache2 server.
} And then there''s all the excitement about Mongrel.
}
} Question 1. What are the advantages of mongrel over fastcgi?
} http://mongrel.rubyforge.org/ is not at all clear on this.
} Hint to Zed: How about a "Why use Mongrel" section on the site.
The primary advantage, if any, would be performance. The only way to tell
if this actually is an advantage is to run tests. You would want to run
load tests on a staging environment before releasing to production anyway.
If I remember correctly (and there is a strong chance I do not) there is
something called Watir which is a Ruby web load testing system.
} Question 2. Has anybody used Apache 2 with Mongrel? Is this a good idea?
} Any configuration examples available?
I believe you would set up mongrel to run on a nonstandard port (e.g. 3000)
and configure Apache2 to proxy to it. Unsurprisingly you will need
mod_proxy loaded. The following should work, substituting as appropriate:
ProxyPass /foo/bar http://localhost:3000/
ProxyPassReverse /foo/bar http://localhost:3000/
You will also need to tell Rails to prepend /foo/bar (substitute your path) to
its links. There may be a better way to do this, but the only way I''ve
come up
with is to put the following in your app/controllers/application.rb:
def url_for(options = {}, *parameters_for_method_reference)
normal_url = super(options, *parameters_for_method_reference)
/^http/ =~ normal_url ? normal_url : ''/foo/bar''+normal_url
end
Note that it is probably better to put the prepend path string in
config/environments/production.rb rather than directly in application.rb. There
may be a more elegant solution, but I haven''t come up with it.
} By the way, I''m not talking about a high-volume site. But as this is
on
} a shared server with other (php) applications, efficiency *is* an issue.
Since you are more concerned with resource contention than performance, I
suggest that you monitor disk and memory usage during your load tests
rather than simply reading the numbers from your load testing software.
} Thanks,
} Mike.
--Greg