OT:Mongrel and Apache

On the off chance someone might understand my dilemma I’m posting this:

Trying to set up Apache with a VirtualHost to pass requests to Mongrel with mod_proxy. Server is running an earlier version of RedHat 3.x maybe ? and Apache v.2.0 (right no mod_proxy_balancer)

I’m not a sys admin so kind of flying by the seat of my pants, though I do have the Mongrel deployment book.

The biggest problem right now is knowing where to put the VirtualHost. My rails app, while a sub folder under /var/www/html/railsapp

is configured like this:
/home/virtual/site8/fst/var/www/html/railsapp
I’ve seen a number of these virtual/site# locations. (i.e virtual/site1, virtual/site2, virtual/site3…)

Yet I’ve looked in various httpd.conf files and find no configuration for these sites
Kind of confusing, and I know my question is just as confusing but if anyone has any insight I’d appreciate it.

TIA
Stuart

``

This configuration, without mod_proxy_balancer, means you'll only be able
to process one concurrent request at a time.

Performance is going to be severely limited.

This configuration, without mod_proxy_balancer, means you’ll only be
able
to process one concurrent request at a time.

Performance is going to be severely limited.

Sounds like I should get an upgrade.

Are you hosting this on your own box or a VPS? If you're using shared
hosting, I'd find someone who will let you proxy to something like Pound. A
slightly less efficient alternative is to have Apache proxy to Pound and
have Pound do the load balancing among the Mongrel cluster.

I don't know how well the latter suggestion would work. Anyone else have any
opinions?

--steve

Dark Ambient wrote:

Are you hosting this on your own box or a VPS? If you’re using shared
hosting, I’d find someone who will let you proxy to something like Pound. A
slightly less efficient alternative is to have Apache proxy to Pound and

have Pound do the load balancing among the Mongrel cluster.

Own box through a host provider. Multiple sites on server.

Stuart

Stuart Fellowes wrote:

On the off chance someone might understand my dilemma I’m posting this:

Trying to set up Apache with a VirtualHost to pass requests to Mongrel
with
mod_proxy. Server is running an earlier version of RedHat 3.x maybe ?
and
Apache v.2.0 (right no mod_proxy_balancer)

I’m not a sys admin so kind of flying by the seat of my pants, though I
do
have the Mongrel deployment book.

The biggest problem right now is knowing where to put the VirtualHost.
My
rails app, while a sub folder under /var/www/html/railsapp
is configured like this:
/home/virtual/site8/fst/var/www/html/railsapp

I’ve seen a number of these virtual/site# locations. (i.e virtual/site1,
virtual/site2, virtual/site3…)

Yet I’ve looked in various httpd.conf files and find no configuration

for
these sites
Kind of confusing, and I know my question is just as confusing but if
anyone
has any insight I’d appreciate it.

TIA
Stuart

Hi Stuart,

The virtual hosts are probably being loaded via an include statement in
the httpd.conf, this allows you to easily manage all of the sites
individually and in an easy to manage structure so you are not directly

editing the httpd.conf. We run the same way and it really hasn’t been a
problem for low traffic sites.

Each site has it’s own conf file, for example site.conf

<VirtualHost 223.555.555.555>
ServerName my.sites.url
DocumentRoot /home/sites/apache/my_site/www
ProxyPass /some/mongrel/process
php_value upload_max_filesize 32M
php_value post_max_size 32M
php_value memory_limit 32M
php_value max_input_time 180

php_value max_execution_time 180
Alias /pic/ /home/sites/some/directory
Alias /javascript/ /home/sites/some/javascript/
Alias /js/ /home/sites/some/javascript/
php_value include_path
‘/home/sites/somesite/lib:/home/sites/otherloc/lib:.’

php_flag register_globals off
php_flag allow_call_time_pass_reference on
php_flag magic_quotes_gpc off
php_value error_reporting 2047
<Files “download.php”>
AcceptPathInfo On

~

and in your httpd.conf have a line like:

Include /home/sites/apache/*.conf

This will load every .conf file in /home/sites/apache and bingo, there
are your vhosts all tidy.

Hope this helps

Yep, I found them all. Thank you. I guess now the problem is the Apache version.

Stuart

This is from the Mongrel site for setting up the proxy:

<VirtualHost *:80>
    ServerName [myapp.com](http://myapp.com)
    ServerAlias [www.myapp.com](http://www.myapp.com)

    ProxyPass / [http://www.myapp.com:8000/](http://www.myapp.com:8000/)
    ProxyPassReverse / [http://www.myapp.com:8000](http://www.myapp.com:8000)
    ProxyPreserveHost on
  </VirtualHost>

The only thing here is I only want requests to be forward when the subdomain is called.
So do I leave ServerName and ServerAlias alone ?
The subdomain would be [
data.myapp.com](http://data.myapp.com)

Do I put that into Proxy Pass and Reverse ?

TIA
Stuart

Proxying from Apache without load balancing somewhere in the mix will give
you relatively poor performance. Tom Mornini commented on this. If Apache
proxies to, say, port 8000 and mongrel is listening on 8000, each request
will have to complete before the next one can be served. Contrast this with
a more typical fcgi or Mongrel cluster setup where there are several Rails
processes any of which can serve a page upon request.

This may not seem like a big deal, but put a little Ajax on your pages and
you *will* be making numerous requests per second. One application instance
will feel pokey. Even if you have to proxy Apache to Pound and have Pound
listen on port 8000, you can then use Pound to do the load balancing among N
Mongrels in a Mongrel cluster. That removes the dependency on a complete
request turnaround.

Anyone? Please correct me if this is incorrect. This is, essentially how my
sites are set up.

Steve

Dark Ambient wrote:

Proxying from Apache without load balancing somewhere in the mix will give
you relatively poor performance. Tom Mornini commented on this.

...snip relevant and insightful information...

Even if you have to proxy Apache to Pound and have Pound listen on port 8000,
you can then use Pound to do the load balancing among N Mongrels in a Mongrel
cluster. That removes the dependency on a complete request turnaround.

Anyone? Please correct me if this is incorrect. This is, essentially how my
sites are set up.

Spot on, and good idea to put a balancer after Apache and before
mongrel_cluster. Generally speaking, I like simpler -vs- more complex, but
installing a new version of Apache may not quality as simpler in this case. :slight_smile:

No, but I’m not going to be the one doing it :).
Seriously, though I looked at Pound, not even sure if it would run on this server. Earlier version of Redhat,
and what else would surprise me.

Stuart

Also , probably a stupid question , but if I have the Rails app on a subdomain do I even need to set up the proxy ?

Stuart