{"id":4899,"date":"2018-04-17T09:36:21","date_gmt":"2018-04-17T09:36:21","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=4899"},"modified":"2021-02-27T10:12:52","modified_gmt":"2021-02-27T10:12:52","slug":"berkshelf-in-chef-explained","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/","title":{"rendered":"Berkshelf in Chef explained?"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5120\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/04\/chef-2.png\" alt=\"\" width=\"600\" height=\"315\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/04\/chef-2.png 600w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/04\/chef-2-300x158.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Configuration Management using chef is being implemented with the help of desire files, which is often called a &#8220;cookbooks&#8221; in chef. Usuallay separate cookbooks is written in practice for each module so its easy to maintain. Also, there are good numbers of cookbooks which is being used from community portal which is from supermarket.chef.io.<\/p>\n<p>In order to meet the desire state in servers, once the multile cookbooks is used, Very often these cookbooks become large and highly interdependent, it becomes necessary to manage these cookbooks itself.<\/p>\n<p>Berkshelf is the tool which makes \u2018the management\u2019 &amp; dependency management between cookbooks easy. Berkshelf is a dependency manager for Chef cookbooks. With it, you can easily depend on community cookbooks and have them safely included in your workflow. Using Berkshelf, you need to package, bundle dependent cookbooks rather using it will download from &#8220;source&#8221; which is defined in Berksfile.<\/p>\n<p>Berkshelf is included in the Chef Development Kit.<\/p>\n<p><strong>Quick Start<\/strong><br \/>\nRunning &#8220;<strong>chef generate cookbook<\/strong>&#8221; will, by default, create a Berksfile in the root of the cookbook, alongside the cookbook\u2019s metadata.rb. As usual, add your cookbook\u2019s dependencies to the metadata:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">name 'my_first_cookbook'\r\nversion '0.1.0'\r\ndepends 'apt', '~&gt; 5.0'<\/pre>\n<p>The default Berksfile will contain the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">source 'https:\/\/supermarket.chef.io'\r\nmetadata<\/pre>\n<p>Now, when you run &#8220;<strong>berks install<\/strong>&#8220;, the apt cookbook will be downloaded from Supermarket into the cache&#8230;<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ berks install\r\nResolving cookbook dependencies...\r\nFetching 'my_first_cookbook' from source at .\r\nFetching cookbook index from https:\/\/supermarket.chef.io...\r\nInstalling apt (5.0.0)\r\nUsing my_first_cookbook (0.1.0) from source at .\r\nInstalling compat_resource (12.16.2)<\/pre>\n<p><strong>Example of Berksfile<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">source &quot;https:\/\/supermarket.chef.io&quot;\r\n\r\nmetadata\r\ncookbook 'zabbix-agent', path: 'cookbooks\/zabbix-agent'\r\ncookbook 'hostnames', path: 'cookbooks\/hostnames'\r\ncookbook 'chef-client', path: 'cookbooks\/chef-client'\r\ncookbook 'rethinkdb', path: 'cookbooks\/rethinkdb'\r\ncookbook 'zookeeper', path: 'cookbooks\/zookeeper'\r\ncookbook 'logstash', path: 'cookbooks\/logstash'\r\ncookbook 'kafka', path: 'cookbooks\/kafka'\r\ncookbook 'elasticsearch', path: 'cookbooks\/elasticsearch'\r\ncookbook 'testbook', path: 'cookbooks\/testbook'\r\ncookbook 'base-ubuntu', path: 'cookbooks\/base-ubuntu'<\/pre>\n<p><strong>Important Notes<\/strong><br \/>\nFor new users, we strongly recommend using Policyfiles rather than Berkshelf. Policyfiles provide more predictability, since dependencies are only resolved once, and a much improved way of promoting cookbooks from dev to testing, and then to production. Note that Policyfile is not supported as part of a Chef Automate workflow.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Configuration Management using chef is being implemented with the help of desire files, which is often called a &#8220;cookbooks&#8221; in [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":5120,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[88],"tags":[4896,4895],"class_list":["post-4899","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chef","tag-berksfile","tag-berkshelf"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Berkshelf in Chef explained? - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Berkshelf in Chef explained? - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"Configuration Management using chef is being implemented with the help of desire files, which is often called a &#8220;cookbooks&#8221; in [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-17T09:36:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-27T10:12:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/04\/chef-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"315\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"scmgalaxy K\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"scmgalaxy K\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/\"},\"author\":{\"name\":\"scmgalaxy K\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\"},\"headline\":\"Berkshelf in Chef explained?\",\"datePublished\":\"2018-04-17T09:36:21+00:00\",\"dateModified\":\"2021-02-27T10:12:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/\"},\"wordCount\":385,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/chef-2.png\",\"keywords\":[\"Berksfile\",\"Berkshelf\"],\"articleSection\":[\"Chef\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/\",\"name\":\"Berkshelf in Chef explained? - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/chef-2.png\",\"datePublished\":\"2018-04-17T09:36:21+00:00\",\"dateModified\":\"2021-02-27T10:12:52+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/chef-2.png\",\"contentUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/chef-2.png\",\"width\":600,\"height\":315},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/berkshelf-in-chef-explained\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Berkshelf in Chef explained?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\",\"name\":\"scmgalaxy K\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"caption\":\"scmgalaxy K\"},\"sameAs\":[\"http:\\\/\\\/www.DevOpsSchool.com\"],\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/scmgalaxy\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Berkshelf in Chef explained? - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/","og_locale":"en_US","og_type":"article","og_title":"Berkshelf in Chef explained? - scmGalaxy","og_description":"Configuration Management using chef is being implemented with the help of desire files, which is often called a &#8220;cookbooks&#8221; in [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/","og_site_name":"scmGalaxy","article_published_time":"2018-04-17T09:36:21+00:00","article_modified_time":"2021-02-27T10:12:52+00:00","og_image":[{"width":600,"height":315,"url":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/04\/chef-2.png","type":"image\/png"}],"author":"scmgalaxy K","twitter_card":"summary_large_image","twitter_misc":{"Written by":"scmgalaxy K","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/"},"author":{"name":"scmgalaxy K","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102"},"headline":"Berkshelf in Chef explained?","datePublished":"2018-04-17T09:36:21+00:00","dateModified":"2021-02-27T10:12:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/"},"wordCount":385,"commentCount":0,"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/#primaryimage"},"thumbnailUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/04\/chef-2.png","keywords":["Berksfile","Berkshelf"],"articleSection":["Chef"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/","name":"Berkshelf in Chef explained? - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/#primaryimage"},"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/#primaryimage"},"thumbnailUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/04\/chef-2.png","datePublished":"2018-04-17T09:36:21+00:00","dateModified":"2021-02-27T10:12:52+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/#primaryimage","url":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/04\/chef-2.png","contentUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/04\/chef-2.png","width":600,"height":315},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/berkshelf-in-chef-explained\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Berkshelf in Chef explained?"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102","name":"scmgalaxy K","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","caption":"scmgalaxy K"},"sameAs":["http:\/\/www.DevOpsSchool.com"],"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/scmgalaxy\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/4899","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=4899"}],"version-history":[{"count":2,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/4899\/revisions"}],"predecessor-version":[{"id":5121,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/4899\/revisions\/5121"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media\/5120"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=4899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=4899"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=4899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}