I recently gave a webinar on Chef Supermarket. If you missed it, you can watch the recording here:
Users learned how to make full use of Chef Supermarket and best practices for both using cookbooks from Chef Supermarket and uploading cookbooks to Chef Supermarket.
What is Supermarket?
Supermarket is the one stop shop for Chef community cookbooks and tools.
It’s worth mentioning that there are currently two versions of Supermarket. There is the public Supermarket site and also a private version of Supermarket the companies can use behind a firewall.
This blog post will only cover the public Supermarket, but be on the lookout for a new webinar and blog post about using private Supermarket soon!
How do I use Supermarket?
There are two ways to interact with Chef Supermarket.
The first is through the web browser at https://supermarket.chef.io.
The other is through the command line, using the knife tool’s cookbook site commands:
knife cookbook site
For more information about using the knife cookbook site commands, please check out this blog post: Using Chef Supermarket: A Guided Tour.
Contributor License Agreements
If you’d like to contribute to a Chef maintained projects (i.e. a community cookbook), you will need to sign a Contributor License Agreement. There are two types of Contributor License Agreements used by Chef:
* ICLA (Individual Contributor License Agreement) – this is what you use when you are contributing work you have done yourself on your own time.
* CCLA (Corporate Contributor License Agreement) – this is what you use when you are contributing work you did for a company and the company maintains the copyright for that work.
You can sign a license through your Supermarket account by clicking on the arrow next to your username, then selecting the appropriate Contributor License Agreement.
You will then be prompted to connect your Github account. You do need a Github account to sign a CLA, and the email associated with your Github account must match the email associated with your hosted Chef account.
Best Practices for using Supermarket cookbooks
* Read the code first – read through any code you pull down from Supermarket before you use it
* Keep perspective – realize that although the cookbook solved the cookbook author’s problems, it may not solve your’s completely. However, it may help with your problems.
* Consider contributing and adopting – most cookbooks are on Github and accept pull requests and issues. Remember, cookbook owners and maintainers are real people, be nice. If a cookbook is not meeting your needs, but has an “Adopt Me!” button when you view it on Supermarket, consider adopting it.
Best Practices for sharing Supermarket cookbooks
* Include a source_url in your cookbook’s metadata – this will ensure that the “View Source” button will appear on your cookbook’s page on Supermarket and link to your source code repo.
* Include an issues_url in your cookbook’s metadata – this will ensure that the “View Issues” button will appear on your cookbook’s page on Supermarket and link to your cookbook’s issue tracking page.
* Put cookbooks up for adoption – if you are no longer able (or no longer want) to maintain your cookbook, put it up for adoption so someone else can adopt it and take over maintenance.
Supermarket is for the Chef Community
A couple of questions came into the webinar after we finished broadcasting. Here they are along with some answers.
What is the best method to keep supermarket cookbooks up-to-date in my chef repo?
If you are using a Chef repo, I recommend using the knife cookbook site install command to keep your cookbooks up to date. When a cookbook is changed on Supermarket and you run knife cookbook site install, it will download the latest versions of the cookbook and install it, even if you have a previous version in your repo.
Is the knife command going to change to `chef supermarket`?
No. There is a knife plugin you can use either with public or (more commonly) private versions of Supermarket called knife-supermarket. When you use this plugin, you will run knife supermarket commands, rather than knife cookbook site commands.
There are no plans to change the knife command to ‘chef supermarket.’
Where should we go to learn more about Berkshelf?
Check out the Berkshelf homepage.
If you want to know more about Stove, another very useful tool that can be used with Supermarket, check out the Stove homepage.