AW: multiple instances of one web application

[prev] [thread] [next] [Date index for 2004/11/16]

From: Gernot Homma
Subject: AW: multiple instances of one web application
Date: 16:51 on 16 Nov 2004
------_=_NextPart_001_01C4CBFC.93B86970
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello Harald,
=20
i think you can use instances instead of classes, under mod_perl 1 i =
have
the following setup (the code ist just to show how it should work ;.)
under mod_perl, i think you just have to change the name of the
directives(PerlHandler =3D> PerlResponseHandler), but i'm not shure, i =
haven't
tried it out until now.
=20
package MyApp {
sub handler {
 # do your stuff here
}
}
=20
a startup script "startup.pl"
=20
$MyApp::Instance1 =3D new MyApp( # some configuration stuff);=20
$MyApp::Instance2 =3D new MyApp( # other configuration stuff);
=20
and in httpd.conf
=20
<VirtualHost xyz>
<Perl>
    require 'startup.pl';
</Perl>
<Location /instance1>
   SetHandler perl-script
   PerlHandler $MyApp::Instance1
</Location>
<Location /instance2>
   SetHandler perl-script
   PerlHandler $MyApp::Instance2
</Location>
</VirtualHost>
=20
hope that helps,
=20
greetings gernot

-----Urspr=FCngliche Nachricht-----
Von: Harald Meier [mailto:meh1@xxx.xx]
Gesendet: Dienstag, 16. November 2004 15:36
An: modperl@xxxx.xxxxxx.xxx
Betreff: multiple instances of one web application


dear group,

i am developing a web application using apache 2.0 and mod_perl 2.0.
the application is split into a couple of perl modules.

i would like to install the same application more than once on the same =

web-server without changing the application code.

so
    http://www.foo.bar/myapp/instance1 =
<http://www.foo.bar/myapp/instance1>;
calls instance 1
    http://www.foo.bar/myapp/instance2 =
<http://www.foo.bar/myapp/instance2>;
calls instance 2
    ...

i have no idea how to handle the module/library problem to make sure =
that=20
each instance loads its own modules and if a module has changed, the =
correct

module is reloaded.

i  cannot use <VirtualServer> because the servername will always be the
same.

my httpd.conf (works only for single instance):

   PerlSwitches -w -T -M/opt/myapp/instance1

   PerlModule      Apache::Reload
   PerlInitHandler Apache::Reload
   PerlSetVar      ReloadAll On

   <Location /myapp/instance1>
       SetHandler                     perl-script
       PerlResponseHandler     myapp
       PerlOptions                    +SetupEnv
   </Location>


thanks for your help!
harald.=20

=20


------_=_NextPart_001_01C4CBFC.93B86970
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.2800.1458" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff size=2>Hello 
Harald,</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff size=2>i 
think you can use instances instead of classes, under mod_perl 1 i have the 
following setup (the code ist just to show how it should work 
;.)</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff size=2>under 
mod_perl, i think you just have to change the name of the directives(PerlHandler 
=&gt; PerlResponseHandler), but i'm not shure, i haven't tried it out until 
now.</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>package MyApp {</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff size=2>sub 
handler {</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&nbsp;#&nbsp;do your stuff here</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>}</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>}</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff size=2>a 
startup script "startup.pl"</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>$MyApp::Instance1 = new MyApp( # some configuration stuff); 
</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>$MyApp::Instance2 = new MyApp( # other configuration 
stuff);</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff size=2>and in 
httpd.conf</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&lt;VirtualHost xyz&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&lt;Perl&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&nbsp;&nbsp;&nbsp; require 
'startup.pl';<BR>&lt;/Perl&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&lt;Location /instance1&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&nbsp;&nbsp; SetHandler perl-script</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&nbsp;&nbsp; PerlHandler $MyApp::Instance1</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&lt;/Location&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&lt;Location /instance2&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&nbsp;&nbsp; SetHandler perl-script</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&nbsp;&nbsp; PerlHandler $MyApp::Instance2</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&lt;/Location&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>&lt;/VirtualHost&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff size=2>hope 
that helps,</FONT></SPAN></DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=797274116-16112004><FONT face=Arial color=#0000ff 
size=2>greetings gernot</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Ursprüngliche Nachricht-----<BR><B>Von:</B> Harald Meier 
  [mailto:meh1@xxx.xx]<BR><B>Gesendet:</B>; Dienstag, 16. November 2004 
  15:36<BR><B>An:</B> modperl@xxxx.xxxxxx.xxx<BR><B>Betreff:</B> multiple 
  instances of one web application<BR><BR></FONT></DIV>dear group,<BR><BR>i am 
  developing a web application using apache 2.0 and mod_perl 2.0.<BR>the 
  application is split into a couple of perl modules.<BR><BR>i would like to 
  install the same application more than once on the same&nbsp;<BR>web-server 
  without changing the application code.<BR><BR>so<BR>&nbsp;&nbsp;&nbsp; <A 
  href="http://www.foo.bar/myapp/instance1">http://www.foo.bar/myapp/instance1</A>; 
  calls instance 1<BR>&nbsp;&nbsp;&nbsp; <A 
  href="http://www.foo.bar/myapp/instance2">http://www.foo.bar/myapp/instance2</A>; 
  calls instance 2<BR>&nbsp;&nbsp;&nbsp; ...<BR><BR>i have no idea how to handle 
  the module/library problem to make sure that&nbsp;<BR>each instance loads its 
  own modules and if a module has changed, the correct&nbsp;<BR>module is 
  reloaded.<BR><BR>i &nbsp;cannot use &lt;VirtualServer&gt; because the 
  servername will always be the same.<BR><BR>my httpd.conf (works only for 
  single instance):<BR><BR>&nbsp;&nbsp; PerlSwitches -w -T 
  -M/opt/myapp/instance1<BR><BR>&nbsp;&nbsp; 
  PerlModule&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Apache::Reload<BR>&nbsp;&nbsp; 
  PerlInitHandler Apache::Reload<BR>&nbsp;&nbsp; 
  PerlSetVar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReloadAll On<BR><BR>&nbsp;&nbsp; 
  &lt;Location /myapp/instance1&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  SetHandler&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  perl-script<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  PerlResponseHandler&nbsp;&nbsp;&nbsp;&nbsp; 
  myapp<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  PerlOptions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  +SetupEnv<BR>&nbsp;&nbsp; &lt;/Location&gt;<BR><BR><BR>thanks for your 
  help!<BR>harald.&nbsp;<BR>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C4CBFC.93B86970--

AW: multiple instances of one web application
Gernot Homma 16:51 on 16 Nov 2004

Re: multiple instances of one web application
Harald Meier 10:51 on 17 Nov 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52