A look at the Chef ecosystem and what's required to get started using chef to setup repeatable server environments and maintain stability across multiple environments
or change the setup • If you have to document it, make it an executable one • Faster to setup additional servers • Share knowledge (or at least make it portable)
• define snippets of configuration as cookbooks • chef-client pulls down what changes to make and runs them • chef-server is a merb rest web app backed by solr, couchdb
determines how to install/configure something • Node - each server you are configuring is a node • Role - A collection of cookbooks to run, may override attributes • environment - Similar to Role, though every node belongs to one environment.
via the api • Each component is uploaded through knife • knife cookbook upload <name> [--freeze] • knife environment|role from file <path> • create cookbooks, integrate with cloud services • some rake tasks to simplify uploading everything
to authenticate clients • knife has a bootstrap script which over ssh does: • install chef client, copies the validation.pem across • validates a new client key with validation.pem • triggers the first chef-client run • bootstrap <ipaddress> -x user -E ‘staging’ -r ‘role [ruby_app]’ --sudo
default • set via: cookbooks, environments, roles, nodes default attributes applied in an attributes file default attributes applied in an environment default attributes applied in a role default attributes applied on a node directly in a recipe normal or set attributes applied in an attributes file normal or set attributes applied on a node directly in a recipe override attributes applied in an attributes file override attributes applied in a role override attributes applied in an environment override attributes applied on a node directly in a recipe automatic attributes generated by Ohai
a file from an ERB template • directory, user, service • can notify other resources (restart when config file changed) • create custom ones via resources/providers
require a cookbook (cookbooks are the only dynamic code) • knife cookbook create <name> • Specify dependencies and version number in metadata.rb • recipes/default.rb is the bare minimum you need • most simple cookbooks will just need recipes, attributes, and maybe files/templates