modproxy CLI task

This task is used to generate and merge modproxy configuration as described in documentation. The documentation describes how to configure a modproxy manually.

Preparation

In order to execute the tests you will need:

  • 1 machine hostP with Apache installed. httpd.conf (or default-server.conf) needs to have the following lines
    • LoadModule rewrite_module modules/mod_rewrite.so
    • LoadModule proxy_module modules/mod_proxy.so
    • LoadModule proxy_http_module modules/mod_proxy_http.so
    • LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
    • RewriteEngine on
  • 2 machines to run PZ test applications. (hostA and hostB )
    • On hostA create a directory called apps and run the following commands from there.
      • zero create App1A In zero.config set
              /config/contextRoot = "/App1"
              /config/http/port = 9091
             
      • zero create App2A In zero.config set
              /config/contextRoot = "/App2"
              /config/http/port = 9092
             
    • On hostB create a directory called apps and run the following commands from there.
      • zero create App1B In zero.config set
              /config/contextRoot = "/App1"
              /config/http/port = 9090
             

modproxy generate test

To generate individual configurations:
  • On hostA from App1A application directory run the following command
zero modproxy generate  -o=host1A.conf
  • On hostA from App2A application directory run the following command
zero modproxy generate  -o=host2A.conf
  • On hostB from App1B application directory run the following command
zero modproxy generate -o=host1B.conf

host1A.conf , host2A.conf and host1B.conf are configuration files to route to individual apps. Check files to see if they have

host1A.conf

RewriteRule ^/App1$ /App1/ [R]
<LocationMatch "/App1" >
        Order allow,deny
        Allow from all
        ProxyPass http://hostA:9091/App1
        ProxyPassReverse  http://hostA:9091/App1
</LocationMatch>

host2A.conf

RewriteRule ^/App2$ /App2/ [R]
<LocationMatch "/App2" >
        Order allow,deny
        Allow from all
        ProxyPass http://hostA:9092/App2
        ProxyPassReverse  http://hostA:9092/App2
</LocationMatch>

host1B.conf

RewriteRule ^/App1$ /App1/ [R]
<LocationMatch "/App1" >
        Order allow,deny
        Allow from all
        ProxyPass http://hostB:9090/App1
        ProxyPassReverse  http://hostB:9090/App1
</LocationMatch>

modproxy merge test

Copy host1B.conf and host2A.conf over to hostA/App1A. Run the following command from hostA/App1A directory. zero modproxy merge -o=hostAB.conf -balancer host1A.conf host2A.conf host1B.conf This will produce hostAB.config which will look like the following
RewriteRule ^/App1$ /App1/ [R]
<Proxy balancer://App1Cluster>
        BalancerMember http://hostA:9091/App1 route=mem0
        BalancerMember http://hostB:9090/App1 route=mem1
</Proxy>
<LocationMatch "/App1" >
        Order allow,deny
        Allow from all
        ProxyPass balancer://App1Cluster stickysession=zsessionid nofailover=Off
        ProxyPassReverse  balancer://App1Cluster
</LocationMatch>
RewriteRule ^/App2$ /App2/ [R]
<Proxy balancer://App2Cluster>
        BalancerMember http://hostA:9092/App2 route=mem0
</Proxy>
<LocationMatch "/App2" >
        Order allow,deny
        Allow from all
        ProxyPass balancer://App2Cluster stickysession=zsessionid nofailover=Off
        ProxyPassReverse  balancer://App2Cluster
</LocationMatch>

Testing routing

  • Copy hostAB.config to Apache on hostP .
  • Make sure all the lines in Preparation section are added to the apache config file correctly.
  • At the very end of the config file add the following line
Include <path to hostAB.config>
  • Restart Apache.
  • Start all sMash 3 applications.
  • Access App1 through Apache as =http://hostP/App1
    • Reload several times and you should see the requests being served both by App1A and App1B
  • Access App2 through Apache as =http://hostP/App2
    • Reload several times and you should see the requests always being served by App2A

-- Mandar - 30 Jul 2008

r3 - 10 Sep 2008 - 14:15:33 - timpreece
Syndicate this site RSS ATOM
Copyright 2007 © IBM Corporation | Privacy | Terms of Use | About this site