[rt-users] Second Instance Of RT (for branding purposes)

Doug Eubanks admin at dougware.net
Tue Feb 24 12:06:11 EST 2009


That's what I have, two different webmux.pl files...

They are in the same /opt/rt3/bin folder...

The old brand is called webmux.pl, the new brand is called webmux-brandy.pl

They are called in httpd.conf with these two separate lines in their
respective host entries...
PerlRequire /opt/rt3/bin/webmux-brandy.pl
PerlRequire /opt/rt3/bin/webmux.pl

Sincerely,
Doug Eubanks
admin at dougware.net


On Tue, Feb 24, 2009 at 11:54 AM, Raed El-Hames <rfh at vialtus.com> wrote:

> Doug;
>
> Looking at the http conf file you sent below, you seem to call the same
> webmux.pl
>
> PerlRequire /opt/rt3/bin/webmux.pl
>
> You 'll need to have multiple versions of webmux.pl  in each version you
> add the line
> $ENV{'SERVER'}    = 'my_brand(?)_instance.com <
> http://my_brandx_instance.com>
>
> For example you have tickets.brandy.com <http://tickets.brandy.com> and
> tickets.brandx.com <http://tickets.brandy.com>
>
> httpd.conf :
>
> <VirtualHost tickets.brandy.com <http://tickets.brandy.com>:80>
>   ServerName tickets.brandy.com <http://tickets.brandy.com>
>   DocumentRoot /opt/rt3/share/html
>   etc etc etc
>     PerlRequire /opt/rt3/bin/webmux-brandy <http://tickets.brandy.com>.pl
>
>   etc etc etc
> </VirtualHost>
>
> <VirtualHost tickets.brandx.com <http://tickets.brandy.com>:80>
>   ServerName tickets.brandx.com <http://tickets.brandy.com>
>   DocumentRoot /opt/rt3/share/html
>   etc etc etc
>     PerlRequire /opt/rt3/bin/webmux-brandx <http://tickets.brandy.com>.pl
>
>   etc etc etc
> </VirtualHost>
>
>
> Now webmux:
> You should have atleast 2 copies in /opt/rt3/bin one called webmux-brandy <
> http://tickets.brandy.com>.pl and the other webmux-brandx <
> http://tickets.brandy.com>.pl
>
> Edit webmux-brandy <http://tickets.brandy.com>.pl adding the line:
>   $ENV{'SERVER'}    = 'tickets.brandy.com <http://tickets.brandy.com>';
>  where ENV is being set
>  so basically you'll end up with something similar to:
>
> BEGIN {
>   $ENV{'PATH'}   = '/bin:/usr/bin';                     # or whatever you
> need
>   $ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
>   $ENV{'SHELL'}  = '/bin/sh' if defined $ENV{'SHELL'};
>   $ENV{'ENV'}    = '' if defined $ENV{'ENV'};
>   $ENV{'IFS'}    = '' if defined $ENV{'IFS'};
>   $ENV{'SERVER'}    = 'tickets.brandy.com <http://tickets.brandy.com>';
>
> Now edit webmux-brandx <http://tickets.brandy.com>.pl adding the line
>  $ENV{'SERVER'}    = 'tickets.brandx.com <http://tickets.brandy.com>';
>  where ENV is being set
>  so basically you'll end up with something similar to:
>
> BEGIN {
>   $ENV{'PATH'}   = '/bin:/usr/bin';                     # or whatever you
> need
>   $ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
>   $ENV{'SHELL'}  = '/bin/sh' if defined $ENV{'SHELL'};
>   $ENV{'ENV'}    = '' if defined $ENV{'ENV'};
>   $ENV{'IFS'}    = '' if defined $ENV{'IFS'};
>   $ENV{'SERVER'}    = 'tickets.brandy.com <http://tickets.brandy.com>';
>
>
> Now RT.pm
> at the start of sub LoadConfig add the lines:
>
>  if ($ENV{'SERVER'} eq 'tickets.brandx.com <http://tickets.brandy.com>' )
> {
>       $SITE_CONFIG_FILE = '/opt/rt3/local/etc/RT_SiteConfig_brandx.pm' ;
>  } elsif ($ENV{'SERVER'} eq 'tickets.brandy.com <http://tickets.brandy.com>'
> ) {
>      $SITE_CONFIG_FILE = '/opt/rt3/local/etc/RT_SiteConfig_brandy.pm' ;
>  }
>
>
> Now RT_SiteConfig:
>
> You should have atleast 2 copies  RT_SiteConfig_brandx.pm, and
> RT_SiteConfig_brandy.pm each have the instance customisation  ,
>
> And thats it..
>
> Roy
>
>
>
>
>
> Doug Eubanks wrote:
>
>> I'm so close now....but it's always selecting brandy (the new brand).  I'm
>> sure it's something small and simply that I'm missing now.  I really
>> appreciate your help so far.
>>
>> I know the whole brandx, brandy thing is a little confusing.  I've double
>> checked all of the refences below, and brandx and brandy are used the
>> correct spots in each code snippet below.
>>
>> Here is the output of the foo file that shows that the ENV variables are
>> being set:
>>
>> tickets.brandy.com <http://tickets.brandy.com> <http://tickets.brandy.com
>> >
>> tickets.brandx.com <http://tickets.brandx.com> <http://tickets.brandx.com
>> >
>> tickets.brandy.com <http://tickets.brandy.com> <http://tickets.brandy.com
>> >
>> tickets.brandx.com <http://tickets.brandx.com> <http://tickets.brandx.com
>> >
>> tickets.brandy.com <http://tickets.brandy.com> <http://tickets.brandy.com
>> >
>> tickets.brandx.com <http://tickets.brandx.com> <http://tickets.brandx.com
>> >
>> tickets.brandy.com <http://tickets.brandy.com> <http://tickets.brandy.com
>> >
>> tickets.brandx.com <http://tickets.brandx.com> <http://tickets.brandx.com
>> >
>> tickets.brandy.com <http://tickets.brandy.com> <http://tickets.brandy.com
>> >
>> tickets.brandx.com <http://tickets.brandx.com> <http://tickets.brandx.com
>> >
>>
>> I've double checked the httpd.conf file, inside of the brandy site, we
>> have
>> PerlRequire /opt/rt3/bin/webmux-brandy.pl
>>
>> Inside of the brandx site, we have
>> PerlRequire /opt/rt3/bin/webmux.pl
>>
>> Here's my webmux.pl changes for the old brand:
>> #This drags in RT's config.pm <http://config.pm>
>> BEGIN {
>>    $ENV{'SERVER'}    = 'tickets.brandx.com <http://tickets.brandx.com> <
>> http://tickets.brandx.com>';
>>    RT::LoadConfig();
>>    if ($RT::DevelMode) { require Module::Refresh; }
>> }
>>
>> Here's my webmux-brandy.pl changes for the old brand:
>> #This drags in RT's config.pm <http://config.pm>
>> BEGIN {
>>    $ENV{'SERVER'}    = 'tickets.brandy.com <http://tickets.brandy.com> <
>> http://tickets.brandy.com>';
>>    RT::LoadConfig();
>>    if ($RT::DevelMode) { require Module::Refresh; }
>> }
>>
>> This is my RT.pm LoadConfig sub, right before it stats and loads the site
>> config file:
>> my $ser = $ENV{'SERVER'} ;
>> open F, ">> /tmp/foo" ;
>>  print F "$ser \n";
>> close F;
>>
>> if ($ENV{'SERVER'} eq "tickets.brandy.com <http://tickets.brandy.com> <
>> http://tickets.brandy.com>") {
>>      $SITE_CONFIG_FILE = '/opt/rt3/etc/RT_SiteConfig-Refense.pm' ;
>> }
>> if ($ENV{'SERVER'} eq "tickets.brandx.com <http://tickets.brandx.com> <
>> http://tickets.brandx.com>") {
>>      $SITE_CONFIG_FILE = '/opt/rt3/etc/RT_SiteConfig.pm' ;
>> }
>>
>>
>> Sincerely,
>> Doug Eubanks
>> admin at dougware.net <mailto:admin at dougware.net>
>>
>>
>> On Tue, Feb 24, 2009 at 9:53 AM, Raed El-Hames <rfh at vialtus.com <mailto:
>> rfh at vialtus.com>> wrote:
>>
>>    Sorry Doug my mistake its been a long time since I did this:
>>    we set :
>>    $ENV{'SERVER'}    = 'my_brandx_instance.com
>>    <http://my_brandx_instance.com> <http://my_brandx_instance.com> in
>>    the relavent webmux-brandx.pl , it would n't have existed before ..
>>    The best bet to see if its loaded into ENV is by adding a print
>>    statement in RT.pm LoadConfig, looking at my dev code I think I
>>    managed to do something like
>>    sub LoadConfig {
>>
>>    my $ser = $ENV{'SERVER'} ;
>>    open F, ">> /opt/rt3/bin/foo" ;
>>      print F "$ser \n";
>>    close F;
>>
>>
>>    if ($ENV{'SERVER'} eq 'my_brandx_instance.com
>>    <http://my_brandx_instance.com> <http://my_brandx_instance.com>' ) {
>>          $SITE_CONFIG_FILE =
>>    '/opt/rt3/local/etc/RT_SiteConfig_brandx.pm' ;
>>    }
>>
>>    I think at the time of restarting apache something will be written
>>    to the foo file
>>
>>    Roy
>>
>>    Doug Eubanks wrote:
>>
>>        Here is my relevant httpd.conf sections....I've sanitized the
>>        hostnames......
>>
>>        <VirtualHost *:80>
>>           CacheEnable disk /
>>           ServerAdmin support at brandy.com <mailto:support at brandy.com>
>>        <mailto:support at brandy.com <mailto:support at brandy.com>>
>>
>>           DocumentRoot /opt/rt3/share/html
>>           ServerName tickets.brandy.com <http://tickets.brandy.com>
>>        <http://tickets.brandy.com>
>>           ServerAlias tickets.brandy.com <http://tickets.brandy.com>
>>        <http://tickets.brandy.com> tickets2.brandy.com
>>        <http://tickets2.brandy.com> <http://tickets2.brandy.com>
>>        ticket.brandy.com <http://ticket.brandy.com>
>>        <http://ticket.brandy.com> ticket2.brandy.com
>>        <http://ticket2.brandy.com> <http://ticket2.brandy.com>
>>
>>           AddDefaultCharset UTF-8
>>
>>           PerlModule Apache::DBI
>>           PerlRequire /opt/rt3/bin/webmux.pl
>>
>>           PerlSetVar MasonStaticSource true
>>           PerlSetVar MasonBufferPreallocateSize 1073741824
>>           PerlSetVar MasonDataCacheDefaults "cache_class=>
>>        SharedMemoryCache, cache_de                         $
>>           PerlSetVar MasonPreloads '/Elements/*'
>>           PerlSetVar MasonCompRoot /opt/rt3
>>
>>           SetHandler perl-script
>>           PerlHandler RT::Mason
>>
>>           Alias /titan /opt/rt3/share/html
>>
>>         # ScriptAlias /titan/ /opt/rt3/share/html
>>
>>        </VirtualHost>
>>
>>        <VirtualHost *:80>
>>           CacheEnable disk /
>>           ServerAdmin support at brandx.com <mailto:support at brandx.com>
>>        <mailto:support at brandx.com <mailto:support at brandx.com>>
>>
>>           DocumentRoot /opt/rt3/share/html
>>           ServerName tickets.brandx.com <http://tickets.brandx.com>
>>        <http://tickets.brandx.com>
>>           ServerAlias tickets.brandx.com <http://tickets.brandx.com>
>>        <http://tickets.brandx.com> tickets2.brandx.com
>>        <http://tickets2.brandx.com> <http://tickets2.brandx.com>
>>        ticket.brandx.com <http://ticket.brandx.com>
>>        <http://ticket.brandx.com> ticket2.brandx.com
>>        <http://ticket2.brandx.com> <http://ticket2.brandx.com>
>>
>>           AddDefaultCharset UTF-8
>>
>>           PerlModule Apache::DBI
>>           PerlRequire /opt/rt3/bin/webmux.pl
>>
>>           PerlSetVar MasonStaticSource true
>>           PerlSetVar MasonBufferPreallocateSize 1073741824
>>           PerlSetVar MasonDataCacheDefaults "cache_class=>
>>        SharedMemoryCache, cache_de                         $
>>           PerlSetVar MasonPreloads '/Elements/*'
>>           PerlSetVar MasonCompRoot /opt/rt3
>>
>>           SetHandler perl-script
>>           PerlHandler RT::Mason
>>
>>           Alias /refense /opt/rt3/share/html
>>
>>         # ScriptAlias /refense/ /opt/rt3/share/html
>>
>>           ErrorLog logs/error_log-tickets
>>
>>        </VirtualHost>
>>
>>        Sincerely,
>>        Doug Eubanks
>>        admin at dougware.net <mailto:admin at dougware.net>
>>        <mailto:admin at dougware.net <mailto:admin at dougware.net>>
>>
>>
>>        On Tue, Feb 24, 2009 at 5:45 AM, Raed El-Hames
>>        <rfh at vialtus.com <mailto:rfh at vialtus.com>
>>        <mailto:rfh at vialtus.com <mailto:rfh at vialtus.com>>> wrote:
>>
>>           Hi Doug;
>>
>>           Make sure you have
>>           ServerName   my_brandx_instance.com
>>        <http://my_brandx_instance.com>
>>           <http://my_brandx_instance.com>
>>        <http://my_brandx_instance.com>
>>
>>           in your virtual host conf file;
>>
>>           <VirtualHost my_brandx.com:443 <http://my_brandx.com:443>
>>        <http://my_brandx.com:443>>
>>             ServerName my_brandx.com <http://my_brandx.com>
>>        <http://my_brandx.com>
>>
>>             DocumentRoot /opt/rt3/share/html
>>            etc etc
>>
>>            ...
>>           </VirtualHost>
>>
>>           And remember to restart httpd ..
>>
>>           Good luck;
>>           Roy
>>
>>           Doug Eubanks wrote:
>>
>>               I believe I see where you are going with this....
>>
>>               My problem is that $ENV{'SERVER}, $ENV{'SERVER_NAME},
>>        etc are
>>               not being set to anything.  When I had it print all the ENV
>>               variables to a temp file, it only printed 4 or 5
>>        variables and
>>               they were stuff like "MOD_PERL" version, etc.
>>
>>               For some reason, those environment variables are not
>>        set....
>>
>>               Sincerely,
>>               Doug Eubanks
>>               admin at dougware.net <mailto:admin at dougware.net>
>>        <mailto:admin at dougware.net <mailto:admin at dougware.net>>
>>               <mailto:admin at dougware.net <mailto:admin at dougware.net>
>>        <mailto:admin at dougware.net <mailto:admin at dougware.net>>>
>>
>>
>>
>>               On Mon, Feb 23, 2009 at 12:35 PM, Raed El-Hames
>>               <rfh at vialtus.com <mailto:rfh at vialtus.com>
>>        <mailto:rfh at vialtus.com <mailto:rfh at vialtus.com>>
>>               <mailto:rfh at vialtus.com <mailto:rfh at vialtus.com>
>>        <mailto:rfh at vialtus.com <mailto:rfh at vialtus.com>>>> wrote:
>>
>>                  Doug;
>>
>>                  Are you using fast cgi , or mod_perl ??, with
>>        fastcgi you
>>               can run
>>                  as many instances you want  --sorry I don't use so I
>>        do n't
>>               have
>>                  working apache config,
>>                  with mod_perl you suppose to only run one instance
>>        due to
>>               how the
>>                  mod_perl/mason work, however I did find a work
>>        around and
>>               this is
>>                  how I got my instances working:
>>
>>                  for each instance (brand), I have
>>                  RT_SiteConfig_brandx.pm (all in /opt/rt3/local/etc/ )
>>                  webmux-brandx.pl (which is a copy of webmux.pl
>>        adding the line
>>                   $ENV{'SERVER'}    = 'my_brandx_instance.com
>>        <http://my_brandx_instance.com>
>>               <http://my_brandx_instance.com>
>>                  <http://my_brandx_instance.com>'; #at the top where the
>>               rest of
>>
>>                  $ENV is being defined
>>
>>                  Modify local/lib/RT.pm adding :
>>
>>                  if ($ENV{'SERVER'} eq 'my_brandx_instance.com
>>        <http://my_brandx_instance.com>
>>               <http://my_brandx_instance.com>
>>                  <http://my_brandx_instance.com>' ) {
>>
>>                        $SITE_CONFIG_FILE =
>>                  '/opt/rt3/local/etc/RT_SiteConfig_brandx.pm' ;
>>                  }elsif ($ENV{'SERVER'} eq 'my_brandy_instance.com
>>        <http://my_brandy_instance.com>
>>               <http://my_brandy_instance.com>
>>                  <http://my_brandy_instance.com>' ) {
>>
>>                        $SITE_CONFIG_FILE =
>>                  '/opt/rt3/local/etc/RT_SiteConfig_brandy.pm' ;
>>                  }
>>
>>                  You add these lines @ the top/start of sub LoadConfig
>>
>>                  In you httpd.conf you call the correct webmux for your
>>               instance:
>>                  PerlRequire /opt/rt3/bin/webmux-brandx.pl
>>
>>                  Thats it, the above setup allow you to share the same RT
>>               directory
>>                  , so customisation is easier,
>>
>>                  Hope that helps,
>>
>>                  Regards;
>>                  Roy
>>
>>
>>                  Doug Eubanks wrote:
>>
>>                      I'm trying to setup a second instance of RT that
>>        has a
>>                      different branding, but uses the same SQL
>>        server, etc.
>>
>>                      I copied my existing (and working) RT
>>        installation over
>>               to a
>>                      new directory.  Then I created the new instance in
>>               Apache in
>>                      the httpd.conf, changing the file locations to
>>        the new
>>                      directories.  Then I edited the RT_SiteConfig.pm
>>        file to
>>                      reflect the new file locations.
>>
>>                      For some reason, the errors are showing up in
>>        the original
>>                      directory's logs and the error returned is:
>>                      [Mon Feb 23 15:47:56 2009] [warning]: [Mason] Cannot
>>               resolve
>>                      file to component:
>>               /opt/rt3-[NEWBRAND]/share/html/index.html
>>                      (is file outside component root?) at
>>
>>  /usr/lib/perl5/vendor_perl/5.8.8/HTML/Mason/ApacheHandler.pm
>>                      line 853.
>>
>>  (/usr/lib/perl5/vendor_perl/5.8.8/HTML/Mason/ApacheHandler.pm:853)
>>
>>                      The browser returns a 404 error.
>>
>>                      What am I missing?  Is it not possible to run two RT
>>               instances
>>                      on the same server?
>>
>>                      Sincerely,
>>                      Doug Eubanks
>>                      admin at dougware.net <mailto:admin at dougware.net>
>>        <mailto:admin at dougware.net <mailto:admin at dougware.net>>
>>               <mailto:admin at dougware.net <mailto:admin at dougware.net>
>>        <mailto:admin at dougware.net <mailto:admin at dougware.net>>>
>>                      <mailto:admin at dougware.net
>>        <mailto:admin at dougware.net> <mailto:admin at dougware.net
>>        <mailto:admin at dougware.net>>
>>               <mailto:admin at dougware.net <mailto:admin at dougware.net>
>>        <mailto:admin at dougware.net <mailto:admin at dougware.net>>>>
>>
>>
>>
>>
>>
>>                  <http://www.vialtus.com/disclaimer.html>
>>
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090224/d238d915/attachment.htm>


More information about the rt-users mailing list