Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

keeping two config files in sync

by mhearse (Chaplain)
on Sep 12, 2012 at 18:00 UTC ( #993274=perlquestion: print w/replies, xml ) Need Help??
mhearse has asked for the wisdom of the Perl Monks concerning the following question:

I have two plain configuration files for two environments: production and hot standby. The config files are in git. Users only make changes to the production config file. This of course results in a stale hot standby config. I'm wanting input on various methods to keep these files in sync. They are not identical. Different hostnames/ips/ports/etc. I'm kinda stumped. One method I thought of would be to use a templating system of some sort. These can't go into cms software (puppet/cfengine). Any ideas?

Replies are listed 'Best First'.
Re: keeping two config files in sync
by choroba (Bishop) on Sep 12, 2012 at 18:22 UTC
    What about using git's commit hooks to generate the actual config file? You can even use a templating system in them, but if the config is not too complicated, you might go without it.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re: keeping two config files in sync
by stonecolddevin (Vicar) on Sep 12, 2012 at 18:45 UTC

    Seems to me that I would make config changes on standby/pre-production and promote them to production, as a number of safeguards are enabled by doing that alone.

    Three thousand years of beautiful tradition, from Moses to Sandy Koufax, you're god damn right I'm living in the fucking past

Re: keeping two config files in sync
by ig (Vicar) on Sep 12, 2012 at 20:05 UTC

    I would change the config file so that it contained a section for each environment or server and the servers selected the correct section at runtime. In these sections, I would only put the parameters that are server or environment specific. Any parameters that are common to all environments and servers would be expressed only once. In this way, each server or environment would have its unique configuration but the same config file would be used in each environment. It also makes it easy to see what the differences are between servers and environments.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://993274]
Approved by moritz
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2018-05-20 13:11 GMT
Find Nodes?
    Voting Booth?