Nepal on Rails

millisami's rants!

Publishing Cookbook to Chef Community Site

After creating my first errbit cookbook, and publishing it on the chef community site, I’d to do some stretches to publish it.

First, you need to tgz your cookbook and it should have the metadata.json file otherwise the validation fails and the cookbook won’t be published.

So, I am putting it here for me and others:

In your cookbook dir, create a dir .chef with a knife.rb file in it with the following line:

cookbook_path "."

Then issue the command knife cookbook metadata . (Don’t forget the dot) This will generate metadata.json file.

Better to commit it here and push the changes to your git repo.

Now step out 1 dir path from your cookbook folder and do the compressing.

cd ..
tar -czf errbit.tgz --exclude bin --exclude .envrc --exclude .vagrant --exclude .bundle errbit

You might have to change/add the --exclude vars according to your setup.

Now we’ve the errbit.tgz file with the metadata.json file in it which you can upload to the community site at http://community.opscode.com/cookbooks/ne w

When updating the cookbook later, do change the version in metadata.rb file and repeat the same process to publish your cookbook’s changes.