When cooking a new dish, things get out of control if you try to manage too many things at once
You might face a similar situation when trying to write a new Chef cookbook.
Getting your arms around all those tools and frameworks needed to write solid, tested cookbooks gets you spinning. You need to install Food Critic, Chef Spec, Berkshelf – and the list goes on. This set up can easily take up to half a day or more.
French Chefs arrange all the ingredients which they’ll need well before they start cooking. They call this set up procedure „Mise en place“, or in short „Meez“.
And you should do the same
That’s what Meez is all about. It’s a Ruby Gem which creates a cookbook for you which has puts all these tools in place before you start cooking. Now you can work like a professional Chef concentrating on the recipe at hand instead of juggling new tools.
The devs are all writing automated tests and some are even experimenting with TDD. Congrats! But what happens when the build server breaks? Who’s taking care that Continuous Integration is running smoothly? Seems to be an awful lot of red in there…
Unlike writing the first basic tests, CI is hard. Did the test fail due to an application bug or is it the environment? Once again, the dreaded chant of “it works locally” is taken up. What most people fail to understand is that the failing test is the first sign of a communication breakdown between developers and sysadmins.
The guys from peritor, who are the creators of webistrano, created an opscode chef based cloud management solution: Scalarium. Jonathan Weiss walked me through their solution, which helps to solve the issue of installing and dynamically configuring applications on a cluster of Amazon EC2 instances. In this post, I want to show you how they use chef cookbooks in a very special way to manage the lifecycle of your web application clusters.
The opscode chef bootstrap installs Matz Ruby on the node automatically. There are cookbooks for installing ruby enterprise edition on a node, but they create a separate Ruby “universe” on your box: You will have to be very careful how you install gems to make sure they are used by either the default Ruby or by REE. As this really bothered me, I created a little cookbook which installs Ruby Enterprise Edition as the default Ruby using Ruby Version Manager (RVM) and Chef. This gives me the best of both worlds: REEs stability and speed as well as a sane way of managing gems.
I already wrote about how to get started with the Opscode Chef Platform. In this article I want to show you a very elegant way to deploy a Ruby on Rails stack with Chef. One of the strengths of Chef is the decent set of available cookbooks. @jtimberman does an especially excellent job in writing them. His chef cookbooks really help you to configure your systems neatly. One of his cookbooks is the Application cookbook. It enables data driven application deployment. Currently, it supports Ruby on Rails apps. The preferred stack is currently Matz Ruby with Unicorn, but, in a later post, I’ll show you how to use it cleanly with Ruby Enterprise Edition (REE).
Let’s get started!
In “The Moving Parts of Opscode Chef” there was an interesting discussion about the need of a highly available chef server if you want to use opscode chef as your configuration management tool of choice. Especially for small to medium sized enviroments running your own chef server is overkill. If you don’t want to use chef-solo (a local “push” tool instead of the client-server model of chef), you can sign up for an account at the opscode chef platform. The opscode chef platform gives you an highly available chef server in the cloud. After sign up, it’s only a matter of minutes to get your first client (or ‘node’ in chef speak) under configuration management control.
Automatically setting up and maintaining my servers is a must for me. Only if everything I install and configure on a server is scripted I’m sure I know what’s there and that it stays that way. Having automated infrastructure enables me to schedule a critical setup change at 3 am and be on the safe side even though my brain might already be half asleep. After having written a ton of capistrano tasks (and creating a mess with it), looking into puppet and chef, writing my own tool (carpet), my colleague finally gave Sprinkle a try.