vpath and vhosts together

Aaron Trevena aaron.trevena at gmail.com
Fri Feb 15 14:41:15 UTC 2008


On 15/02/2008, Jeremy James <jbj at forbidden.co.uk> wrote:
> Aaron Trevena wrote:
>  > On 15/02/2008, Jeremy James <jbj at forbidden.co.uk> wrote:
>  >> Aaron Trevena wrote:
>  >>  > We've got perlbal running on one of our webservers instead of apache
>  >>  > and now I'm working through the rest, but have a little problem..
>  >>  >
>  >>  > one webserver has 2 instances of the backend mod_perl - one live and
>  >>  > one staging, with only 1 ip address for the server I need to use both
>  >>  > vpath and vhost plugin, but they don't appear to work together - the
>  >>  > code for vpath pretty much explicitly states that would be the case.
>  >>  >
>  >>  > So has anybody managed to combine vhost and vpath ?
>  >>
>  >> I did a quick patch a while back to support this - see first patch from
>  >>  http://lists.danga.com/pipermail/perlbal/2007-April/000436.html
>  >
>  > Just to confirm - in order to use vhosts and vpaths, I'd daisychain
>  > the selectors with the vpaths in the 2nd layer selector after applying
>  > the first patch ?
>
>
> Yup. See totally untested imaginary example configuration below. It
>  might contain fewer errors than my previous attempts at posting
>  configuration examples...

Well it works - rather than an untested configuration - here's a
censored snippet of my working config, which will shortly be stressed
by some fairly reasonable load.

####

SERVER aio_mode = ioaio
SERVER pidfile = /var/perlbal.pid
SERVER max_connections = 10000

LOAD vhosts
LOAD vpaths

XS enable headers

CREATE POOL modperl_apache
POOL modperl_apache ADD x.x.x.x:8080

CREATE POOL modperl_apache_staging
POOL modperl_apache_staging ADD x.x.x.x:8081

CREATE POOL master_apache
POOL master_apache ADD y.y.y.y:8080

CREATE SERVICE apache_proxy
  SET role = reverse_proxy
  SET pool = modperl_apache
  SET persist_backend = on
  SET verify_backend = true
  SET enable_reproxy  = true
  SET backend_persist_cache = 4
  SET connect_ahead = 2
ENABLE apache_proxy

CREATE SERVICE master_apache_proxy
  SET role = reverse_proxy
  SET pool = master_apache
  SET persist_backend = on
  SET verify_backend = true
  SET backend_persist_cache = 2
  SET connect_ahead = 2
ENABLE master_apache_proxy

CREATE SERVICE apache_proxy_staging
  SET role = reverse_proxy
  SET pool = modperl_apache_staging
  SET persist_backend = on
  SET verify_backend = true
  SET enable_reproxy  = true
  SET backend_persist_cache = 4
  SET connect_ahead = 2
ENABLE apache_proxy_staging

CREATE SERVICE local_static_images
  SET role = web_server
  SET docroot        = /path/to/images
  SET persist_client = on
  SET dirindexing = 0
ENABLE local_static_images

CREATE SERVICE top_selector
  SET listen = 0.0.0.0:80
  SET role = selector
  SET plugins = vhosts
  VHOST manager.staging.slando.com = apache_proxy_staging
  VHOST * = mainselector
ENABLE top_selector

CREATE SERVICE mainselector
  SET listen = 0.0.0.0:81
  SET role = selector
  SET plugins = vpaths
  VPATH /images/.* = local_static_images
  VPATH /post/.* = master_apache_proxy
  VPATH /admin/.* = master_apache_proxy
  VPATH .* = apache_proxy
ENABLE mainselector

A.

-- 
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Hosting


More information about the perlbal mailing list