Test-first system administration
As a software developer in a startup it's a common enough task to have to set-up a server requiring the following recipe
- A firewall (apt-get install ufw)
- A mail server (apt-get install postfix)
- A web server (apt-get install apache2)
- A database (apt-get install postgres)
- Some development tools (apt-get install subversion git-core openjdk-6-jdk)
- Some python packages (easy_install -U django soaplib mechanize pytz lxml beautifulsoup mercurial)
Configuring a Linux image and deploying it to a cloud is a popular solution but that convenience probably doesn't help when servers start to misbehave. Wouldn't it be nicer if I could
- script this process
- use the script to monitor the box
- check if my machine has been compromised
- rebuild services as necessary
- Do backup over ssh (with Duplicity)
- And most important not have to go back to notes to figure out what happened when something breaks
- check if my DNS servers are up
- test if the box is up
- check that only the expected ports are open
- check my application specific configuration
- log in and check activity
- update packages
- Send me a txt only if something was wrong.
There are some pretty comprehensive deployment platforms out there like SmartFrog and Puppet but my deployment issues don't need scale up to that level of sophistication. I'd like to use my deployment tools to scale down to a MythTV box, a NETGEAR router or one of the new batch of ssh-capable mobile handsets so Expect seems closer to my needs. A Capistrano-like or ANT-based option might work here too but an Expect-based pattern would seem to be better for bespoke tasks.
The best pitch I have seen for a piece of software recently was for Feedparser
Parse RSS and Atom feeds in Python. 3000 unit tests. Open source.Test-first system administration with Expect looks like a nice way to capture deployment logic for any kind of device. Any workflow system succeeds only if it can handle exceptional cases - Expect gives you a succinct way do just that.