Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 909dc22ba1
Fetching contributors…

Cannot retrieve contributors at this time

124 lines (82 sloc) 8.587 kB
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Category: ChefConf | [ Alluvium ]]]></title>
<link href="http://alluvium.com/blog/categories/chefconf/atom.xml" rel="self"/>
<link href="http://alluvium.com/"/>
<updated>2013-05-06T09:50:45-05:00</updated>
<id>http://alluvium.com/</id>
<author>
<name><![CDATA[Eric Reeves]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[The Application Cookbook Pattern, Berkshelf, and Team Chef Workflow]]></title>
<link href="http://alluvium.com/blog/2013/05/03/the-application-cookbook-pattern-berkshelf-and-team-chef-workflow/"/>
<updated>2013-05-03T21:48:00-05:00</updated>
<id>http://alluvium.com/blog/2013/05/03/the-application-cookbook-pattern-berkshelf-and-team-chef-workflow</id>
<content type="html"><![CDATA[<h2>Berkshelf</h2>
<p>I am a fan of "The Berkshelf Way".</p>
<p>If you aren't familiar with Berkshelf or the Application Cookbook pattern, do yourself a favor and spend some time on the following links...</p>
<!--more-->
<ul>
<li><a href="http://berkshelf.com/">Berkshelf</a> - The official Berkshelf docs.</li>
<li><a href="http://www.youtube.com/watch?v=hYt0E84kYUI">Jamie@ChefConf</a> - Jamie Winsor's "The Berkshelf Way" talk from <a href="http://chefconf.opscode.com/">ChefConf</a> 2013.</li>
<li><a href="http://devopsanywhere.blogspot.com/2012/11/how-to-write-reusable-chef-cookbooks.html">GangnamStyle</a> - Bryan Berry's "How to Write Reusable Chef Cookbooks, Gangnam Style" blog post.</li>
<li><a href="http://foodfight.libsyn.com/episode-24-jamie-winsor-and-michael-ivey-on-berkshelf">FoodFightShow24</a> - Jamie Winsor and Michael Ivey from Riot Games on the FoodFightShow. Why they wrote Berkshelf, how they develop Cookbooks, why they don't like Roles, and more.</li>
<li><a href="http://foodfight.libsyn.com/episode-32-there-s-a-spork-in-my-berkshelf-talkin-bout-workflow">FoodFightShow32</a> - Etsy and Riot Games both talking about their unique approaches to Team Chef Development.</li>
<li><a href="http://vialstudios.com/guide-authoring-cookbooks.html">GuideToAuthoringCookbooks</a> - A tutorial that will demonstrate the awesomeness of the workflow that the <a href="http://berkshelf.com/">Berkshelf</a>/<a href="http://vagrantup.com/">Vagrant</a> combo provides.</li>
</ul>
<p><em>The authors of the above content deserve nearly full credit for the rest of this blog post, and a number of ideas I have for future posts.</em></p>
<p>I have had great success using <a href="http://berkshelf.com/">Berkshelf</a>/<a href="http://vagrantup.com/">Vagrant</a> to rapidly iterate on a Cookbook and get quick feedback on changes. And now with Vagrant 1.1's provider plugin interface, this workflow does not limit you to just Virtualbox. There are already provider plugins for AWS and Rackspace among others. Hurrah!</p>
<p>This works very well for initial development and quick fixes, but when you need to have multiple teams collaborating on a shared set of Cookbooks, there are some additional factors to take in to consideration.</p>
<h2>Team Chef Development</h2>
<p>The next step is figuring out how to manage Cookbook versioning in a multi-user development environment, and ensuring that teams aren't repeating each others work or stepping on each other's toes. Cookbooks must be shared between teams, and these shared Cookbooks must be well-tested given the impact is potentially much wider than just a single team. This is a bit trickier...</p>
<p>Here are a few ground rules that could be the basis of a sound Team Chef Development Workflow:</p>
<ul>
<li>Versioning of internal Cookbooks should be managed by the build server, and ONLY the build server.</li>
<li>Application Cookbook versions are pinned at the Environment level.</li>
<li>Library Cookbook versions are pinned in the metadata.rb of the Application Cookbook that includes them.</li>
<li>Only Application Cookbooks get assigned to Nodes. Not Library Cookbooks, or Roles. (Stick with me for a second...)</li>
<li>Library Cookbooks should change their behavior based upon Attributes.</li>
<li>Defaults for Attributes are provided in the Library Cookbook attributes/default.rb. Default Attributes are only over-ridden in two places: the metadata.rb of the Application Cookbook, and the Environment. This makes troubleshooting much easier. Setting Attributes in Roles seems unnecessary and just adds an extra place to look (a place that is not versioned).</li>
<li>Search by Tags or a custom Attribute to locate Nodes, not by run_list entry or Role. Provide functions to call these searches in a Library Cookbook, so the location mechanism is easily swapped out or refactored down the road. (Or abandon search all together and start using a service registry like ZooKeeper, but that's another blog post).</li>
<li>Community Cookbooks pulled in as dependencies by Berkshelf should not be forked internally, unless it is unavoidable. If you must fork perhaps due to an unfixed bug, strive to update the Cookbook, make it more flexible to meet your needs, add some tests, and send in a pull request. This way the community benefits from the work, and you will continue to gain the benefits of future community-added features without the burden of maintaining and updating a fork.</li>
</ul>
<h2>The Problem With Roles</h2>
<p>This is a controversial subject, but we have a problematic use case that we have already been bitten by, and a clear solution using Roles hasn't yet surfaced.</p>
<ul>
<li>Teams A, and B are both working on the Chef server. Both teams are working on the web_server Role.</li>
<li>Team B needs to run a bleeding edge version of the web stack which requires an additional Recipe in the web_server run_list.</li>
<li>Team A's stuff explodes because Roles are global variables and the new Recipe isn't in their Cookbook.</li>
</ul>
<p>I know you can setup Environment-specific run_lists, but we routinely have 15+ dev/test environments up, and don't see this number falling any time soon. This is clearly not a maintainable solution.</p>
<p>At the end of the day, Roles only do 3 things:</p>
<ol>
<li>Manipulate the run_list.</li>
<li>Set Attributes.</li>
<li>Tag a node with a friendly name.</li>
</ol>
<p>If you use an Application Cookbook to accomplish #1 and #2, then suddenly your Role is versioned and can be pinned differently per Environment on your Chef server. To handle #3, change your Chef searches to look for a Node Tag or custom Attribute instead of a Role, and gain a little bit of flexibility in the process. Ever wanted to verify a new web server by hand before you brought it in to the load balancer pool? Don't Tag it or set the custom Attribute until you've validated the Node, instead of having the Role immediately match a search.</p>
<p>Thoughts on any of this?</p>
<p>I'm planning on some future posts to go in to more detail on some of these areas... Particularly CI and testing!</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Introduction]]></title>
<link href="http://alluvium.com/blog/2013/05/03/introduction/"/>
<updated>2013-05-03T20:20:00-05:00</updated>
<id>http://alluvium.com/blog/2013/05/03/introduction</id>
<content type="html"><![CDATA[<h2>Welcome!</h2>
<p>I now have a blog!</p>
<p>Why start now after years of blogosphere silence, you ask? Well...</p>
<!--more-->
<p>In the past two weeks I have been to both <a href="http://chefconf.opscode.com/">ChefConf</a> and <a href="http://devopsdays.org/events/2013-austin/">DevOpsDaysAustin</a>. Both of these events were full of incredibly
smart, genuinely passionate, and accessable folks who were all a pleasure to talk to. I learned a lot, and tried to share with others as much as I could. But alas, the conferences are over and I'd like to keep the ball rolling. So...</p>
<p>This blog will be a collection of my thoughts and opinions, heavily influenced by and/or outright stolen from others (with appropriate credits/sources).</p>
<p>Without the great conversation and tooling coming from the community, I'd have nothing. I hope to share a few things that will help others, and learn from anybody interested enough to leave a comment!</p>
<p>I'll also probably post a bit about Music and DadOps stuff here and there...</p>
<p>Let's see where this goes!</p>
<p><em>... and let's hope I don't just abandon it after 3 posts.</em></p>
]]></content>
</entry>
</feed>
Jump to Line
Something went wrong with that request. Please try again.