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 full-size slide

  2. Config Management Camp
    Ghent, Belgium
    February 2016

    View full-size slide

  3. Remember the time

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  7. Repeat after me

    View full-size slide

  8. CONFIGURATION
    MANAGEMENT AND
    IMMUTABLE
    INFRASTRUCTURE
    ARE NOT MUTUALLY
    EXCLUSIVE

    View full-size slide

  9. Say it again

    View full-size slide

  10. CONFIGURATION
    MANAGEMENT AND
    IMMUTABLE
    INFRASTRUCTURE
    ARE NOT MUTUALLY
    EXCLUSIVE

    View full-size slide

  11. The Docker cookbook

    View full-size slide

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

    View full-size slide

  13. Configuration Management
    tests and repairs any
    programmable noun

    View full-size slide

  14. Images are nouns

    View full-size slide

  15. Containers are nouns

    View full-size slide

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

    View full-size slide

  17. Install ChefDK

    View full-size slide

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

    View full-size slide

  19. kitchen test

    View full-size slide

  20. 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 full-size slide

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

    View full-size slide

  22. .kitchen.yml

    View full-size slide

  23. recipes/hello.rb

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  27. Bug report: “hello is not
    idempotent”

    View full-size slide

  28. kitchen converge hello
    kitchen converge hello

    View full-size slide

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

    View full-size slide

  30. hello-world exits after
    every run

    View full-size slide

  31. This is expected!

    View full-size slide

  32. http://gliderlabs.com/

    View full-size slide

  33. recipes/hello.rb

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  39. .kitchen.yml

    View full-size slide

  40. recipes/echo.rb

    View full-size slide

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

    View full-size slide

  42. 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 full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  48. kitchen converge echo
    kitchen login echo
    netstat -anp

    View full-size slide

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

    View full-size slide

  50. recipes/echo.rb

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  56. recipes/web.rb

    View full-size slide

  57. recipes/web.rb

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  64. kitchen converge web
    kitchen login web
    curl localhost

    View full-size slide

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

    View full-size slide

  66. recipes/web.rb

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  71. Experimental status
    Soon to be renamed
    something less clever

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  74. Install ChefDK
    chef gem install kitchen-dokken

    View full-size slide

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

    View full-size slide

  76. kitchen list
    docker ps -a

    View full-size slide

  77. kitchen create
    docker ps -a

    View full-size slide

  78. Chef container
    Data container
    Runner container

    View full-size slide

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

    View full-size slide

  80. docker diff suitename

    View full-size slide

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

    View full-size slide