==========================
== Timoteo Ponce's blog ==
==========================

User-safe system configurations

databases ubuntu configuration safety dcvs diff


As a developer and Linux-user, I continuously change several configurations in my systems, some of the changes can include:
  • Port-based services: When you have several web servers working on the same machine, you have to configure ports and alias addresses.
  • Package sources: I just don't want to mess my apt-get and slapt-get sources configuration.
  • Security: External services configuration, security configurations and system restrictions.
  • Run levels: I like to have the services I use at system startup, the other ones can burn in hell...
  • Networks: I have some static configurations for some environments.
  • X11: For some custom modifications I made for several displays.
  • Databases: Sources, ports, users and some other configurations.
  • Cron: Some backup and maintenance jobs.
  • Revision control systems: Common filters, aliases, etc.
As you see, there are several configurations on my system, and I don't like to change them when a package gets updated, or when I upgrade my system. My usual alternative was to keep an .orig file for everything I was going to modify, but that didn't work very well, since I modified those files several times.

Because of the situation, I needed these things:
  1. Keep snapshots of my configuration files.
  2. Rollback changes.
  3. Restore old configurations.
  4. Check which files/lines where changed.
  5. Use it all from the shell.
So, long story short, I needed a Revision Control System. And as I needed it just my local machines, I reduced my choice to Git and Mercurial.

My choice? Git, it is obvious that its shell interfaces are superior compared with Mercurial, it's very well integrated with all UNIXes and I have been working with it for a long time.

So, whenever I want to check if a configuration has been changed:

#> git status

What about reverting a change?

#> git reset -HEAD

And if I want to restore it to its initial version?

#>git reset

I just modified a bunch of files, save a snapshot of them:

#> git ls-files --modified | xargs git add
#> git commit -m "Too much work and no fun makes Jack a dull boy..."