This guide will show you how to share a cookbook on the public Chef Supermarket. The public Supermarket uses Hosted Chef, the Chef-as-a-service provider, for user authentication. You will need a Hosted Chef account to share cookbooks.
Note
Create a Hosted Chef Account
-
Go to the Hosted Chef signup page and enter the requested information to create your account.
-
You will receive a confirmation email. Use the link in the email to confirm your confirm your email address.
-
Log in to Hosted Chef and select the Create New Organization button:
-
Download and extract the Hosted Chef starter kit:
Share Cookbooks via Knife
Use the knife supermarket command to upload cookbooks to the Supermarket via Knife. In this section you’ll configure the chef-repo that was created by the Hosted Chef starter kit, and then upload cookbooks from your workstation’s cookbook repository.
Note
-
The
config.rb
file located under/chef-repo/.chef/config.rb
contains the basic information necessary to authenticate with Hosted Chef. It will look similar to the following:current_dir = __dir__ node_name 'brewn' client_key "#{current_dir}/brewn.pem" chef_server_url 'https://api.chef.io/organizations/chfex' cookbook_path ["#{current_dir}/../cookbooks"]
However if you’re not an existing Hosted Chef user, you’ve most likely created your cookbooks within another repository with its own Knife configuration. Instead of modifying your workstation setup, simply add the path to your cookbook repository under the
cookbook_path
setting in your Hosted Chef chef-repo. For example:cookbook_path ['~/my-repo/cookbooks']
-
Use the
knife supermarket
command to upload your cookbook to the Supermarket:knife supermarket share example_cookbook
Alternatively, if you choose not to modify the location of your cookbook repository within your
config.rb
, you can specify the cookbook path in yourknife
command:knife supermarket share example_cookbook -o ~/my-repo/cookbooks
Was this page helpful?