zoukankan      html  css  js  c++  java
  • Managing Chef Cookbooks the Berkshelf way

    转载:http://cloudacademy.com/blog/berkshelf-manage-chef-cookbooks/

    Managing Chef Cookbooks the Berkshelf way


    Chef cookbooks can become hard to handle; let’s talk about Berkshelf management tool

    Chef is a configuration management tool written in Ruby. With Chef, you can build servers quickly and reliably using cookbooks (which are basically recipes, that can perform tasks like installing webservers, updating SSL’s, or configuring HA proxy servers). Cookbooks themselves can be managed through a tool called Berkshelf. If you noticed our title on your way in, you’ll know that Berkshelf is going to be the subject of this post.

    Until now, you might have been managing your servers with growing numbers of scripts, perhaps spread across multiple directories or even multiple machines. As the need to deliver products to market quickly and the sheer numbers of servers we’ll use to do that continue to grow, we need a consistent, reliable, and secure way to manage it all. More importantly: the solution we choose should be simple and intuitive.

    More often than not, Chef will fit those needs. It is an infrastructure automation framework that simplifies server and application deployments to any physical, virtual, or cloud location, no matter the size of the infrastructure.

    Since your infrastructure will be managed with code, it can be automated, tested, and reproduced with ease. Chef itself is built from many moving parts, including knife, Chef client, Chef server, cookbooks, and nodes. Here, we will talk about cookbooks and how they can be efficiently managed using Berkshelf.

    Just what is Berkshelf?

    You often won’t need to actually write your cookbooks from scratch, as the community has all kinds of them – often ready to use in your environment without modification – available from the Opscode supermarket. To use a cookbook, you’ll need to download it and save it on your Chef workstation. To download each external cookbook from inside Global cookbook, this is what you would have to run:

    Before Berkshelf

    Chef Repo: before Berkshelf

    As terrific as Chef is, Berkshelf can really make a difference in the way you manage your Chef cookbooks and dependencies. Berkshelf lets you treat your cookbooks the way you treat gems in a Ruby project. When external cookbooks are used, Berkshelf doesn’t require “knife cookbook site” to install community cookbooks. All we have to do is mention the dependent cookbooks with its version number. When Chef client runs on nodes, berkshelf will automatically download and install all the dependent cookbooks from the Opscode cookbook community for us.

    After Berkshelf

    Chef repo: after Berkshelf

    Implementing Berkshelf

    Berkshelf requires a bit of set up. The easy way to install Berkshelf is:

    But that’s it. Berkshelf is now included as part of the Chef Development Kit (ChefDK), which installs the best development tools built by the awesome Chef community into your workstation. The omnibus installer is used to set up the Chef development kit on a workstation. Here’s how:

    • Visit http://downloads.chef.io/chef-dk and select the omnibus installer for the desired platform.
    • The Chef development kit supports Mac OS X, Red Hat Enterprise Linux, Ubuntu, and Microsoft Windows.
    • When the installation finishes, open a command line terminal and enter the following:
    • Ensure that the Chef-DK is added to the front of your path.
    • Initilize a Berksfile into your cookbook.
    • Specify your dependencies in a Berksfile in your cookbook’s root.
    • Once the dependencies are mentioned in a berksfile, you can install them.

    Berkshelf stores every version of a cookbook that you have ever installed in ~/.berkshelf.

    • Once your cookbook is ready, you can upload it with all the dependent cookbooks using the following command.

    Bon appetit!

  • 相关阅读:
    转:5个AJAX Loading动画图标生成器
    小练习:图片轮播jQuery版
    找不同,在一定范围内找出不同数最小的数组。
    一个Hibernate的Hello World, 基于Hibernate 4.0
    队列的操作, 计算要出队某个数需要移动的距离.
    使用反射操作私有(Private)方法和属性
    求由色子组成的立方体的5个可见面(底部不算)中所有数字最小之和.
    动态代理的简单实例.
    设计模式:Java的代理模式.
    Java的反射 基础+简单复制对象实例
  • 原文地址:https://www.cnblogs.com/iamdevops/p/5636432.html
Copyright © 2011-2022 走看看