You are not logged in.

#1 2010-09-08 00:36:55

LeafStorm
Member
From: North Carolina
Registered: 2009-05-20
Posts: 51
Website

Configuration version control software

I know some people like to put their /etc under version control with CVS or hg or something, to make it easier to recover if they misconfigure something. I think this is kind of overkill, though. For one, you don't really need "distributed" or "centralized" version control, you just need to control the version. And for another, version-controlling the entire /etc doesn't really make sense considering that you're usually only working with a few files at a time, which you would generally control separately. So, I came up with the idea for a VCS specific to managing your system configuration. I'm going with the name Tessen for now since it sounds cool.

The two basic concepts involved here are applications and snapshots. An "application" refers to a particular set of config files managed by Tessen. For example, the pacman application would own pacman.conf, makepkg.conf, and pacman.d (a directory). Ownership in this context means that it will automatically track changes to the contents of the files and folders. (Each application has an active snapshot, which is basically "the last one you saved or reverted to.")

A "snapshot" is how an application's config files looked at any given time. A snapshot has a number (since it's not distributed, a simple autoincrementing integer will work), a timestamp (for obvious reasons), an action (to indicate exactly what caused this snapshot to be taken - for the user manually saving it would be "save", if it was installed by a package manager, "install", etc.), a note (if you feel like it - a good sysadmin would always have one), and the files' contents. (You can also add additional notes to snapshots after the fact, but this won't affect the note that was saved with the snapshot in the first place.)

Anyway, the workflow would run something like this:

  1. "tessen newapp pacman pacman.conf makepkg.conf pacman.d". Tessen creates a new application named "pacman" that owns pacman.conf, makepkg.conf, and the directory pacman.d. (Tessen would automatically save a snapshot at this point consisting of the current contents of said files. That would be snapshot #1.)

  2. Make changes to the configuration, like using aria2c as the transfer command.

  3. "tessen save pacman -n 'set XferCmd to aria2c'". Tessen will take a snapshot of all the files owned by pacman and save that, making it #2.

  4. DOOM! You forgot that you don't have aria2 actually installed, and now that XferCmd is aria2c you can't install it! (This is just a contrived example.)

  5. "tessen revert pacman". Since you're at #2 but haven't made any changes, it will switch you back to #1. (If you had made changes, it would reset to #2 instead.) All necessary files will be reverted.

  6. Now you can "pacman -S aria2" and make sure it works this time.

  7. You could edit it manually to set it back to aria2 (which if you saved it would make it #3) but it's easier just to "tessen revert pacman 2". revert jumps back one step by default, but you can tell it to revert to anything. Then the next change you make would be #3.

One major thing about the design I haven't quite decided would be how ownership is stored, and what to do if you change the ownership and try to revert to an older snapshot. That would be tricky to figure out. Still, what do you think about this approach?


Thanks,
Matthew Frazier

Offline

#2 2010-09-08 02:04:53

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,231
Website

Re: Configuration version control software

I like it.... Some kind of remote usage would be good though.

Eg:
Keep a set of config files in /var/tessen/box/websvr01/root/etc/ and then be able to push that config to a remote host, overwriting whatever is currently on that host.

Systems grow, and you need 2 webservers...

cp -r /var/tessen/box/websvr01/ /var/tessen/box/websvr02/
<change any static references to websvr01 to sebsvr02 in config files (eg /etc/hosts)
<update config file to point to correct IP address>
tessen push

Instant copy of websvr01 is now on websvr02

Last edited by fukawi2 (2010-09-08 02:06:27)

Offline

#3 2010-09-08 02:21:09

LeafStorm
Member
From: North Carolina
Registered: 2009-05-20
Posts: 51
Website

Re: Configuration version control software

fukawi2 wrote:

I like it.... Some kind of remote usage would be good though.

Eg:
Keep a set of config files in /var/tessen/box/websvr01/root/etc/ and then be able to push that config to a remote host, overwriting whatever is currently on that host.

Systems grow, and you need 2 webservers...

cp -r /var/tessen/box/websvr01/ /var/tessen/box/websvr02/
<change any static references to websvr01 to sebsvr02 in config files (eg /etc/hosts)
<update config file to point to correct IP address>
tessen push

Instant copy of websvr01 is now on websvr02

Config files that need to be updated and vary between hosts is really more a job for a full remote administration tool like Puppet. Still, it would definitely be possible to use Tessen for this sort of thing. (An extension could perhaps be written to automate the process.)


Thanks,
Matthew Frazier

Offline

#4 2010-09-08 03:44:59

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,231
Website

Re: Configuration version control software

LeafStorm wrote:

Config files that need to be updated and vary between hosts is really more a job for a full remote administration tool like Puppet. Still, it would definitely be possible to use Tessen for this sort of thing. (An extension could perhaps be written to automate the process.)

Puppet is too full on for my liking with it's abstraction etc. I just would like to be able to keep a central copy of config somewhere, and push it out to a specified IP tongue

What language are you planning on writing this in?

Offline

#5 2010-09-08 05:24:35

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,333

Re: Configuration version control software

I think I'm missing something :-/
I know the OP dismissed git and hg at the outset -- but why?  It seems to me they are ideal for just this sort of thing.  On this machine, I do have an Hg archive living under /etc.  Being Hg, it is simple to push that off to other systems and keep them synced (or not).
Perhaps tessen could wrap git or Hg?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#6 2010-09-08 07:11:54

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,231
Website

Re: Configuration version control software

How does Hg push compare to git push?

Offline

#7 2010-09-08 11:16:30

LeafStorm
Member
From: North Carolina
Registered: 2009-05-20
Posts: 51
Website

Re: Configuration version control software

ewaller wrote:

I think I'm missing something :-/
I know the OP dismissed git and hg at the outset -- but why?  It seems to me they are ideal for just this sort of thing.  On this machine, I do have an Hg archive living under /etc.  Being Hg, it is simple to push that off to other systems and keep them synced (or not).
Perhaps tessen could wrap git or Hg?

The reasons I had for not using a traditional DVCS (as much as I love them) include:

  • A VCS in all of /etc would manage your configuration as a whole. Tessen lets you manage each application separately without awkwardness.

  • Also, there is stuff in /etc that isn't really configuration (I'm looking at you, /etc/bash_completion!). You could get around this by simply not "hg add"ing those files, but it does make it trickier. (Though in an ideal world, each app would store its configuration in a separate directory and things like the completion scripts would be in /share or /usr/share.)

  • Finally, if you're using a DVCS so you can sync configuration, this would actually be better. For example, if you're trying to share the Apache and CouchDB configurations between your boxen, you have no way to keep out any other files you might have added (like, say, fstab).

Really, it's mostly just that the concepts behind Tessen map more clearly to the problem than those in hg or git. At least in my mind. Although using a DVCS as the storage backend would be interesting...

fukawi2 wrote:

What language are you planning on writing this in?

Probably Python. (My original concept would use SQLite as the database.)


Thanks,
Matthew Frazier

Offline

Board footer

Powered by FluxBB