We have migrated a lot of source code over to git and are very happy with our current solution. We would like to have our server configuration files versioned on the same system, but there are a few things that don't work the way we would like it to and I hope someone can share his experience here.
This question is similar to Using revision control for server configuration files?, but we have some special requirements that do not work with the suggestions on that question.
The current setup uses subversion for configuration files. The corresponding repository looks something like this
/ # root of repository +--www.domain.com/ # configuration for www | \--etc/ | \--apache2/ +--dev.domain.com/ # configuration for dev | +--etc/ | \--opt/ | \--app1/ | \--conf/ # configuration for app1 on dev \--staging.domain.com/ # configuration for staging
With subversion this would work just fine, because it's possible to just checkout a sub-directory of a repository. In addition you can use svn:externals to point to one common structure for several different configuration setups. We only had to deal with the .svn files in all versioned directories. Git on the other hand does not have svn:externals and sparse checkouts always require the path from the root to the actual directory to be the same.
When discussing the migration to git, I tried to write down the main Requirements for the server configuration versioning:
- we only want a single repository
- it should be possible to easily push changes to the central remote
- changesets should contain the real author
Is there a nice way to have all the configuration in one repository and only have a sub-path as working copy? Currently I am considering two approaches, but wanted to ask this question here first
- If the .git repository is at a fixed location, e.g. somewhere in /var, we could link to the sub-path from the "target" working directory. The main problem: I would not know of a way to "link" from /etc to another directory in order to only import the contents, except symlinking single files
- I found another alternative on this SO question, suggesting to have multiple branches in one repository. This would certainly increase complexity, but I could see us trying this way.
Using git on a single machine for configuration file management works fine, but I believe there must be someone who is using it the way we would like to use it.
Thank you
Kariem