This is for the talk I gave at DevOps DC on 1/8/13. It discusses how to migrate a change from development, staging, and finally production with cookbook versioning and rollbacks.
chef+ environmentssafer infrastructure
View Slide
tfgsethvargo
what’s an environment?
{"name" : "production","description" : "Production cluster in EC2","override_attributes" : { ... },"default_attributes" : { ... }}
target specificenvironments
$ knife search node "chef_environment:production"
$ knife ssh "chef_environment:production" "reboot"
default_attributesoverride_attributescookbook_versionschef_typenamedescription
lock cookbooks inproduction
{"name" : "production","description" : "Production cluster in EC2","cookbook_versions" : {"passenger_apache2" : "0.99.4"},"override_attributes" : { ... },"default_attributes" : { ... }}
“lock” cookbooks instaging
{"name" : "staging","description" : "Production cluster in EC2","cookbook_versions" : {"passenger_apache2" : "0.99.4"},"override_attributes" : { ... },"default_attributes" : { ... }}
unlock cookbooks indevelopment
{"name" : "development","description" : "Production cluster in EC2","cookbook_versions" : { ... },"override_attributes" : { ... },"default_attributes" : { ... }}
updating a cookbook
1. test in development
2. promote in staging
{"name" : "staging","description" : "Production cluster in EC2","cookbook_versions" : {"passenger_apache2" : "1.1.0" // major version bump},"override_attributes" : { ... },"default_attributes" : { ... }}
$ knife dwim environments/staging.json1 knife-dwim: https://github.com/mpasternacki/knife-dwim
3. verify in staging
4. promote in production
1. run aroundscreaming
2. demote in production
3. dance (optional)
scenario:updating passenger
{"name" : "production","description" : "Production cluster in EC2","override_attributes" : {"passenger" : {"version" : "2.1.4"}},}
{"name" : "production","description" : "Production cluster in EC2","override_attributes" : {"passenger" : {"version" : "3.0.18" // major version bump}},}