How Many Wrapper Cookbooks is Too Many?


#1

Ive used Chef for a while but mainly focused on individual projects. We would wrap a community cookbook for our project and move on. All was right with the world.

However, now I am in a position where we may want to write wrapper cookbooks for the company as a whole. But was wondering if that was going to bring an extra layer of chaos and dependency into the mix.

For example if I wanted to write a company wide Apache cookbook wrapper for Apache2, then someone wants to wrap my company cookbook. Is that going to cause problems? Doesnt Berks get upset with a dependency that deep? Am i introducing chaos?

Our thought was to have a base level cookbook teams could use that set company standards on a community coobook, then they wrap our cookbook.

Everything I have read up on is totally in favor of wrappers, but what about wrapping the wrappers?

This is a diagram of what I am talking back:

Community Cookbook <- Company Cookbook <- Project Cookbook


#2

Hi Kyle,

You pose an interesting question. My experience has shown that, for me, writing re-usable cookbooks using resources and providers is best except for the very most final wrapper cookbook.

Projects become very messy, very quickly, if there are too many layers of wrappers. For me, it also became nearly impossible to figure out the ‘right place’ to apply a fix, and if the workaround was really appropriate for that level (e.g. if you have a company cookbook for Apache, and one project needs a major change to it, where do you fix it? you could fix the library, fix the company wrapper, or do a workaround in the project wrapper). I also found that workarounds in the final project wrapper ended up almost always being “throw out the upstream cookbooks and directly use the library cookbooks.”

I think focusing on the library cookbook model is the best approach, and also allows the final project folks the ability to have direct access to all of the primitives they need (all of the resources they need) to setup the final wrapper. Library cookbooks have been proven to be much more composable than wrappers, in my work.

Hope this helps!

Martin