Slide 1

Slide 1 text

chef + environments safer infrastructure

Slide 2

Slide 2 text

t f g sethvargo

Slide 3

Slide 3 text

what’s an environment?

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

{ "name" : "production", "description" : "Production cluster in EC2", "override_attributes" : { ... }, "default_attributes" : { ... } }

Slide 9

Slide 9 text

target specific environments

Slide 10

Slide 10 text

$ knife search node "chef_environment:production"

Slide 11

Slide 11 text

$ knife ssh "chef_environment:production" "reboot"

Slide 12

Slide 12 text

default_attributes override_attributes cookbook_versions chef_type name description

Slide 13

Slide 13 text

default_attributes override_attributes cookbook_versions chef_type name description

Slide 14

Slide 14 text

lock cookbooks in production

Slide 15

Slide 15 text

{ "name" : "production", "description" : "Production cluster in EC2", "cookbook_versions" : { "passenger_apache2" : "0.99.4" }, "override_attributes" : { ... }, "default_attributes" : { ... } }

Slide 16

Slide 16 text

“lock” cookbooks in staging

Slide 17

Slide 17 text

{ "name" : "staging", "description" : "Production cluster in EC2", "cookbook_versions" : { "passenger_apache2" : "0.99.4" }, "override_attributes" : { ... }, "default_attributes" : { ... } }

Slide 18

Slide 18 text

unlock cookbooks in development

Slide 19

Slide 19 text

{ "name" : "development", "description" : "Production cluster in EC2", "cookbook_versions" : { ... }, "override_attributes" : { ... }, "default_attributes" : { ... } }

Slide 20

Slide 20 text

updating a cookbook

Slide 21

Slide 21 text

1. test in development

Slide 22

Slide 22 text

2. promote in staging

Slide 23

Slide 23 text

{ "name" : "staging", "description" : "Production cluster in EC2", "cookbook_versions" : { "passenger_apache2" : "0.99.4" }, "override_attributes" : { ... }, "default_attributes" : { ... } }

Slide 24

Slide 24 text

{ "name" : "staging", "description" : "Production cluster in EC2", "cookbook_versions" : { "passenger_apache2" : "0.99.4" }, "override_attributes" : { ... }, "default_attributes" : { ... } }

Slide 25

Slide 25 text

{ "name" : "staging", "description" : "Production cluster in EC2", "cookbook_versions" : { "passenger_apache2" : "1.1.0" // major version bump }, "override_attributes" : { ... }, "default_attributes" : { ... } }

Slide 26

Slide 26 text

$ knife dwim environments/staging.json 1 knife-dwim: https://github.com/mpasternacki/knife-dwim

Slide 27

Slide 27 text

3. verify in staging

Slide 28

Slide 28 text

4. promote in production

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

1. run around screaming

Slide 31

Slide 31 text

2. demote in production

Slide 32

Slide 32 text

3. dance (optional)

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

scenario: updating passenger

Slide 35

Slide 35 text

default_attributes override_attributes cookbook_versions chef_type name description

Slide 36

Slide 36 text

default_attributes override_attributes cookbook_versions chef_type name description

Slide 37

Slide 37 text

{ "name" : "production", "description" : "Production cluster in EC2", "override_attributes" : { "passenger" : { "version" : "2.1.4" } }, }

Slide 38

Slide 38 text

1. test in development

Slide 39

Slide 39 text

2. promote in staging

Slide 40

Slide 40 text

{ "name" : "production", "description" : "Production cluster in EC2", "override_attributes" : { "passenger" : { "version" : "2.1.4" } }, }

Slide 41

Slide 41 text

{ "name" : "production", "description" : "Production cluster in EC2", "override_attributes" : { "passenger" : { "version" : "2.1.4" } }, }

Slide 42

Slide 42 text

{ "name" : "production", "description" : "Production cluster in EC2", "override_attributes" : { "passenger" : { "version" : "3.0.18" // major version bump } }, }

Slide 43

Slide 43 text

$ knife dwim environments/staging.json 1 knife-dwim: https://github.com/mpasternacki/knife-dwim

Slide 44

Slide 44 text

3. verify in staging

Slide 45

Slide 45 text

4. promote in production

Slide 46

Slide 46 text

chef + environments safer infrastructure

Slide 47

Slide 47 text

t f g sethvargo