[Catalyst] Multiple deployments sharing code, data, and configuration

Eden Cardim edencardim at gmail.com
Sun Dec 20 06:49:55 GMT 2009


>>>>> "Stuart" == Stuart Watt <swatt at infobal.com> writes:

    Stuart> In our application, we have two parts - an indexing system
    Stuart> that builds a set of databases, and a front end based on
    Stuart> Catalyst. The issue we are facing is that each generated
    Stuart> deployment runs almost exactly the same code, apart from
    Stuart> needing different database references, and maybe a little
    Stuart> additional Template-Toolkit stuff to provide custom logos,
    Stuart> search configuration data, etc.

    Stuart> What we ended up doing was using a new environment variable,
    Stuart> *_SITE_ROOT, which points to an individual site's deployment
    Stuart> base; this is effectively combined with *_HOME in a search
    Stuart> path for TT files and for configuration files. On a few rare
    Stuart> occasions we also add a local deployment lib directory
    Stuart> @INC. This means we can maintain all the deployments in
    Stuart> parallel, even when they contain different data.

    Stuart> The only substantive change we needed was in our subclass of
    Stuart> Catalyst::Plugin::ConfigLoader, which overrides find_files
    Stuart> to try the SITE_ROOT directory first, then HOME, for each
    Stuart> file previously identified - these are generally the config
    Stuart> file with and without the local suffix. It's the only way we
    Stuart> found of achieving a directory level separation between the
    Stuart> local deployment and the shared code base.

    Stuart> My question: is there an easier/better way to do this? If
    Stuart> not, I'd be keen to turn this into a patch, and rename stuff
    Stuart> where I get better suggestions.

I'm confused as to what you're trying to achieve. From what I
understood, what you're doing is equivalent to copying the source tree
around (which is what you call a "deployment") and using a different
configuration for each copy. If that's what you're trying to do, I'd say
it's easier/saner to just maintain different configurations for each
deploy type in the repo itself, then use some mechanism, like symlinks,
or CATALYST_CONFIG to switch between them in specific deploys.

-- 
   Eden Cardim       Need help with your Catalyst or DBIx::Class project?
  Code Monkey                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://edenc.vox.com/            http://www.shadowcat.co.uk/servers/




More information about the Catalyst mailing list