Chef in a nutshell

16
Chef In a Nutshell

description

 

Transcript of Chef in a nutshell

Page 1: Chef in a nutshell

ChefIn a Nutshell

Page 2: Chef in a nutshell

Chef?

● Thick Clients, Thin Server● Order Matters● Ruby● Chef Solo● OHAI ● Knife

Page 3: Chef in a nutshell

Chef Server Architecture

Page 4: Chef in a nutshell

Chef Components

● Chef Client○ Public/Private key○ Machines/Humans

● Chef Node ● Chef Indexer

○ RabbitMQ○ Chef Expander/SOLR

● Chef Server○ CouchDB○ Web Interface○ REST API

● Chef Solo○ Vagrant - development and tests

Page 5: Chef in a nutshell

Cooking with Chef

● Nodes○ Roles○ Cookbooks○ Recipes ○ Resources

● Environment● Data bags (JSON)

Page 6: Chef in a nutshell

Anatomy of a Chef Run

Page 7: Chef in a nutshell

Anatomy of a Chef Run

● Build, Register, and Authenticate the Node○ OHAI○ chef-validator○ client.pem

● Synchronize Cookbooks○ Libraries○ Attributes○ Definitions○ Recipes

Page 8: Chef in a nutshell

Anatomy of a Chef Run

● Compile Resource Collection○ Load Libraries○ Load Attributes○ Load Definitions○ Load Recipes

● Configure Node○ Converge○ Save Node○ Run Notifications

Page 9: Chef in a nutshell

OHAI

● Gem● Windows● Standalone● Ruby library● Plugins

Page 10: Chef in a nutshell

Chef Basics

● Node○ Run List

■ Recipe■ Role (Ruby/JSON)

○ Attributes○ Tags

● Data Bags○ JSON○ Search○ Encrypte

● Search

Page 11: Chef in a nutshell

Chef Basics● Cookbooks

○ Recipe○ Resources

■ Deploy■ AWS■ Dynect■ Gem, PyPi e PEAR

○ Metadata○ Providers

■ LWRP○ Search○ Exception and Report Handler

Page 12: Chef in a nutshell

Cookbooks

● Version● Library

○ Ruby code● Metadata

○ name○ version○ depends/conflicts/replaces○ supports

● Templates○ ERB

Page 13: Chef in a nutshell

Cookbooks

● Attributes○ override○ normal○ default

● Definitions● File Distribution● Recipes

○ include○ search○ data bags○ tag

Page 14: Chef in a nutshell

Managing Chef

● Knife○ Bootstrap○ Exec

■ SSH ○ Plugin

■ Windows■ knife-windows ■ Windows Remote Management■ PowerShell

■ EC2/Rackspace/Slicehost/Terremark● Shef

○ irb

Page 15: Chef in a nutshell

Workflow● Environments● Freeze● Metadata version

Development1. Bump the version number as appropriate2. Hack3. Upload and test4. Repeat 2 and 3 as necessary

Production1. Upload and freeze your cookbooks2. Modify your environment to prefer the new version you uploaded3. Upload the updated environment4. Deploy

Page 16: Chef in a nutshell

Links

Opscode Platform "The first five nodes are free!"

Opscode Wiki A Brief Chef Tutorial

Example Cookbooks:

http://github.com/opscode/cookbooks

http://github.com/37signals/37s_cookbooks

http://github.com/engineyard/ey-cloud-recipes