How to setup Berkshelf to install ALL cookooks "recuresively', with only role cookbooks in it?


#1

I want to setup an environment cookbook Berksfile with nothing but role cookbooks in it, and the role cookbooks themselves will then aggregate the specific cookbooks they need. For example

myApp/Berksfile
cookbook ‘app1_role’, git: 'git@git-server.domain.com:group/app1_role.git’
cookbook ‘app2_role’, git: ‘git@git-server.domain.com:group/app2_role.git’

myApp/metadata.rb
depends ‘app1_role’, '~> 1.0.0’
depends ‘app2_role’, ‘~> 1.0.0’

app1_role/metadata.rb
depends ‘cookbook1’, '= 1.0.0’
depends 'cookbook2, ‘= 1.0.0’

app2_role/metadata.rb
depends ‘cookbook3’, '= 1.0.0’
depends 'cookbook4, ‘= 1.0.0’

How can I set this up so I ONLY have the role cookbooks, but not the individual cookbooks they need, in my environment cookbook’s Berksfile, and when I do a berks install, it will auto-magically install the cookbooks that my role cookbooks need? Currently, I also have to include the cookbooks that my role cookbooks need in my environment Berksfile.

Make sense?

Chris


#2

Hey Chris,

Berkshelf should actually resolve the dependencies transitively.

In your top-level Berksfile you should only need the role cookbooks. Once
you run a ‘berks install’ there you should get a Berksfile.lock which locks
the whole dependency graph, including the transitive ones.

Do you observe something different?

HTH,
Torben
Am 07.04.2015 19:23 schrieb “Fouts, Chris” Chris.Fouts@sensus.com:

I want to setup an environment cookbook Berksfile with nothing but role
cookbooks in it, and the role cookbooks themselves will then aggregate the
specific cookbooks they need. For example

myApp/Berksfile

cookbook ‘app1_role’, git: ‘git@git-server.domain.com:group/app1_role.git’

cookbook ‘app2_role’, git: ‘git@git-server.domain.com:group/app2_role.git’

myApp/metadata.rb

depends ‘app1_role’, ‘~> 1.0.0’

depends ‘app2_role’, ‘~> 1.0.0’

app1_role/metadata.rb

depends ‘cookbook1’, ‘= 1.0.0’

depends ‘cookbook2, ‘= 1.0.0’

app2_role/metadata.rb

depends ‘cookbook3’, ‘= 1.0.0’

depends ‘cookbook4, ‘= 1.0.0’

How can I set this up so I ONLY have the role cookbooks, but not the
individual cookbooks they need, in my environment cookbook’s Berksfile, and
when I do a berks install, it will auto-magically install the cookbooks
that my role cookbooks need? Currently, I also have to include the
cookbooks that my role cookbooks need in my environment Berksfile.

Make sense?

Chris


#3

Note, these are NOT supermarket cookbooks, but rather our company cookbooks on our own git server, which is not configured like a super market.

Knowing this, should I still expect this to work?

Chris

From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 3:13 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How to setup Berkshelf to install ALL cookooks "recuresively’, with only role cookbooks in it?

Hey Chris,

Berkshelf should actually resolve the dependencies transitively.

In your top-level Berksfile you should only need the role cookbooks. Once you run a ‘berks install’ there you should get a Berksfile.lock which locks the whole dependency graph, including the transitive ones.

Do you observe something different?

HTH,
Torben
Am 07.04.2015 19:23 schrieb “Fouts, Chris” <Chris.Fouts@sensus.commailto:Chris.Fouts@sensus.com>:
I want to setup an environment cookbook Berksfile with nothing but role cookbooks in it, and the role cookbooks themselves will then aggregate the specific cookbooks they need. For example

myApp/Berksfile
cookbook ‘app1_role’, git: ‘git@git-server.domain.com:group/app1_role.git’
cookbook ‘app2_role’, git: ‘git@git-server.domain.com:group/app2_role.git’

myApp/metadata.rb
depends ‘app1_role’, ‘~> 1.0.0’
depends ‘app2_role’, ‘~> 1.0.0’

app1_role/metadata.rb
depends ‘cookbook1’, ‘= 1.0.0’
depends ‘cookbook2, ‘= 1.0.0’

app2_role/metadata.rb
depends ‘cookbook3’, ‘= 1.0.0’
depends ‘cookbook4, ‘= 1.0.0’

How can I set this up so I ONLY have the role cookbooks, but not the individual cookbooks they need, in my environment cookbook’s Berksfile, and when I do a berks install, it will auto-magically install the cookbooks that my role cookbooks need? Currently, I also have to include the cookbooks that my role cookbooks need in my environment Berksfile.

Make sense?

Chris


#4

Yep, you should expect this to work. Everything else would be a big
surprise to me at least…

Have you tried it already, or are you just elaborating how to set things up?

Cheers, Torben

On Tue, Apr 7, 2015 at 9:44 PM, Fouts, Chris Chris.Fouts@sensus.com wrote:

Note, these are NOT supermarket cookbooks, but rather our company cookbooks
on our own git server, which is not configured like a super market.

Knowing this, should I still expect this to work?

Chris

From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 3:13 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How to setup Berkshelf to install ALL cookooks
"recuresively’, with only role cookbooks in it?

