Uploading Community Cookbooks from Supermarket to Chef Server

As I've mentioned recently, I'm working on rebuilding our Chef pipelines at work.

As we're running a Chef Server, we need some way to sync from our public Supermarket to our Chef Server, so we can take advantage of the wonderful work that the community has done with their Free and Open Source cookbooks.

As I'd mentioned in Constructing an Ordered Dependency Graph for Chef Cookbooks, using Berkshelf, this can cause issues due to dependency trees, as a cookbook can't be uploaded to the Chef Server unless a dependency is present already uploaded.

While looking into it, a Chef Friend in the Community Slack mentioned that the solution is generally to use berks upload.

For instance, to use the consul cookbook at version 4.5.0, we'd create the Berksfile:

source 'https://supermarket.chef.io'

cookbook 'consul', '4.5.0'

Then we would run:

# if it exists, we should remove it so we re-calculate any dependency graphs
rm -f Berksfile.lock
berks install
berks upload

Where berks upload will use the Chef configuration (i.e. in config.rb) and upload to the given Chef Server.

Note that this will only pull the latest versions of cookbooks - I'm looking at what we can do to be more conservative against what's available in the Chef Server.

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #chef #berkshelf.

This post was filed under articles.

Related Posts

Other posts you may be interested in:

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.