Using Berkshelf


#1

Hi,

I have just started reading about Berkshelf. The first thing which comes
to mind, is the fact that cookbooks are not like ruby gems: because it’s nice
to customize cookbooks. Usually the ruby gems can be used as-is.

So, let’s say you write a wrapper customized nginx cookbook, and pull in a
community nginx cookbook from Berkshelf. What causes them to mesh/overlap?
Does the “depends” statement, or the “include_recipe” statement cause all
aspects of the community cookbook to be exposed and available to the customized
cookbook? i.e. not just the recipes, but all the templates, files,
definitions, etc are imported to the new cookbook? which command does that?

Secondly, let’s say you want to customize only a small aspect. Modify only a
single template. modify a single attribute. modify a small part of a recipe.
How does these things integrate ? How does the community cookbook and your
new customized cookbook come together, into a brand new super cookbook?


#2

Sam,

I’d recommend watching Jamie’s presentation: http://www.youtube.com/watch?v=hYt0E84kYUI

Thanks,
Seth

On Mar 19, 2014, at 2:52 PM, Sam Darwin samuel.d.darwin@gmail.com wrote:

Hi,

I have just started reading about Berkshelf. The first thing which comes
to mind, is the fact that cookbooks are not like ruby gems: because it’s nice
to customize cookbooks. Usually the ruby gems can be used as-is.

So, let’s say you write a wrapper customized nginx cookbook, and pull in a
community nginx cookbook from Berkshelf. What causes them to mesh/overlap?
Does the “depends” statement, or the “include_recipe” statement cause all
aspects of the community cookbook to be exposed and available to the customized
cookbook? i.e. not just the recipes, but all the templates, files,
definitions, etc are imported to the new cookbook? which command does that?

Secondly, let’s say you want to customize only a small aspect. Modify only a
single template. modify a single attribute. modify a small part of a recipe.
How does these things integrate ? How does the community cookbook and your
new customized cookbook come together, into a brand new super cookbook?


#3

Additionally, I learned a cool trick recently.

You can “override” the source cookbook and file of a template. Example:
include_recipe 'varnish’
begin
r = resources(:template => node[‘varnish’][‘default’])
r.source "custom-default.erb"
r.cookbook "mosaic"
rescue Chef::Exceptions::ResourceNotFound
Chef::Log.warn "could not find VARNISH template to override!"
End

Where mosaic is our custom cookbook for our product and custom-default.erb is our custom default we want the Varnish Community Cookbook to use. It was fantastic for changing a small element of the cookbook without having to fork it entirely :slight_smile:

Calvin

From: Seth Vargo <sethvargo@getchef.commailto:sethvargo@getchef.com>
Reply-To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Date: Wednesday, March 19, 2014 12:04 PM
To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Subject: [chef] Re: using Berkshelf

Sam,

I’d recommend watching Jamie’s presentation: http://www.youtube.com/watch?v=hYt0E84kYUI

Thanks,
Seth

On Mar 19, 2014, at 2:52 PM, Sam Darwin <samuel.d.darwin@gmail.commailto:samuel.d.darwin@gmail.com> wrote:

Hi,

I have just started reading about Berkshelf. The first thing which comes
to mind, is the fact that cookbooks are not like ruby gems: because it’s nice
to customize cookbooks. Usually the ruby gems can be used as-is.

So, let’s say you write a wrapper customized nginx cookbook, and pull in a
community nginx cookbook from Berkshelf. What causes them to mesh/overlap?
Does the “depends” statement, or the “include_recipe” statement cause all
aspects of the community cookbook to be exposed and available to the customized
cookbook? i.e. not just the recipes, but all the templates, files,
definitions, etc are imported to the new cookbook? which command does that?

Secondly, let’s say you want to customize only a small aspect.Modify only a
single template. modify a single attribute. modify a small part of a recipe.
How does these things integrate ? How does the community cookbook and your
new customized cookbook come together, into a brand new super cookbook?

This email and any attachments may contain confidential and proprietary information of Blackboard that is for the sole use of the intended recipient. If you are not the intended recipient, disclosure, copying, re-distribution or other use of any of this information is strictly prohibited. Please immediately notify the sender and delete this transmission if you received this email in error.


#4

waouwww awesome :slight_smile: I’ll try it asaic

Cyril SCETBON

On 19 Mar 2014, at 20:12, Calvin Worsnup Calvin.Worsnup@blackboard.com wrote:

Additionally, I learned a cool trick recently.

You can “override” the source cookbook and file of a template. Example:
include_recipe 'varnish’
begin
r = resources(:template => node[‘varnish’][‘default’])
r.source "custom-default.erb"
r.cookbook "mosaic"
rescue Chef::Exceptions::ResourceNotFound
Chef::Log.warn "could not find VARNISH template to override!"
End

Where mosaic is our custom cookbook for our product and custom-default.erb is our custom default we want the Varnish Community Cookbook to use. It was fantastic for changing a small element of the cookbook without having to fork it entirely :slight_smile:

Calvin

From: Seth Vargo sethvargo@getchef.com
Reply-To: "chef@lists.opscode.com" chef@lists.opscode.com
Date: Wednesday, March 19, 2014 12:04 PM
To: "chef@lists.opscode.com" chef@lists.opscode.com
Subject: [chef] Re: using Berkshelf

Sam,

I’d recommend watching Jamie’s presentation: http://www.youtube.com/watch?v=hYt0E84kYUI

Thanks,
Seth

On Mar 19, 2014, at 2:52 PM, Sam Darwin samuel.d.darwin@gmail.com wrote:

Hi,

I have just started reading about Berkshelf. The first thing which comes
to mind, is the fact that cookbooks are not like ruby gems: because it’s nice
to customize cookbooks. Usually the ruby gems can be used as-is.

So, let’s say you write a wrapper customized nginx cookbook, and pull in a
community nginx cookbook from Berkshelf. What causes them to mesh/overlap?
Does the “depends” statement, or the “include_recipe” statement cause all
aspects of the community cookbook to be exposed and available to the customized
cookbook? i.e. not just the recipes, but all the templates, files,
definitions, etc are imported to the new cookbook? which command does that?

Secondly, let’s say you want to customize only a small aspect.Modify only a
single template. modify a single attribute. modify a small part of a recipe.
How does these things integrate ? How does the community cookbook and your
new customized cookbook come together, into a brand new super cookbook?

This email and any attachments may contain confidential and proprietary information of Blackboard that is for the sole use of the intended recipient. If you are not the intended recipient, disclosure, copying, re-distribution or other use of any of this information is strictly prohibited. Please immediately notify the sender and delete this transmission if you received this email in error.