Running multiple Catalyst applications via Apache

I have a suse box that has three Catalyst applications. Ultimately I need to run all three (which is not a problem in itself, each with a different port) through Apache with mod_perl and SSL. I have successfully gone as far as to start one Catalyst application and then have successfully migrated to the Catalyst server.

In case anyone needs a BIG step by step how to do it, you can see it here.

I'm not an Apache expert, but the problem is that I don't know there is a way to run multiple Catalyst applications on the same server and get Apache to serve all three somehow.

The page even says the same .....

Can't run multiple versions of the same application.
It is not possible to run two different versions of the same application in the same Apache instance as the namespaces will collide.

That being said, is this possible across multiple Apache instances? Somehow? Maybe through virtual hosts? I know that by preloading a Catalyst application in Apache it will take up huge memory every time I do this.


source to share

1 answer

OK! I found the answer. You can actually run more than one Catalyst application via Apache / mod_perl, you simply cannot run more than one instance of the same application. That being said, here all you have to do is run more than one (without using VirtualHost directives). In your default-server.conf

PerlSwitches -I/home/me/catalyst/App1/lib
PerlSwitches -I/home/me/catalyst/App2/lib

PerlModule App1
PerlModule App2

<Location /app1>
        SetHandler modperl
        PerlResponseHandler App1

<Location /app2>
        SetHandler modperl
        PerlResponseHandler App2


Apache fetches the entire Catalyst application into memory and then processes it as a handler. The only drawback is that it eats memory having more than one application like this in memory. Upside is about speed and that mod_perl will share the modules needed by both.

Hope this helps if you have the same problem. In addition, Apache / mod_perl and your Catalyst applications must be compiled with the same version of Perl, or you will receive "undefined" errors.



All Articles