1.

Explain Berkshelf workflow in Chef.

Answer»

Berkshelf is the dependency manager that comes with the Chef Development Kit. Whenever you CREATE a cookbook say for eg with “chef generate cookbook” command a file called Berksfile is CREATED on top of the cookbook directory. This file contains the source path for all cookbooks. Assume that you created a NEW cookbook called “my-app” which depends on another community cookbook “nginx” from public Chef Supermarket. The typical steps we follow are:

  • The details about the dependent cookbooks are updated in the “metadata.rb” file.
  • The default recipe in the “my-app” cookbook is having an entry for including recipes from the community cookbook using “include_recipe” directive 
  • Run “berks install “command to install all the dependent cookbooks in ~/.berkshelf/cookbooks default path. Another file called Berksfile.lock is created that has the exact version of all cookbooks installed by Berkshelf. This avoids unwanted mixing up of different versions of dependent cookbooks while sharing the “my-app” cookbook.
  • The “my-app” cookbook along with its dependency cookbooks are uploaded into Chef Server using “berks UPLOAD” command
  • Chef-client applies the relevant cookbooks on different Chef Nodes.


Discussion

No Comment Found