FAQ
Hi,

I am planing to have a 3-tiered catalyst setup: one development server, one test server and one production server. Each of those has of course different setups (mysql-users, hostnames, apache configs, etc). How can I create a catalyst application that can cope with these different settings without having to manually alter the settings on each system? (My app is under subversion control.). Is there a 'best practice'?

Thanks

Jens
--
Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01

Search Discussions

  • Neo [GC] at Apr 21, 2009 at 7:55 am
    Hi Jens,

    here we use a very simple solution to include different .yml-files with
    db-config and stuff. For each project (we run several Catalyst instances
    on one production server and some development-servers) we have an own
    .yml stored in our repository. The name of the .yml is the same as the
    directory where the instance is stored, so Catalyst reads out its dir
    and so determines the correct config-file.

    For example, Catalyst is stored in:
    /usr/local/httpd/productive1/MyApp
    the yml would be
    /usr/local/httpd/productive1/MyApp/productive1.yml

    This is a kinda hacked solution, but does work very well. :)

    In the MyApp.pl we have:
    __PACKAGE__->config->{'home'} =~ m/\/([^\/]+)\/MyApp/;
    __PACKAGE__->config->{dbconnect} = YAML::LoadFile(
    __PACKAGE__->path_to($1 . '.yml') );
    (several config directives)

    In the model-file we also have:
    CRM4->config->{'home'} =~ m/\/([^\/]+)\/MyApp/;
    my $connectData = YAML::LoadFile( MyApp->path_to($1 . '.yml') );
    (database connection info)


    Regards,
    Neo [GC] / Tom Weber [DuO]


    Jens Schwarz schrieb:
    Hi,

    I am planing to have a 3-tiered catalyst setup: one development server, one test server and one production server. Each of those has of course different setups (mysql-users, hostnames, apache configs, etc). How can I create a catalyst application that can cope with these different settings without having to manually alter the settings on each system? (My app is under subversion control.). Is there a 'best practice'?

    Thanks

    Jens
  • Merlyn Kline at Apr 21, 2009 at 8:39 am

    here we use a very simple solution to include different .yml-files with
    db-config and stuff. For each project (we run several Catalyst instances
    on one production server and some development-servers) we have an own
    .yml stored in our repository. The name of the .yml is the same as the
    directory where the instance is stored, so Catalyst reads out its dir
    and so determines the correct config-file.
    I use a system where I have devised a convention for including different
    configurations in the same config.yml file. For most config there is no
    change but for some specifc things I have alternative config stored, eg:

    appname: MyCatApp(dev)
    context:test::appname: MyCatApp(test)
    context:live::appname: MyCatApp

    So on the dev server the extra contexts are ignored. I then have a script
    which updates the test (or live) server from the svn repository. That script
    post-processes the config.yml to put the right contexts in place (and does a
    bunch of other things like stripping comments and compressing JS and
    deleting tests and so on).

    Perceived advantages:
    - Minimises variations in config, eliminating some sources of mysterious
    bugs.
    - Keeps all config in one place so when you change something you don't
    forget to change it for all the other servers (if they differ) or don't have
    to maintain it for all the other servers (if they're the same).
    - Better management of test/live servers (my update script takes a
    revision number as a parameter, among other things).

    HTH

    Merlyn


    [snip]
    I am planing to have a 3-tiered catalyst setup: one development
    server, one test server and one production server. Each of those
    has of course different setups (mysql-users, hostnames, apache
    configs, etc). How can I create a catalyst application that can
    cope with these different settings without having to manually
    alter the settings on each system? (My app is under subversion
    control.). Is there a 'best practice'?
  • Ben Vinnerd at Apr 21, 2009 at 8:33 am
    I have a file /etc/httpd/host.conf, which contains the line:
    PerlSetEnv CATALYST_CONFIG_LOCAL_SUFFIX live/dev/whatever

    This host.conf file is different on each host, and gets included from
    the main httpd.conf. ConfigLoader picks this up, and it works for me -
    only 1 file to change on each host.

    Ben


    Jens Schwarz wrote:
    Hi,

    I am planing to have a 3-tiered catalyst setup: one development server, one test server and one production server. Each of those has of course different setups (mysql-users, hostnames, apache configs, etc). How can I create a catalyst application that can cope with these different settings without having to manually alter the settings on each system? (My app is under subversion control.). Is there a 'best practice'?

    Thanks

    Jens
  • Matt S Trout at Apr 21, 2009 at 11:56 am

    On Tue, Apr 21, 2009 at 09:33:04AM +0100, Ben Vinnerd wrote:
    I have a file /etc/httpd/host.conf, which contains the line:
    PerlSetEnv CATALYST_CONFIG_LOCAL_SUFFIX live/dev/whatever
    That should really be MYAPP_CONFIG_LOCAL_SUFFIX unless you really intended
    to affect all Catalyst application.

    But yes, this is the correct approach - see Catalyst::Plugin::ConfigLoader
    docs for more information.

    --
    Matt S Trout Need help with your Catalyst or DBIx::Class project?
    Technical Director http://www.shadowcat.co.uk/catalyst/
    Shadowcat Systems Ltd. Want a managed development or deployment platform?
    http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedApr 21, '09 at 5:42a
activeApr 21, '09 at 11:56a
posts5
users5
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase