Using Berkshelf 3 with multiple sources


#1

Are there some good practices on using Chef with multiple sources?

Let’s assume I have the following setup:

  1. Private cookbooks repo
  • apt v0.0.1
  1. supermarket.getchef.com
  • apt v0.0.2
  1. Cookbook mycook depends on apt cookbook.
  2. Both apt v0.0.1 and v0.0.2 are already installed(as dependencies of some
    other cookbooks) in ~/.berkshelf/cookbooks
  3. mycook/Berksfile:
    source 'my-private-repo’
    source 'supermarket’
    metadata

In such setup berks install from ‘mycoook’ cookbook will always be using
the highest available version found in ~/.berkshelf/cookbooks, in this case
it’s apt v0.0.2. It doesn’t care about the order of sources in Berksfile. I
understand why it happens but it doesn’t suit me.

To make Berkshelf using apt v.0.0.1 I can:

  1. remove apt 0.0.2 from ~/.berkshelf/cookbooks
    or
  2. berks vendor cookbook in dir other than ~/.berkshelf/cookbooks
    or
  3. specify private source for ‘apt’ cookbook in Berksfile
    or
  4. specify v0.0.1 version for ‘apt’ cookbook in Berksfile

Since I have a lot of private cookbooks intersecting with community’s
cookbooks specifying source or version in Berksfile for each dependent
cookbook is not a great idea.
Options 1 and 2 require extra actions instead of simple berks install.

Is there a better way of handling such workflow?


Best regards,
Koldaev Anton


#2

I’m not a skilled user of Berkshire, but what I understood is that your 4th option is the way Berkshire was intended, each cookbook should specify which cookbook in which version it needs.
You may even give a github or local path to a cookbook you modified fir your needs and so overwriting the sources…

---- Anton Koldaev a écrit ----

Are there some good practices on using Chef with multiple sources?

Let’s assume I have the following setup:

  1. Private cookbooks repo
  • apt v0.0.1
  1. supermarket.getchef.com
  • apt v0.0.2
  1. Cookbook mycook depends on apt cookbook.

  2. Both apt v0.0.1 and v0.0.2 are already installed(as dependencies of some other cookbooks) in ~/.berkshelf/cookbooks

  3. mycook/Berksfile:

source ‘my-private-repo’

source ‘supermarket’

metadata

In such setup berks install from ‘mycoook’ cookbook will always be using the highest available version found in ~/.berkshelf/cookbooks, in this case it’s apt v0.0.2. It doesn’t care about the order of sources in Berksfile. I understand why it happens but it doesn’t suit me.

To make Berkshelf using apt v.0.0.1 I can:

  1. remove apt 0.0.2 from ~/.berkshelf/cookbooks

or

  1. berks vendor cookbook in dir other than ~/.berkshelf/cookbooks

or

  1. specify private source for ‘apt’ cookbook in Berksfile

or

  1. specify v0.0.1 version for ‘apt’ cookbook in Berksfile

Since I have a lot of private cookbooks intersecting with community’s cookbooks specifying source or version in Berksfile for each dependent cookbook is not a great idea.

Options 1 and 2 require extra actions instead of simple berks install.

Is there a better way of handling such workflow?


Best regards,
Koldaev Anton


#3

On Sep 3, 2014, at 1:53 PM, Anton Koldaev koldaevav@gmail.com wrote:

Are there some good practices on using Chef with multiple sources?

Let’s assume I have the following setup:

  1. Private cookbooks repo
  • apt v0.0.1
  1. supermarket.getchef.com
  • apt v0.0.2
  1. Cookbook mycook depends on apt cookbook.
  2. Both apt v0.0.1 and v0.0.2 are already installed(as dependencies of some other cookbooks) in ~/.berkshelf/cookbooks
  3. mycook/Berksfile:
    source 'my-private-repo’
    source 'supermarket’
    metadata

In such setup berks install from ‘mycoook’ cookbook will always be using the highest available version found in ~/.berkshelf/cookbooks, in this case it’s apt v0.0.2. It doesn’t care about the order of sources in Berksfile. I understand why it happens but it doesn’t suit me.

To make Berkshelf using apt v.0.0.1 I can:

  1. remove apt 0.0.2 from ~/.berkshelf/cookbooks
    or
  2. berks vendor cookbook in dir other than ~/.berkshelf/cookbooks
    or
  3. specify private source for ‘apt’ cookbook in Berksfile
    or
  4. specify v0.0.1 version for ‘apt’ cookbook in Berksfile

Since I have a lot of private cookbooks intersecting with community’s cookbooks specifying source or version in Berksfile for each dependent cookbook is not a great idea.
Options 1 and 2 require extra actions instead of simple berks install.

Is there a better way of handling such workflow?

You just have to run your own berks-api server that has both the community site and chef server sources configured. AFAIK Berks 3 only supports a single API server at a time right now, though this might change in the future.

–Noah