Hey Chris,

Berkshelf should actually resolve the dependencies transitively.

In your top-level Berksfile you should only need the role cookbooks. Once
you run a ‘berks install’ there you should get a Berksfile.lock which locks
the whole dependency graph, including the transitive ones.

Do you observe something different?

HTH,
Torben

Am 07.04.2015 19:23 schrieb “Fouts, Chris” Chris.Fouts@sensus.com:

I want to setup an environment cookbook Berksfile with nothing but role
cookbooks in it, and the role cookbooks themselves will then aggregate the
specific cookbooks they need. For example

myApp/Berksfile

cookbook ‘app1_role’, git: ‘git@git-server.domain.com:group/app1_role.git’

cookbook ‘app2_role’, git: ‘git@git-server.domain.com:group/app2_role.git’

myApp/metadata.rb

depends ‘app1_role’, ‘~> 1.0.0’

depends ‘app2_role’, ‘~> 1.0.0’

app1_role/metadata.rb

depends ‘cookbook1’, ‘= 1.0.0’

depends ‘cookbook2, ‘= 1.0.0’

app2_role/metadata.rb

depends ‘cookbook3’, ‘= 1.0.0’

depends ‘cookbook4, ‘= 1.0.0’

How can I set this up so I ONLY have the role cookbooks, but not the
individual cookbooks they need, in my environment cookbook’s Berksfile, and
when I do a berks install, it will auto-magically install the cookbooks that
my role cookbooks need? Currently, I also have to include the cookbooks that
my role cookbooks need in my environment Berksfile.

Make sense?

Chris


#5

I think the Berkshelf API server was made pretty much for this purpose.

On Tue, Apr 7, 2015 at 1:04 PM, Torben Knerr mail@tknerr.de wrote:

Yep, you should expect this to work. Everything else would be a big
surprise to me at least…

Have you tried it already, or are you just elaborating how to set things
up?

Cheers, Torben

On Tue, Apr 7, 2015 at 9:44 PM, Fouts, Chris Chris.Fouts@sensus.com
wrote:

Note, these are NOT supermarket cookbooks, but rather our company
cookbooks
on our own git server, which is not configured like a super market.

Knowing this, should I still expect this to work?

Chris

From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 3:13 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How to setup Berkshelf to install ALL cookooks
"recuresively’, with only role cookbooks in it?

Hey Chris,

Berkshelf should actually resolve the dependencies transitively.

In your top-level Berksfile you should only need the role cookbooks. Once
you run a ‘berks install’ there you should get a Berksfile.lock which
locks
the whole dependency graph, including the transitive ones.

Do you observe something different?

HTH,
Torben

Am 07.04.2015 19:23 schrieb “Fouts, Chris” Chris.Fouts@sensus.com:

I want to setup an environment cookbook Berksfile with nothing but role
cookbooks in it, and the role cookbooks themselves will then aggregate
the
specific cookbooks they need. For example

myApp/Berksfile

cookbook ‘app1_role’, git: ‘git@git-server.domain.com:
group/app1_role.git’

cookbook ‘app2_role’, git: ‘git@git-server.domain.com:
group/app2_role.git’

myApp/metadata.rb

depends ‘app1_role’, ‘~> 1.0.0’

depends ‘app2_role’, ‘~> 1.0.0’

app1_role/metadata.rb

depends ‘cookbook1’, ‘= 1.0.0’

depends ‘cookbook2, ‘= 1.0.0’

app2_role/metadata.rb

depends ‘cookbook3’, ‘= 1.0.0’

depends ‘cookbook4, ‘= 1.0.0’

How can I set this up so I ONLY have the role cookbooks, but not the
individual cookbooks they need, in my environment cookbook’s Berksfile,
and
when I do a berks install, it will auto-magically install the cookbooks
that
my role cookbooks need? Currently, I also have to include the cookbooks
that
my role cookbooks need in my environment Berksfile.

Make sense?

Chris


Yoshi Spendiff
DevOps Engineer
Indochino
Mobile: +1 778 952 2025
Email: yoshi.spendiff@indochino.com


#6

I’ve already tried it, and I get error below. In this example, I have an arqiva_rni_dev environment cookbook, which depends on linux_role role cookbook, and itself depends on common-log cookbook. I have ALL the correct version in my Git repo.

Here’s my Berksfile

source “https://supermarket.chef.io

metadata

Community cookbooks

cookbook 'chef-client’
cookbook 'powershell’
cookbook ‘push-jobs’

Company cookbooks

cookbook ‘linux_role’, git: ‘git@git-server:arqchefcookbooks/linux_role.git’

My metadata.rb is

name ‘arqiva_rni_dev’
(snip)
depends ‘linux_role’, ‘1.0.2’

My linux_role/metadata.rb has

depends ‘common-log’, ‘~> 0.1.0’

