Last Month, I was lucky enough to get invited to an Alpha presentation for Chef Cookbook Authoring with Bento, Vagrant, and Berkshelf put on by OpsCode. In using Chef I've had a rough time figuring out the best way to iterate and update cookbooks without the risking disruption to production servers that use my cookbooks. I had to hard code cookbook versions for all my environments, and increment my cookbook versions in my test environments for testing. This lead to a lot of editing json, uploading, knifing, stabbing and gnashing of teeth. Not being a very good rubyist made this especially painful. I considered using my chef repo with chef-solo and testing deploys on temporary machines in AWS, but that has a cost associated with it that I'd rather not pay. Plus there's always the possibility that my cookbook updates would overwrite existing cookbooks and total bork my production servers, if I wasn't careful.

When Charles Johnson from OpsCode mentioned the premise of this training I was eager to jump in and find a Better Way to iterate and test my chef code. Coming from an Ops background I wasn't aware of a lot of development principles for code development. It mostly boils down to code -> build -> deploy -> test, rinse, repeat. This can get a bit tedious and expensive when building and deploying to physical machines, and slightly less when building to AWS or another cloud provider. It’s still tedious though.

Enter Vagrant, Bento, and Berkshelf.

Vagrant allows you to spin up virtual machines locally via VirtualBox. Bento provides chef ready images, and Berkshelf provides dependency resolution for your recipes. This allows you to rapidly prototype cookbooks and recipes without the cost of servers, or the risk of deploying test cookbooks to your Chef-Server or hosted Chef.

Berkshelf is maintained by Riot Games (yes that Riot Games) and has a great feature that allows you to specify a chef repo hosted in git. Most users will likely just point to the community cookbooks, and there’s very little reason not to. For my company, we’ve forked and made changes to the community cookbooks to better suit our needs and how we use chef roles and chef environments. We also heavily leverage chef search to create templates for many recipes so just using a repo isn’t ideal. Still, we’re able to do a lot of rapid prototyping with Vagrant, Bento, and Berkshelf.

The talk is really shaping up to be incredible. If you’re a chef heavy shop, or you’re just starting to learn the ins and outs of chef, I think you should consider attending the class at ChefConf. Despite experiencing the Alpha version, I’d still love to attend the “production class." #ChefConf is April 24 - 26.