Re: organizing cookbooks, and individual projects


You should have a good look at berkshelf for managing your cookbooks. Keep each cookbook you are developing in its own repo. Berkshelf will manage its dependencies and source the required external cookbooks from OpsCode, git, specific location or a chef server.


Warren Bain
Australia’s cloud
direct: +61 2 8221 7729
mobile: +61 414 867 559

S Ahmed wrote:
I use chef using chef-solo to bootstrap my ec2 instances etc.

Now currently I have a project where I have all my recipes in a folder:


I want to keep doing this for other projects, but obviously don’t want to be duplicating my work.

Since recipes are suppose to work by themeselves (ignoring dependent recipes), how would you recommend I organize things?

I was thinking of this:

  1. Have a git repo that has all my cookbook and recipes
  2. for my individual projects, I somehow link to this master git repo, and then have whatever is specific to this project like:

**/cookbooks <-- git submodule of my main cookbooks
/roles/base.rb etc.

Does this make sense?

I think the key point to make sure things don’t break is for me to link to the master /cookbooks git repo using a specific changeset/branch to ensure things work even when I update the master cookbooks repo.

I’m guessing this is an obvious setup, but I just haven’t though things through to set things up for multiple projects.

I’m not a big company, so I don’t need anything more eleborate than this assuming it makes sense.

Is a git sub-module the way to go, I haven’t done this before so not sure how to set this up, do you guys use rake?