Configuration management is all about trying to ensure that the files and software you are expecting to be on a machine are present, configured correctly, and working as intended.
When you have only a single machine this is fairly simple. When you have five or ten servers, it is still possible to do this manually, but it may take all day. However, when your infrastructure scales up into the thousands we need a better way of doing things.
What is “version control”, and why should you care? Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. For the examples in this book you will use software source code as the files being version controlled, though in reality you can do this with nearly any type of file on a computer.
If you are a graphic or web designer and want to keep every version of an image or layout (which you would most certainly want to), a Version Control System (VCS) is a very wise thing to use. It allows you to revert files back to a previous state, revert the entire project back to a previous state, compare changes over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more. Using a VCS also generally means that if you screw things up or lose files, you can easily recover. In addition, you get all this for very little overhead.
Best Practices of Version Control
- Keep absolutely everything in version control : Developers should use version control for source code (of course), but also they should use it for tests, database scripts, build and deployment scripts, documentation, libraries and configuration files for your applications.
- Check In Regularly to Trunk : Once the changes are checked in into version control, they are available to the entire team.
- Using Meaningful Commit Messages : Always use detailed Multi-paragraph commit messages when you check in. This might save hours of debugging later on if an error happens. In a Multi-paragraph commit message, first paragraph is a high level details and the entire details in the remaining paragraphs.
Managing Components and Dependencies
- Managing External Libraries : External Libraries usually come in binary form, unless you are using a interpreted language. There are 2 reasonable ways of managing the libraries.
- Check them into Version control. This approach is the simplest solution and will work fine for small projects. However, for larger projects and larger libraries, the approach may make the version control system too heavy and this approach may be unviable.
- Another one is to declare them and use a tool like Maven or Ivy to download libraries from Internet repositories to your own artifact repository.
- Managing Components : It is a good practice to split your application into smaller components. Doing so limits the scope of the changes to your application, reducing regression bugs. Also it encourages reuse and enables a much more efficient development process on large projects.
Managing Software Configuration
Configuration is one of the three key parts that comprise an application along with binaries and its data. Configuration information can be used to change the behaviour of software at build time, deploy time and run time. Delivery teams need to consider carefully what configuration options should be available, how to manage them throughout the application life and how to ensure that the configuration is managed consistently across components, applications and technologies. You should treat the configuration of the system in the same way you treat your code. You should subject it to proper management and testing. There are three questions to consider when managing your application configuration:
- How do you represent your configuration information?
- How do your deployment scripts access it?
- How does it vary between environments, applications and versions of applications?
Each configuration setting can be modeled as a tuple (A data structure consisting of multiple parts – typically an ordered set of values). Generally, the set of the tuples available and their values typically depend on three things
- The Application
- The version of the application
- The environment it runs on
Principles of managing Software Configurations
Some of the principles of managing configuration are as follows
- Consider where in your application lifecycle it makes sense to infect a particular piece of configuration.
- Keep the available configuration options for your application in the same repository as its source code.
- Values of the configuration should be managed separately
- Configurations should always be performed by automated process using values taken from your configuration repository.
- Use clear naming conventions and avoid obscure naming conventions.
- Do not repeat the information.
- Be minimalist. Keep the configuration information as simple as possible.
- Avoid over-engineering the configuration system.
- Ensure you have tests for your configurations.