Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Docker Docker Docker Chef

someara
February 02, 2016

Docker Docker Docker Chef

Configuration Management Camp
Ghent Belgium
February 2016

someara

February 02, 2016
Tweet

More Decks by someara

Other Decks in Technology

Transcript

  1. Docker Docker Docker
    Chef

    View Slide

  2. Config Management Camp
    Ghent, Belgium
    February 2016

    View Slide

  3. Sean OMeara
    [email protected]
    @someara

    View Slide

  4. whoami

    View Slide

  5. Part 1

    View Slide

  6. Remember the time

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  10. Repeat after me

    View Slide

  11. CONFIGURATION
    MANAGEMENT AND
    IMMUTABLE
    INFRASTRUCTURE
    ARE NOT MUTUALLY
    EXCLUSIVE

    View Slide

  12. Say it again

    View Slide

  13. CONFIGURATION
    MANAGEMENT AND
    IMMUTABLE
    INFRASTRUCTURE
    ARE NOT MUTUALLY
    EXCLUSIVE

    View Slide

  14. We good?

    View Slide

  15. The Docker cookbook

    View Slide

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

    View Slide

  17. Configuration Management
    tests and repairs any
    programmable noun

    View Slide

  18. Images are nouns

    View Slide

  19. Containers are nouns

    View Slide

  20. hello world

    View Slide

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

    View Slide

  22. Install ChefDK

    View Slide

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

    View Slide

  24. kitchen test

    View Slide

  25. 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

    View Slide

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

    View Slide

  27. metadata.rb

    View Slide

  28. .kitchen.yml

    View Slide

  29. recipes/hello.rb

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  33. Bug report: “hello is not
    idempotent”

    View Slide

  34. kitchen converge hello
    kitchen converge hello

    View Slide

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

    View Slide

  36. hello-world exits after
    every run

    View Slide

  37. This is expected!

    View Slide

  38. http://gliderlabs.com/

    View Slide

  39. recipes/hello.rb

    View Slide

  40. rubocop \
    && rspec \
    && kitchen test hello

    View Slide

  41. metadata.rb

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  45. Recipe work
    Kitchen work
    Behavior testing
    Unit
    Final Acceptance
    Commit

    View Slide

  46. .kitchen.yml

    View Slide

  47. recipes/echo.rb

    View Slide

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

    View Slide

  49. View Slide

  50. 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

    View Slide

  51. test/integration/echo/inspec/run_spec.rb

    View Slide

  52. rubocop \
    && rspec \
    && kitchen test echo

    View Slide

  53. metadata.rb

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  57. kitchen converge echo
    kitchen login echo
    netstat -anp

    View Slide

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

    View Slide

  59. recipes/echo.rb

    View Slide

  60. test/integration/echo/inspec/run_spec.rb

    View Slide

  61. rubocop \
    && rspec \
    && kitchen test echo

    View Slide

  62. metadata.rb

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  66. recipes/web.rb

    View Slide

  67. recipes/web.rb

    View Slide

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

    View Slide

  69. test/integration/web/inspec/run_spec.rb

    View Slide

  70. rubocop \
    && rspec \
    && kitchen test web

    View Slide

  71. metadata.rb

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  75. kitchen converge web
    kitchen login web
    curl localhost

    View Slide

  76. Bob was here.
    Let’s fix that.

    View Slide

  77. recipes/web.rb

    View Slide

  78. test/integration/echo/inspec/run_spec.rb

    View Slide

  79. rubocop \
    && rspec \
    && kitchen test web

    View Slide

  80. metadata.rb

    View Slide

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

    View Slide

  82. Part 2

    View Slide

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

    View Slide

  84. Experimental status
    Soon to be renamed
    something less clever

    View Slide

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

    View Slide

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

    View Slide

  87. Install ChefDK
    chef gem install kitchen-dokken

    View Slide

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

    View Slide

  89. kitchen list
    docker ps -a

    View Slide

  90. View Slide

  91. kitchen create
    docker ps -a

    View Slide

  92. Chef container
    Data container
    Runner container

    View Slide

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

    View Slide

  94. docker diff suitename

    View Slide

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

    View Slide

  96. fin

    View Slide

  97. View Slide