$ berks install
Resolving cookbook dependencies…
Fetching ‘arqiva_rni_dev’ from source at .
Fetching ‘linux_role’ from git@git-server:arqchefcookbooks/linux_role.git (at master)
Fetching cookbook index from https://supermarket.chef.io
Unable to satisfy constraints on package common-log, which does not exist, due to solution constraint (arqiva_rni_dev = 0.1.0). Solution constraints that may result in a constraint on common-log: [(arqiva_rni_dev = 0.1.0) -> (linux_role = 1.0.2) -> (common-log = 0.1.0)], [(linux_role = 1.0.2) -> (common-log = 0.1.0)]
Missing artifacts: common-log
Demand that cannot be met: (arqiva_rni_dev = 0.1.0)
Unable to find a solution for demands: arqiva_rni_dev (0.1.0), chef-client (>= 0.0.0), linux_role (1.0.2), powershell (>= 0.0.0), push-jobs (>= 0.0.0)

I can get rid of the error by including the common-log cookbook in my top-level Berksfile, but you’re saying I should NOT have to do this.

Chris

-----Original Message-----
From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 4:05 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: How to setup Berkshelf to install ALL cookooks "recuresively’, with only role cookbooks in it?

Yep, you should expect this to work. Everything else would be a big surprise to me at least…

Have you tried it already, or are you just elaborating how to set things up?

Cheers, Torben

On Tue, Apr 7, 2015 at 9:44 PM, Fouts, Chris Chris.Fouts@sensus.com wrote:

Note, these are NOT supermarket cookbooks, but rather our company
cookbooks on our own git server, which is not configured like a super market.

Knowing this, should I still expect this to work?

Chris

From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 3:13 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How to setup Berkshelf to install ALL cookooks
"recuresively’, with only role cookbooks in it?

Hey Chris,

Berkshelf should actually resolve the dependencies transitively.

In your top-level Berksfile you should only need the role cookbooks.
Once you run a ‘berks install’ there you should get a Berksfile.lock
which locks the whole dependency graph, including the transitive ones.

Do you observe something different?

HTH,
Torben

Am 07.04.2015 19:23 schrieb “Fouts, Chris” Chris.Fouts@sensus.com:

I want to setup an environment cookbook Berksfile with nothing but
role cookbooks in it, and the role cookbooks themselves will then
aggregate the specific cookbooks they need. For example

myApp/Berksfile

cookbook ‘app1_role’, git: ‘git@git-server.domain.com:group/app1_role.git’

cookbook ‘app2_role’, git: ‘git@git-server.domain.com:group/app2_role.git’

myApp/metadata.rb

depends ‘app1_role’, ‘~> 1.0.0’

depends ‘app2_role’, ‘~> 1.0.0’

app1_role/metadata.rb

depends ‘cookbook1’, ‘= 1.0.0’

depends ‘cookbook2, ‘= 1.0.0’

app2_role/metadata.rb

depends ‘cookbook3’, ‘= 1.0.0’

depends ‘cookbook4, ‘= 1.0.0’

How can I set this up so I ONLY have the role cookbooks, but not the
individual cookbooks they need, in my environment cookbook’s
Berksfile, and when I do a berks install, it will auto-magically
install the cookbooks that my role cookbooks need? Currently, I also
have to include the cookbooks that my role cookbooks need in my environment Berksfile.

Make sense?

Chris


#7

Oh, right. I thought only your (2nd level) role cookbooks would be
hosted internally. If you have internally hosted dependent cookbooks
like “common-log” etc deep down in your dependency graph you must
inlcude their inhouse git location in the top-level Berksfile. The
nested Berksfiles are not evaluated.

Or, as Yoshi said, you can host your own inhouse Berkshelf API server.
And Chef Server is such a thing too. So if you have an internal Chef
Server anyway, you could use that. If not, you could run
https://github.com/berkshelf/berkshelf-api directly. Or just repeat
the internal locations in your top-level Berksfile (ugly but easiest).

If anybody knows a server-less solution for that, I’d be interested too…

HTH, Torben

On Tue, Apr 7, 2015 at 10:27 PM, Fouts, Chris Chris.Fouts@sensus.com wrote:

I’ve already tried it, and I get error below. In this example, I have an arqiva_rni_dev environment cookbook, which depends on linux_role role cookbook, and itself depends on common-log cookbook. I have ALL the correct version in my Git repo.

Here’s my Berksfile

source “https://supermarket.chef.io

metadata

Community cookbooks

cookbook 'chef-client’
cookbook 'powershell’
cookbook ‘push-jobs’

Company cookbooks

cookbook ‘linux_role’, git: ‘git@git-server:arqchefcookbooks/linux_role.git’

My metadata.rb is

name ‘arqiva_rni_dev’
(snip)
depends ‘linux_role’, ‘1.0.2’

My linux_role/metadata.rb has

depends ‘common-log’, ‘~> 0.1.0’

$ berks install
Resolving cookbook dependencies…
Fetching ‘arqiva_rni_dev’ from source at .
Fetching ‘linux_role’ from git@git-server:arqchefcookbooks/linux_role.git (at master)
Fetching cookbook index from https://supermarket.chef.io
Unable to satisfy constraints on package common-log, which does not exist, due to solution constraint (arqiva_rni_dev = 0.1.0). Solution constraints that may result in a constraint on common-log: [(arqiva_rni_dev = 0.1.0) -> (linux_role = 1.0.2) -> (common-log = 0.1.0)], [(linux_role = 1.0.2) -> (common-log = 0.1.0)]
Missing artifacts: common-log
Demand that cannot be met: (arqiva_rni_dev = 0.1.0)
Unable to find a solution for demands: arqiva_rni_dev (0.1.0), chef-client (>= 0.0.0), linux_role (1.0.2), powershell (>= 0.0.0), push-jobs (>= 0.0.0)

