Friday, January 29, 2016

DevOps tools: The beginner's guide to Chef

Configuration management 101


In the DevOps model, developers and system operators work closely together throughout the software development process to deploy software more frequently and more reliably. Many new third party and proprietary tools have been developed to support automation, measurement and sharing.

Chef: "IT automation for speed and awesomeness"

Chef is a configuration management tool for dealing with machine setup on physical servers, virtual machines and in the cloud. Many companies use Chef software to control and manage their infrastructure including Facebook, Etsy, Cheezburger, and Indiegogo.

But what does that really mean?

Configuration management is all about trying to ensure that the files and software you are expecting to be on a machine are present, configured correctly, and working as intended.
When you have only a single machine this is fairly simple. When you have five or ten servers, it is still possible to do this manually, but it may take all day. However, when your infrastructure scales up into the thousands we need a better way of doing things.

Infrastructure as code

Chef helps solve this problem by treating infrastructure as code. Rather than manually changing anything, the machine setup is described in a Chef recipe.
Collections of recipes are stored in a cookbook. One cookbook should relate to a single task, but can have a number of different server configurations involved (for example a web application with a database, will have two recipes, one for each part, stored together in a cookbook).
There is a Chef server which stores each of these cookbooks and as a new chef client node checks in with the server, recipes are sent to tell the node how to configure itself.
The client will then check in every now and again to make sure that no changes have occurred, and nothing needs to change. If it does, then the client deals with it. Patches and updates can be rolled out over your entire infrastructure by changing the recipe. No need to interact with each machine individually.

Chef configuration

Chef Configuration from https://www.chef.io/solutions/cloud-management/
Figure 1- Chef configuration from https://www.chef.io/solutions/cloud-management/
Recipes and cookbooks are the heart of the configuration management. They are written using the Ruby programming language, however, the domain specific language used by Chef is designed to be able to be understood by everyone. As the configuration is just code it can be tested and it can be version controlled. This means that there is less downtime, more reliable services and less stressed people on both the dev and ops sides.



Chef config files to install Apache
Chef Hello World screenshot
Figure 2: Chef config files to install Apache and add a hello world html page

So why is it awesome?

You want more? How about Chef Analytics - the ability to visualise everything going on in real time. It will check if something is going wrong and notify you before the problem becomes noticeable to your clients.
The Chef development kit allows you to write and manage your chef infrastructure from any machine and any operating system.
Chef's Knife allows you to manage the interface between your Chef bookshelf (the repository) and your chef server. The high availability and replication feature allows you to ensure that even if something goes wrong, the chef server is able to adapt and recreate your infrastructure as required, without outside help

2 comments:

  1. Thank you very much for this. I hope this will be useful for many people. Please keep on updating these type of blogs with good content. Thank You...For more information visit :devops online training

    ReplyDelete