Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

7 Tips for Keeping Chef in Shape

DZone's Guide to

7 Tips for Keeping Chef in Shape

· DevOps Zone
Free Resource

The Nexus Suite is uniquely architected for a DevOps native world and creates value early in the development pipeline, provides precise contextual controls at every phase, and accelerates DevOps innovation with automation you can trust. Read how in this ebook.

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.  See how the Nexus platform infuses precise open source component intelligence into the DevOps pipeline early, everywhere, and at scale. Read how in this ebook

Topics:

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

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}