enforcing web site config with scripting & automation

Last fall I attended the All Things Open conference in Raleigh NC. One of the talks I saw was about Chef, which is a scripting language for server admins to keep systems – in this case typically Linux servers – set up and configured correctly, and to clone systems easily.

My big take away from that talk was the concept of setting policies for a system and using the scripts to enforce the policies. So for example, you could have a policy that all of your Linux servers have to have php 5.5 installed in a particular location. You can write a Chef ‘recipe’ to check that and fix it if something happens to it.

In writing scripts to set up certain things for our web site after a new code deploy, it’s occurring to me that the same concept could apply. For example, we know we want to have a static home page with a particular template, slug, title and feature image. I’m writing the script right now to check that and correct it if those things are not in place. Maybe that should be considered a policy and checked every time we do a deploy.

In somewhat related news, I am already embarrassed by some of the wp-cli code that I posted earlier this week. That was fast!