Over a million developers have joined DZone.

7 Tips for Keeping Chef in Shape

DZone's Guide to

7 Tips for Keeping Chef in Shape

· DevOps Zone
Free Resource

The DevOps Zone is brought to you in partnership with Sonatype Nexus. The Nexus Suite helps scale your DevOps delivery with continuous component intelligence integrated into development tools, including Eclipse, IntelliJ, Jenkins, Bamboo, SonarQube and more. Schedule a demo today

These are the things I'm trying out to keep their Chef codebases (and the infrastructure they control) in shape:

  1. Lint stuffs: Syntax checking (rb,irb, conf files etc), style checks, some best practices check (like check for Chef solo), mostly using foodcritic wrapped in rake running it under the Go engine (this setup was done by nikhil initally)
  2. Check for context level best practices (check for defined environments, nodes with an empty runlist, number of updated resources after two consecutive runs [to check idempotency], direct asignment of recipes [always via role] etc) using rspec/Chef API and rake. This is more like integration test.
  3. Infrastructure test: triggering nrpe based tests or minitest report handlers to acknowledge the service provisioning has taken  place correctly.
  4. Versioning cookbooks, version freezing cookbooks per environment and above all enforcing conventions like (app_project_environment) . The rest of the checks handle the tooling by exploiting these conventions. Anything that does not adhere to these are bound to become a work of art.
  5. Measuring most of the stuff using defined states and quantifiiable metrics (if possible), and then graph it (nagios/nrpe and graphite)
  6. Having a common understanding of what goes where (definition? library? lwrp? mulitple recipes?) inside a Chef codebase.
  7. And right now, I'm in the process of setting up a CI server to test the whole community+our own cookbooks against Ubuntu/CentOS containers using openvz against our own build pipelines.

Lastly, if you are building SaaS or PaaS, you are bound to hit the volume of Chef/Puppet/Cfengine scripts that will need their own CI.

The DevOps Zone is brought to you in partnership with Sonatype Nexus. Use the Nexus Suite to automate your software supply chain and ensure you're using the highest quality open source components at every step of the development lifecycle. Get Nexus today


Published at DZone with permission of Ranjib Dey, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}