I can get rid of the error by including the common-log cookbook in my top-level Berksfile, but you’re saying I should NOT have to do this.

Chris

-----Original Message-----
From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 4:05 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: How to setup Berkshelf to install ALL cookooks "recuresively’, with only role cookbooks in it?

Yep, you should expect this to work. Everything else would be a big surprise to me at least…

Have you tried it already, or are you just elaborating how to set things up?

Cheers, Torben

On Tue, Apr 7, 2015 at 9:44 PM, Fouts, Chris Chris.Fouts@sensus.com wrote:

Note, these are NOT supermarket cookbooks, but rather our company
cookbooks on our own git server, which is not configured like a super market.

Knowing this, should I still expect this to work?

Chris

From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 3:13 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How to setup Berkshelf to install ALL cookooks
"recuresively’, with only role cookbooks in it?

Hey Chris,

Berkshelf should actually resolve the dependencies transitively.

In your top-level Berksfile you should only need the role cookbooks.
Once you run a ‘berks install’ there you should get a Berksfile.lock
which locks the whole dependency graph, including the transitive ones.

Do you observe something different?

HTH,
Torben

Am 07.04.2015 19:23 schrieb “Fouts, Chris” Chris.Fouts@sensus.com:

I want to setup an environment cookbook Berksfile with nothing but
role cookbooks in it, and the role cookbooks themselves will then
aggregate the specific cookbooks they need. For example

myApp/Berksfile

cookbook ‘app1_role’, git: ‘git@git-server.domain.com:group/app1_role.git’

cookbook ‘app2_role’, git: ‘git@git-server.domain.com:group/app2_role.git’

myApp/metadata.rb

depends ‘app1_role’, ‘~> 1.0.0’

depends ‘app2_role’, ‘~> 1.0.0’

app1_role/metadata.rb

depends ‘cookbook1’, ‘= 1.0.0’

depends ‘cookbook2, ‘= 1.0.0’

app2_role/metadata.rb

depends ‘cookbook3’, ‘= 1.0.0’

depends ‘cookbook4, ‘= 1.0.0’

How can I set this up so I ONLY have the role cookbooks, but not the
individual cookbooks they need, in my environment cookbook’s
Berksfile, and when I do a berks install, it will auto-magically
install the cookbooks that my role cookbooks need? Currently, I also
have to include the cookbooks that my role cookbooks need in my environment Berksfile.

Make sense?

Chris


#8

Yes I do have internal Chef 12 Enterprise server. So how can I set it up as a Berkshelf API server, by installing this in my Chef server https://github.com/berkshelf/berkshelf-api

Chris

-----Original Message-----
From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 7:17 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: RE: Re: How to setup Berkshelf to install ALL cookooks "recuresively’, with only role cookbooks in it?

Oh, right. I thought only your (2nd level) role cookbooks would be hosted internally. If you have internally hosted dependent cookbooks like “common-log” etc deep down in your dependency graph you must inlcude their inhouse git location in the top-level Berksfile. The nested Berksfiles are not evaluated.

Or, as Yoshi said, you can host your own inhouse Berkshelf API server.
And Chef Server is such a thing too. So if you have an internal Chef Server anyway, you could use that. If not, you could run https://github.com/berkshelf/berkshelf-api directly. Or just repeat the internal locations in your top-level Berksfile (ugly but easiest).

If anybody knows a server-less solution for that, I’d be interested too…

HTH, Torben

On Tue, Apr 7, 2015 at 10:27 PM, Fouts, Chris Chris.Fouts@sensus.com wrote:

I’ve already tried it, and I get error below. In this example, I have an arqiva_rni_dev environment cookbook, which depends on linux_role role cookbook, and itself depends on common-log cookbook. I have ALL the correct version in my Git repo.

Here’s my Berksfile

source “https://supermarket.chef.io

metadata

Community cookbooks

cookbook 'chef-client’
cookbook 'powershell’
cookbook ‘push-jobs’

Company cookbooks

cookbook ‘linux_role’, git: ‘git@git-server:arqchefcookbooks/linux_role.git’

My metadata.rb is

name ‘arqiva_rni_dev’
(snip)
depends ‘linux_role’, ‘1.0.2’

My linux_role/metadata.rb has

depends ‘common-log’, ‘~> 0.1.0’

$ berks install
Resolving cookbook dependencies…
Fetching ‘arqiva_rni_dev’ from source at .
Fetching ‘linux_role’ from
git@git-server:arqchefcookbooks/linux_role.git (at master) Fetching cookbook index from https://supermarket.chef.io
Unable to satisfy constraints on package common-log, which does not
exist, due to solution constraint (arqiva_rni_dev = 0.1.0). Solution
constraints that may result in a constraint on common-log:
[(arqiva_rni_dev = 0.1.0) -> (linux_role = 1.0.2) -> (common-log =
0.1.0)], [(linux_role = 1.0.2) -> (common-log = 0.1.0)] Missing
artifacts: common-log Demand that cannot be met: (arqiva_rni_dev =
0.1.0) Unable to find a solution for demands: arqiva_rni_dev (0.1.0),
chef-client (>= 0.0.0), linux_role (1.0.2), powershell (>= 0.0.0),
push-jobs (>= 0.0.0)

