[Catalyst] Deployment of many Catalyst sites on the same machine

Matt S Trout dbix-class at trout.me.uk
Tue May 15 20:26:31 GMT 2007


On Tue, May 15, 2007 at 06:52:06PM +0200, Adam Sjøgren wrote:
> I was wondering what peoples thoughts are on what a good way to deploy
> "many" (2-10, nothing extreme; different) Catalyst-based apps on a
> single machine would be.
> 
> My first thought was that mod_perl perhaps in this case would be
> preferable to FastCGI, because each process then would share the common
> perl modules of the various frameworks (Catalyst, ORM, templating, etc.) 
> used by all the Catalyst apps, thereby saving a bit or two.

Or you could stuff 'em all in one fcgi handler with something like -

package DummyApp;

use Catalyst;

__PACKAGE__->setup;

my %rev_apps = (
  MyApp => 'myapp.example.com',
  MyOtherApp => 'other.example.com,
);

my %apps = reverse %rev_apps;

foreach my $app (values %apps) {
  eval "require ${app}" || die $@;
  $app->engine(__PACKAGE__->engine);
}

sub handle_request {
  my ($self, %rest) = @_;
  my $host = $rest{env}{HTTP_HOST};
  $apps{$host}->handle_request(%rest);
}

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Catalyst mailing list