configuration tips

:: introductory, technical, computers

As an avid computer configurator, I want to share some tips about how to effectively customize and keep track of your configuration. I want to highlight the different types of configuration needs that exist, and suggest some good ways of managing them.

First, let me start off by saying something the most important and obvious things: You need to use git, and you need to use symlinks. That aside, let’s move on to what type of configuration you will do on any given system, and how they differ.

First, there is generic user configuration. By this I mean configuration that you want for all of the programs you use from day to day. This is configuration that you want to be on all of your machines. This may include configuration for a shell, a terminal, a text editor, a web browser… These are the tools that you use constantly and that you want a consistent experience with, despite the fact that you probably end up using several different machines from time to time. For this type of configuration, I recommend keeping a git repository with all of these types of configuration files, and having a small script to symlink them all to the right places in your file system. This makes it easy to synchronize them between machines and keep their history. It is great to host this on a public repository online so you can access it everywhere, and so you can share cool bits of your configuration with others.

Next, there are generic user configuration files that you want to keep private. These are basically the same kinds of things as in the first category, but these might include sensitive data. Here you should put your scripts, aliases, etc. that include domains or IP addresses of your computers, names or contact information of people, etc. You probably don’t want to put that up publicly, so you should keep this in a private repository (probably on your personal server). By separating the personal parts out of your main configuration files into a private repo, you have the freedom to clone your main repo on any machine (even public ones) without worrying about any sensitive data getting out. Any program with a decent configuration format will let you source another file, so your generic user configuration files should include lines to source a file from your private repo if it is available.

Aside from user configuration, you also have system configuration. Unlike the above types of configuration, system configuration is machine-dependent. These are the files that make one machine different from another. For instance, you configure your desktop differently than your home server, which is different from any public servers you run, which is different from your media box, etc. These are files that you change rarely, but when you do, you want to be able to see what you changed, why you changed it, and have the history of it. Every machine has loads of configuration files, most of which stay in their default state, making it difficult to keep track of which ones are important. This is all much easier if you move all modified configuration files into one place and use symlinks to them in their correct places. You probably also won’t be surprised to hear me say that you should use git to have version control, and to easily back up that configuration. To make this easy for myself, I made some small scripts to help with some of details of system configuration that are different from user configuration. Perhaps they will be helpful.

Finally, there are bits of user configuration that are also system-specific. For instance, you may want your shell prompt to show your hostname in different colors on different machines you run, or you may want different commands available. Like private configuration files, your main configuration should check for your system-specific configuration file and source it as well. If you are an administrator of a machine, it is easy to put this system-specific stuff with your other system configuration as root. However, you may not have root access, or you may not want to mix the configurations for other reasons.

In conclusion, there are several different types of configuration that work together, and that each require slightly different management. If you are creating a program, be sure that your configuration format allows for inclusion of other files so that configurations can be split like this. With a little bit of git and symlink magic (which is easily scripted), you can keep your main configuration synchronized between your machines, keep track of elaborate system configuration, and have easy backups for all of it.