I can get rid of the error by including the common-log cookbook in my top-level Berksfile, but you’re saying I should NOT have to do this.

Chris

-----Original Message-----
From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 4:05 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: How to setup Berkshelf to install ALL cookooks "recuresively’, with only role cookbooks in it?

Yep, you should expect this to work. Everything else would be a big surprise to me at least…

Have you tried it already, or are you just elaborating how to set things up?

Cheers, Torben

On Tue, Apr 7, 2015 at 9:44 PM, Fouts, Chris Chris.Fouts@sensus.com wrote:

Note, these are NOT supermarket cookbooks, but rather our company
cookbooks on our own git server, which is not configured like a super market.

Knowing this, should I still expect this to work?

Chris

From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 3:13 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How to setup Berkshelf to install ALL cookooks
"recuresively’, with only role cookbooks in it?

Hey Chris,

Berkshelf should actually resolve the dependencies transitively.

In your top-level Berksfile you should only need the role cookbooks.
Once you run a ‘berks install’ there you should get a Berksfile.lock
which locks the whole dependency graph, including the transitive ones.

Do you observe something different?

HTH,
Torben

Am 07.04.2015 19:23 schrieb “Fouts, Chris” Chris.Fouts@sensus.com:

I want to setup an environment cookbook Berksfile with nothing but
role cookbooks in it, and the role cookbooks themselves will then
aggregate the specific cookbooks they need. For example

myApp/Berksfile

cookbook ‘app1_role’, git: ‘git@git-server.domain.com:group/app1_role.git’

cookbook ‘app2_role’, git: ‘git@git-server.domain.com:group/app2_role.git’

myApp/metadata.rb

depends ‘app1_role’, ‘~> 1.0.0’

depends ‘app2_role’, ‘~> 1.0.0’

app1_role/metadata.rb

depends ‘cookbook1’, ‘= 1.0.0’

depends ‘cookbook2, ‘= 1.0.0’

app2_role/metadata.rb

depends ‘cookbook3’, ‘= 1.0.0’

depends ‘cookbook4, ‘= 1.0.0’

How can I set this up so I ONLY have the role cookbooks, but not the
individual cookbooks they need, in my environment cookbook’s
Berksfile, and when I do a berks install, it will auto-magically
install the cookbooks that my role cookbooks need? Currently, I also
have to include the cookbooks that my role cookbooks need in my environment Berksfile.

Make sense?

Chris


#9

Nope, you don’t have to install anything additional afaik, you can
simply use your Chef Server as an artifact source for Berkshelf.

This is probably what you are looking for:
http://berkshelf.com/v2.0/#chef-api-location

You can set that globally in your ~/.berkshelf/config.json to keep
your individual Berksfiles clean.

Cheers, Torben

On Wed, Apr 8, 2015 at 1:43 AM, Fouts, Chris Chris.Fouts@sensus.com wrote:

Yes I do have internal Chef 12 Enterprise server. So how can I set it up as a Berkshelf API server, by installing this in my Chef server https://github.com/berkshelf/berkshelf-api

Chris

-----Original Message-----
From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 7:17 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: RE: Re: How to setup Berkshelf to install ALL cookooks "recuresively’, with only role cookbooks in it?

Oh, right. I thought only your (2nd level) role cookbooks would be hosted internally. If you have internally hosted dependent cookbooks like “common-log” etc deep down in your dependency graph you must inlcude their inhouse git location in the top-level Berksfile. The nested Berksfiles are not evaluated.

Or, as Yoshi said, you can host your own inhouse Berkshelf API server.
And Chef Server is such a thing too. So if you have an internal Chef Server anyway, you could use that. If not, you could run https://github.com/berkshelf/berkshelf-api directly. Or just repeat the internal locations in your top-level Berksfile (ugly but easiest).

If anybody knows a server-less solution for that, I’d be interested too…

HTH, Torben

On Tue, Apr 7, 2015 at 10:27 PM, Fouts, Chris Chris.Fouts@sensus.com wrote:

I’ve already tried it, and I get error below. In this example, I have an arqiva_rni_dev environment cookbook, which depends on linux_role role cookbook, and itself depends on common-log cookbook. I have ALL the correct version in my Git repo.

Here’s my Berksfile

source “https://supermarket.chef.io

metadata

Community cookbooks

cookbook 'chef-client’
cookbook 'powershell’
cookbook ‘push-jobs’

Company cookbooks

cookbook ‘linux_role’, git: ‘git@git-server:arqchefcookbooks/linux_role.git’

My metadata.rb is

name ‘arqiva_rni_dev’
(snip)
depends ‘linux_role’, ‘1.0.2’

My linux_role/metadata.rb has

depends ‘common-log’, ‘~> 0.1.0’

