What is the best way to keep your configuration files (e.g httpd.conf, my.cnf, .bashrc ...) under version control? In adition to the versioning benefit, I want the solution to work as backup as well, so that I can bring a brand new server and checkout (or export) the config files out of SVN directly
A good touch will be to store the config file`s original path as well.
These config files are typically placed under separate root directory than the rest of application code. For example, in case of Java they are typically under src/main/resources .
Subversion's runtime configuration area is stored in the %APPDATA%\Subversion\ directory. The files are config and servers .
You can actually encrypt sections of your config files. it's not "separate" from the config file as you asked about in your question, but it is more secure than storing the unencrypted/plaintext passwords in your config file.
I revision-control my configuration files, but I use git instead of svn (which is easier when you have multiple machines). I have a bash script (called install.sh
), also under the repository, which either copies or symlinks the files to their appropriate location on a machine.
So if I need to set up on a new machine, I just do a git clone of the repository (which is equivalent to an svn checkout) and run my install.sh
to set up my config files in the appropriate locations. Having install.sh
around means that I'm also storing the config files' original path, as you indicated you'd like.
This is what I have implemented:
I have a server that does rsync of all the configs into one directory (say /data/configs/hostname/{etc,httpd}.
I have an rsync running every hour to transfer the changes. as soon as rsync is complete, there is an svnautocommit script that does autocommit of the changes. This way, I can roll back to any change or any version I want to.
You might need to plan the SVN directory structure based on your requirements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With