Slide 1

Slide 1 text

Docker Docker Docker Chef

Slide 2

Slide 2 text

Config Management Camp Ghent, Belgium February 2016

Slide 3

Slide 3 text

Sean OMeara [email protected] @someara

Slide 4

Slide 4 text

whoami

Slide 5

Slide 5 text

Part 1

Slide 6

Slide 6 text

Remember the time

Slide 7

Slide 7 text

Remember that time we didn’t need configuration management because we had packaging?

Slide 8

Slide 8 text

Remember that time the cloud came out and we didn’t need sysadmins?

Slide 9

Slide 9 text

Remember that time when we didn’t need schemas because we had MongoDB?

Slide 10

Slide 10 text

Repeat after me

Slide 11

Slide 11 text

CONFIGURATION MANAGEMENT AND IMMUTABLE INFRASTRUCTURE ARE NOT MUTUALLY EXCLUSIVE

Slide 12

Slide 12 text

Say it again

Slide 13

Slide 13 text

CONFIGURATION MANAGEMENT AND IMMUTABLE INFRASTRUCTURE ARE NOT MUTUALLY EXCLUSIVE

Slide 14

Slide 14 text

We good?

Slide 15

Slide 15 text

The Docker cookbook

Slide 16

Slide 16 text

Configuration Management is not restricted to files, directories, packages and services

Slide 17

Slide 17 text

Configuration Management tests and repairs any programmable noun

Slide 18

Slide 18 text

Images are nouns

Slide 19

Slide 19 text

Containers are nouns

Slide 20

Slide 20 text

hello world

Slide 21

Slide 21 text

https://flic.kr/p/br26Cb Setup v0.0.1

Slide 22

Slide 22 text

Install ChefDK

Slide 23

Slide 23 text

git clone https:// github.com/someara/chef- docker-tutorial

Slide 24

Slide 24 text

kitchen test

Slide 25

Slide 25 text

git checkout v0.0.1 git checkout v0.1.0 git checkout v0.1.1 git checkout v0.2.0 git checkout v0.2.1 git checkout v0.3.0 git checkout v0.3.1

Slide 26

Slide 26 text

https://flic.kr/p/s684tk Feature v0.1.0

Slide 27

Slide 27 text

metadata.rb

Slide 28

Slide 28 text

.kitchen.yml

Slide 29

Slide 29 text

recipes/hello.rb

Slide 30

Slide 30 text

kitchen converge hello kitchen login hello docker images docker ps -a docker logs hello-world

Slide 31

Slide 31 text

git add . git commit -a -m “v0.1.0 - hello” git tag v0.1.0

Slide 32

Slide 32 text

https://flic.kr/p/53stX2 Patch v0.1.1

Slide 33

Slide 33 text

Bug report: “hello is not idempotent”

Slide 34

Slide 34 text

kitchen converge hello kitchen converge hello

Slide 35

Slide 35 text

kitchen login hello docker ps -a docker logs hello-world

Slide 36

Slide 36 text

hello-world exits after every run

Slide 37

Slide 37 text

This is expected!

Slide 38

Slide 38 text

http://gliderlabs.com/

Slide 39

Slide 39 text

recipes/hello.rb

Slide 40

Slide 40 text

rubocop \ && rspec \ && kitchen test hello

Slide 41

Slide 41 text

metadata.rb

Slide 42

Slide 42 text

git add . git commit -a -m “v0.1.1 - hello” git tag v0.1.1

Slide 43

Slide 43 text

an echo server https://flic.kr/p/6WtX6X

Slide 44

Slide 44 text

https://flic.kr/p/s684tk Feature v0.2.0

Slide 45

Slide 45 text

Recipe work Kitchen work Behavior testing Unit Final Acceptance Commit

Slide 46

Slide 46 text

.kitchen.yml

Slide 47

Slide 47 text

recipes/echo.rb

Slide 48

Slide 48 text

Docker Containers have 40+ (and growing) runtime API options

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

