Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to keep config files under SVN?

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.

like image 992
duckyflip Avatar asked Oct 06 '08 15:10

duckyflip


People also ask

Where do you keep config files?

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 .

Where is SVN config file?

Subversion's runtime configuration area is stored in the %APPDATA%\Subversion\ directory. The files are config and servers .

Are config files safe?

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.


2 Answers

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.

like image 198
EfForEffort Avatar answered Oct 21 '22 11:10

EfForEffort


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.

like image 29
Ram Prasad Avatar answered Oct 21 '22 11:10

Ram Prasad