$ berks install
Resolving cookbook dependencies…
Fetching ‘arqiva_rni_dev’ from source at .
Fetching ‘linux_role’ from
git@git-server:arqchefcookbooks/linux_role.git (at master) Fetching cookbook index from https://supermarket.chef.io
Unable to satisfy constraints on package common-log, which does not
exist, due to solution constraint (arqiva_rni_dev = 0.1.0). Solution
constraints that may result in a constraint on common-log:
[(arqiva_rni_dev = 0.1.0) -> (linux_role = 1.0.2) -> (common-log =
0.1.0)], [(linux_role = 1.0.2) -> (common-log = 0.1.0)] Missing
artifacts: common-log Demand that cannot be met: (arqiva_rni_dev =
0.1.0) Unable to find a solution for demands: arqiva_rni_dev (0.1.0),
chef-client (>= 0.0.0), linux_role (1.0.2), powershell (>= 0.0.0),
push-jobs (>= 0.0.0)

I can get rid of the error by including the common-log cookbook in my top-level Berksfile, but you’re saying I should NOT have to do this.

Chris

-----Original Message-----
From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 4:05 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: How to setup Berkshelf to install ALL cookooks "recuresively’, with only role cookbooks in it?

Yep, you should expect this to work. Everything else would be a big surprise to me at least…

Have you tried it already, or are you just elaborating how to set things up?

Cheers, Torben

On Tue, Apr 7, 2015 at 9:44 PM, Fouts, Chris Chris.Fouts@sensus.com wrote:

Note, these are NOT supermarket cookbooks, but rather our company
cookbooks on our own git server, which is not configured like a super market.

Knowing this, should I still expect this to work?

Chris

From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 3:13 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How to setup Berkshelf to install ALL cookooks
"recuresively’, with only role cookbooks in it?

Hey Chris,

Berkshelf should actually resolve the dependencies transitively.

In your top-level Berksfile you should only need the role cookbooks.
Once you run a ‘berks install’ there you should get a Berksfile.lock
which locks the whole dependency graph, including the transitive ones.

Do you observe something different?

HTH,
Torben

Am 07.04.2015 19:23 schrieb “Fouts, Chris” Chris.Fouts@sensus.com:

I want to setup an environment cookbook Berksfile with nothing but
role cookbooks in it, and the role cookbooks themselves will then
aggregate the specific cookbooks they need. For example

myApp/Berksfile

cookbook ‘app1_role’, git: ‘git@git-server.domain.com:group/app1_role.git’

cookbook ‘app2_role’, git: ‘git@git-server.domain.com:group/app2_role.git’

myApp/metadata.rb

depends ‘app1_role’, ‘~> 1.0.0’

depends ‘app2_role’, ‘~> 1.0.0’

app1_role/metadata.rb

depends ‘cookbook1’, ‘= 1.0.0’

depends ‘cookbook2, ‘= 1.0.0’

app2_role/metadata.rb

depends ‘cookbook3’, ‘= 1.0.0’

depends ‘cookbook4, ‘= 1.0.0’

How can I set this up so I ONLY have the role cookbooks, but not the
individual cookbooks they need, in my environment cookbook’s
Berksfile, and when I do a berks install, it will auto-magically
install the cookbooks that my role cookbooks need? Currently, I also
have to include the cookbooks that my role cookbooks need in my environment Berksfile.

Make sense?

Chris


#10

chef_api in Berkshelf is deprecated. See https://github.com/berkshelf/berkshelf/wiki/deprecated-locations

At this time I believe the Berkshelf API server or internal supermarket are required. We use Berkshelf API server and it works great.

On Apr 7, 2015, at 6:57 PM, Torben Knerr mail@tknerr.de wrote:

Nope, you don’t have to install anything additional afaik, you can
simply use your Chef Server as an artifact source for Berkshelf.

This is probably what you are looking for:
http://berkshelf.com/v2.0/#chef-api-location

You can set that globally in your ~/.berkshelf/config.json to keep
your individual Berksfiles clean.

Cheers, Torben

On Wed, Apr 8, 2015 at 1:43 AM, Fouts, Chris Chris.Fouts@sensus.com wrote:
Yes I do have internal Chef 12 Enterprise server. So how can I set it up as a Berkshelf API server, by installing this in my Chef server https://github.com/berkshelf/berkshelf-api

Chris

-----Original Message-----
From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 7:17 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: RE: Re: How to setup Berkshelf to install ALL cookooks "recuresively’, with only role cookbooks in it?

Oh, right. I thought only your (2nd level) role cookbooks would be hosted internally. If you have internally hosted dependent cookbooks like “common-log” etc deep down in your dependency graph you must inlcude their inhouse git location in the top-level Berksfile. The nested Berksfiles are not evaluated.

Or, as Yoshi said, you can host your own inhouse Berkshelf API server.
And Chef Server is such a thing too. So if you have an internal Chef Server anyway, you could use that. If not, you could run https://github.com/berkshelf/berkshelf-api directly. Or just repeat the internal locations in your top-level Berksfile (ugly but easiest).

If anybody knows a server-less solution for that, I’d be interested too…

HTH, Torben

