Wandering Thoughts archives


Sysadmins should pretty much version control everything

Today's Sysadvent contained a casual, matter of fact bit:

This code [for deployment scripts] has probably never been threatened with version control.

I had a reaction to this.

At work, we are not quite hep to all the current DevOps coolness. We don't have metrics and dashboards, we don't have everything automated with things like Puppet, Chef, or Cfengine, and so on. But even in our low state of evolution, we do version control pretty much everything that moves. Our almost invariable rule is that anything that we change gets put in version control first. Scripts, configurations, etc etc.

Here is the thing. Doing this is trivial. You don't need to start up some big version control infrastructure or system to keep /etc in a big repository, you don't have to decide between git and Mercurial, and you barely need to do anything extra.

Just use RCS. RCS is a trivially easy single-file version control system. You don't have to set up anything big or make any particular changes in how you work. All you need to do (after a quick initial setup) is to run one more command after you edit something and are satisfied with your work (commit messages are optional but useful). And for doing that, you get all of the usual version control goodness; you can see what changed and when, and you can revert back to a past version (or pull bits of it out). Since RCS operates on single files, you can use it selectively, in mixed and tangled directories like /etc, and only when you need it.

By the way, don't worry that using RCS instead of something more sophisticated will prove a terrible decision in the future. You can migrate from RCS to other things when you reach that point.

(My writeup was for Mercurial, but you can use CVS-to-git stuff to move to git too.)

Sidebar: what it takes to use RCS the easy sysadmin way

apt-get install rcs
mkdir RCS
ci -l <file>
rcs -U <file>
ci -u <file>
ci -u <file>

There. You're done. Repeat the last two steps every time you edit the file (really, the last step, since you're already editing the file).

(Obviously some of the the initial steps can be skipped after the first time or the first time in any particular directory.)

sysadmin/VersionControlForEverything written at 03:14:15; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.