I'm looking for ideas about chef cookbooks versions management. I know that you pin specific versions in the environment, but I'm not sure how to go about it.
We use librarian-chef which installs 3rd party community books into the cookbooks folder. We never touch those books and just update to more recent versions from time to time.
We also have our custom site-specific cookbooks from where we include community ones (include_recipe
).
Theoretically we could specify specific versions of community books our custom books depend on and then set our cookbook versions in the environment config, but the problem is that those community books could rely on some other books without specified versions. And that deep nested dependency could go on an on.
So there is no gurantee that when you upload cookbook to the chef server, it won't break prod, since dependent cookbooks might change as well.
The only solution I can see at the moment is to specify every single cookbook verion we use in the environment config, including community and custom ones. But then I have to go through each cookbook and figure out those versions.
We also do librarian-chef update for time to time and I imagine it might become difficult to track down versions that changed and not to forget to update version in the environmet when time comes.
Please, share your experience and best practices. I'm sure it will be super useful for other people.
It wasn't long after I started using Chef in earnest that I was coming up against these same issues. I only came to some sense of sanity when I started doing four things operationally. Note that these may not be considered "best practices" by some in the Chef community. Nonetheless, this is how I brought sanity, repeatability, and order to my world.
Hope this helps someone!
- UPDATE -
Nearly three years later, these principles have remained helpful to me. But I'll add one more piece of advice, and it's really for the same reasons I preferred chef-solo over chef.
There're 2 problems:
The article Essentials of cookbook versions is the best reference for cookbook versions. According to #1, you're right because it's a tough job to manage different version of cookbooks to serve different configuration set especially it's mixed with cookbook dependencies where most of the cookbook from cookbook site doesn't do this job well. So configuration may break. and if you didn't manage the versions by testing the runtime behavior of any component, it just breaks. So it's a bad idea to upload cookbook without specifying the version number in you environment object. So manage the cookbook versions in environment object, and carefully test when promoting version of any new cookbook. I usually manage the environment object in SCM and didn't upload to chef server via automated job until the changed cookbook can work well with rest of other existing component.
According to #2, it's a tricky topic because this is where the actual recipe dependency works on each node. In a nutshell, for critical nodes, you'd better control the dependency of recipes by specifying recipe version in node/role run list. I hardly do this because it's fine grit control and cost more on testing/promoting. However, for critical role/node, this is not a bad idea but provide insurance on configuration changes.