On Tue, Apr 7, 2015 at 10:27 PM, Fouts, Chris Chris.Fouts@sensus.com wrote:
I’ve already tried it, and I get error below. In this example, I have an arqiva_rni_dev environment cookbook, which depends on linux_role role cookbook, and itself depends on common-log cookbook. I have ALL the correct version in my Git repo.

Here’s my Berksfile

source “https://supermarket.chef.io

metadata

Community cookbooks

cookbook 'chef-client’
cookbook 'powershell’
cookbook ‘push-jobs’

Company cookbooks

cookbook ‘linux_role’, git: ‘git@git-server:arqchefcookbooks/linux_role.git’

My metadata.rb is

name ‘arqiva_rni_dev’
(snip)
depends ‘linux_role’, ‘1.0.2’

My linux_role/metadata.rb has

depends ‘common-log’, ‘~> 0.1.0’

$ berks install
Resolving cookbook dependencies…
Fetching ‘arqiva_rni_dev’ from source at .
Fetching ‘linux_role’ from
git@git-server:arqchefcookbooks/linux_role.git (at master) Fetching cookbook index from https://supermarket.chef.io
Unable to satisfy constraints on package common-log, which does not
exist, due to solution constraint (arqiva_rni_dev = 0.1.0). Solution
constraints that may result in a constraint on common-log:
[(arqiva_rni_dev = 0.1.0) -> (linux_role = 1.0.2) -> (common-log =
0.1.0)], [(linux_role = 1.0.2) -> (common-log = 0.1.0)] Missing
artifacts: common-log Demand that cannot be met: (arqiva_rni_dev =
0.1.0) Unable to find a solution for demands: arqiva_rni_dev (0.1.0),
chef-client (>= 0.0.0), linux_role (1.0.2), powershell (>= 0.0.0),
push-jobs (>= 0.0.0)

I can get rid of the error by including the common-log cookbook in my top-level Berksfile, but you’re saying I should NOT have to do this.

Chris

-----Original Message-----
From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 4:05 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: How to setup Berkshelf to install ALL cookooks "recuresively’, with only role cookbooks in it?

Yep, you should expect this to work. Everything else would be a big surprise to me at least…

Have you tried it already, or are you just elaborating how to set things up?

Cheers, Torben

On Tue, Apr 7, 2015 at 9:44 PM, Fouts, Chris Chris.Fouts@sensus.com wrote:
Note, these are NOT supermarket cookbooks, but rather our company
cookbooks on our own git server, which is not configured like a super market.

Knowing this, should I still expect this to work?

Chris

From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 3:13 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How to setup Berkshelf to install ALL cookooks
"recuresively’, with only role cookbooks in it?

Hey Chris,

Berkshelf should actually resolve the dependencies transitively.

In your top-level Berksfile you should only need the role cookbooks.
Once you run a ‘berks install’ there you should get a Berksfile.lock
which locks the whole dependency graph, including the transitive ones.

Do you observe something different?

HTH,
Torben

Am 07.04.2015 19:23 schrieb “Fouts, Chris” Chris.Fouts@sensus.com:

I want to setup an environment cookbook Berksfile with nothing but
role cookbooks in it, and the role cookbooks themselves will then
aggregate the specific cookbooks they need. For example

myApp/Berksfile

cookbook ‘app1_role’, git: ‘git@git-server.domain.com:group/app1_role.git’

cookbook ‘app2_role’, git: ‘git@git-server.domain.com:group/app2_role.git’

myApp/metadata.rb

depends ‘app1_role’, ‘~> 1.0.0’

depends ‘app2_role’, ‘~> 1.0.0’

app1_role/metadata.rb

depends ‘cookbook1’, ‘= 1.0.0’

depends ‘cookbook2, ‘= 1.0.0’

app2_role/metadata.rb

depends ‘cookbook3’, ‘= 1.0.0’

depends ‘cookbook4, ‘= 1.0.0’

How can I set this up so I ONLY have the role cookbooks, but not the
individual cookbooks they need, in my environment cookbook’s
Berksfile, and when I do a berks install, it will auto-magically
install the cookbooks that my role cookbooks need? Currently, I also
have to include the cookbooks that my role cookbooks need in my environment Berksfile.

Make sense?

Chris


#11

Oooops. I somehow entered the v2.0 Berkshelf docs without noticing…

Sorry for the disinformation :-/
Am 08.04.2015 02:11 schrieb “Drew Blessing” Drew.Blessing@buckle.com:

chef_api in Berkshelf is deprecated. See
https://github.com/berkshelf/berkshelf/wiki/deprecated-locations

At this time I believe the Berkshelf API server or internal supermarket
are required. We use Berkshelf API server and it works great.

On Apr 7, 2015, at 6:57 PM, Torben Knerr mail@tknerr.de wrote:

Nope, you don’t have to install anything additional afaik, you can
simply use your Chef Server as an artifact source for Berkshelf.

This is probably what you are looking for:
http://berkshelf.com/v2.0/#chef-api-location

You can set that globally in your ~/.berkshelf/config.json to keep
your individual Berksfiles clean.

Cheers, Torben

On Wed, Apr 8, 2015 at 1:43 AM, Fouts, Chris Chris.Fouts@sensus.com
wrote:

Yes I do have internal Chef 12 Enterprise server. So how can I set it
up as a Berkshelf API server, by installing this in my Chef server
https://github.com/berkshelf/berkshelf-api