kitchen converge echo kitchen converge echo kitchen login echo docker images docker ps -a docker logs an_echo_server docker inspect an_echo_server echo "hi" | nc localhost 7

Slide 51

Slide 51 text

test/integration/echo/inspec/run_spec.rb

Slide 52

Slide 52 text

rubocop \ && rspec \ && kitchen test echo

Slide 53

Slide 53 text

metadata.rb

Slide 54

Slide 54 text

git add . git commit -a -m “v0.2.0 - echo” git tag v0.2.0

Slide 55

Slide 55 text

https://flic.kr/p/dRGr3t Patch v0.2.1

Slide 56

Slide 56 text

Security team recommends a change… Service should listen on explicitly defined interfaces

Slide 57

Slide 57 text

kitchen converge echo kitchen login echo netstat -anp

Slide 58

Slide 58 text

Listening on :::7 Let’s fix that.

Slide 59

Slide 59 text

recipes/echo.rb

Slide 60

Slide 60 text

test/integration/echo/inspec/run_spec.rb

Slide 61

Slide 61 text

rubocop \ && rspec \ && kitchen test echo

Slide 62

Slide 62 text

metadata.rb

Slide 63

Slide 63 text

git add . git commit -a -m “v0.2.1 - echo patch” git tag v0.2.1

Slide 64

Slide 64 text

https://flic.kr/p/ayDujN notifications and subscriptions

Slide 65

Slide 65 text

https://flic.kr/p/cNdyo Feature v0.3.0

Slide 66

Slide 66 text

recipes/web.rb

Slide 67

Slide 67 text

recipes/web.rb

Slide 68

Slide 68 text

kitchen converge web kitchen converge web kitchen login web docker images docker ps -a curl localhost docker logs bob

Slide 69

Slide 69 text

test/integration/web/inspec/run_spec.rb

Slide 70

Slide 70 text

rubocop \ && rspec \ && kitchen test web

Slide 71

Slide 71 text

metadata.rb

Slide 72

Slide 72 text

git add . git commit -a -m “v0.3.0 - web” git tag v0.3.0

Slide 73

Slide 73 text

https://flic.kr/p/o9c2G3 Patch v0.3.1

Slide 74

Slide 74 text

Marketing team recommends a change… Bob wasn’t there.

Slide 75

Slide 75 text

kitchen converge web kitchen login web curl localhost

Slide 76

Slide 76 text

Bob was here. Let’s fix that.

Slide 77

Slide 77 text

recipes/web.rb

Slide 78

Slide 78 text

test/integration/echo/inspec/run_spec.rb

Slide 79

Slide 79 text

rubocop \ && rspec \ && kitchen test web

Slide 80

Slide 80 text

metadata.rb

Slide 81

Slide 81 text

git add . git commit -a -m “v0.3.1 - echo patch” git tag v0.3.1

Slide 82

Slide 82 text

Part 2

Slide 83

Slide 83 text

kitchen-dokken http://on.mtv.com/1ls5SRc

Slide 84

Slide 84 text

Experimental status Soon to be renamed something less clever

Slide 85

Slide 85 text

Removes bootstrap overhead Uses Docker volumes Chef not baked into images Works on Travis

Slide 86

Slide 86 text

https://github.com/someara/ kitchen-dokken/

Slide 87

Slide 87 text

Install ChefDK chef gem install kitchen-dokken

Slide 88

Slide 88 text

git clone https://github.com/ someara/hello_dokken

Slide 89

Slide 89 text

kitchen list docker ps -a

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

kitchen create docker ps -a

Slide 92

Slide 92 text

Chef container Data container Runner container

Slide 93

Slide 93 text

docker run \ —volumes-from chef \ —volumes-from data \ imagename \ chef-client

Slide 94

Slide 94 text

docker diff suitename

Slide 95

Slide 95 text

https://travis-ci.org/ someara/etcd-cookbook

Slide 96

Slide 96 text

fin

Slide 97

Slide 97 text

No content