Chris

-----Original Message-----
From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 7:17 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: RE: Re: How to setup Berkshelf to install
ALL cookooks "recuresively’, with only role cookbooks in it?

Oh, right. I thought only your (2nd level) role cookbooks would be
hosted internally. If you have internally hosted dependent cookbooks like
"common-log" etc deep down in your dependency graph you must inlcude their
inhouse git location in the top-level Berksfile. The nested Berksfiles are
not evaluated.

Or, as Yoshi said, you can host your own inhouse Berkshelf API server.
And Chef Server is such a thing too. So if you have an internal Chef
Server anyway, you could use that. If not, you could run
https://github.com/berkshelf/berkshelf-api directly. Or just repeat the
internal locations in your top-level Berksfile (ugly but easiest).

If anybody knows a server-less solution for that, I’d be interested
too…

HTH, Torben

On Tue, Apr 7, 2015 at 10:27 PM, Fouts, Chris Chris.Fouts@sensus.com
wrote:

I’ve already tried it, and I get error below. In this example, I have
an arqiva_rni_dev environment cookbook, which depends on linux_role role
cookbook, and itself depends on common-log cookbook. I have ALL the correct
version in my Git repo.

Here’s my Berksfile

source “https://supermarket.chef.io

metadata

Community cookbooks

cookbook 'chef-client’
cookbook 'powershell’
cookbook ‘push-jobs’

Company cookbooks

cookbook ‘linux_role’, git: ‘git@git-server
:arqchefcookbooks/linux_role.git’

My metadata.rb is

name ‘arqiva_rni_dev’
(snip)
depends ‘linux_role’, ‘1.0.2’

My linux_role/metadata.rb has

depends ‘common-log’, ‘~> 0.1.0’

$ berks install
Resolving cookbook dependencies…
Fetching ‘arqiva_rni_dev’ from source at .
Fetching ‘linux_role’ from
git@git-server:arqchefcookbooks/linux_role.git (at master) Fetching
cookbook index from https://supermarket.chef.io

Unable to satisfy constraints on package common-log, which does not
exist, due to solution constraint (arqiva_rni_dev = 0.1.0). Solution
constraints that may result in a constraint on common-log:
[(arqiva_rni_dev = 0.1.0) -> (linux_role = 1.0.2) -> (common-log =
0.1.0)], [(linux_role = 1.0.2) -> (common-log = 0.1.0)] Missing
artifacts: common-log Demand that cannot be met: (arqiva_rni_dev =
0.1.0) Unable to find a solution for demands: arqiva_rni_dev (0.1.0),
chef-client (>= 0.0.0), linux_role (1.0.2), powershell (>= 0.0.0),
push-jobs (>= 0.0.0)

I can get rid of the error by including the common-log cookbook in my
top-level Berksfile, but you’re saying I should NOT have to do this.

Chris

-----Original Message-----
From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 4:05 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: How to setup Berkshelf to install ALL
cookooks "recuresively’, with only role cookbooks in it?

Yep, you should expect this to work. Everything else would be a big
surprise to me at least…

Have you tried it already, or are you just elaborating how to set
things up?

Cheers, Torben

On Tue, Apr 7, 2015 at 9:44 PM, Fouts, Chris Chris.Fouts@sensus.com
wrote:

Note, these are NOT supermarket cookbooks, but rather our company
cookbooks on our own git server, which is not configured like a super
market.

Knowing this, should I still expect this to work?

Chris

From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 3:13 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How to setup Berkshelf to install ALL cookooks
"recuresively’, with only role cookbooks in it?

Hey Chris,

Berkshelf should actually resolve the dependencies transitively.

In your top-level Berksfile you should only need the role cookbooks.
Once you run a ‘berks install’ there you should get a Berksfile.lock
which locks the whole dependency graph, including the transitive ones.

Do you observe something different?

HTH,
Torben

Am 07.04.2015 19:23 schrieb “Fouts, Chris” Chris.Fouts@sensus.com:

I want to setup an environment cookbook Berksfile with nothing but
role cookbooks in it, and the role cookbooks themselves will then
aggregate the specific cookbooks they need. For example

myApp/Berksfile

cookbook ‘app1_role’, git: ‘git@git-server.domain.com:
group/app1_role.git’

cookbook ‘app2_role’, git: ‘git@git-server.domain.com:
group/app2_role.git’

myApp/metadata.rb

depends ‘app1_role’, ‘~> 1.0.0’

depends ‘app2_role’, ‘~> 1.0.0’

app1_role/metadata.rb

depends ‘cookbook1’, ‘= 1.0.0’

depends ‘cookbook2, ‘= 1.0.0’

app2_role/metadata.rb

depends ‘cookbook3’, ‘= 1.0.0’

depends ‘cookbook4, ‘= 1.0.0’

How can I set this up so I ONLY have the role cookbooks, but not the
individual cookbooks they need, in my environment cookbook’s
Berksfile, and when I do a berks install, it will auto-magically
install the cookbooks that my role cookbooks need? Currently, I also
have to include the cookbooks that my role cookbooks need in my
environment Berksfile.

Make sense?

Chris