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

SpecInfra at JAWS DAYS 2014

SpecInfra at JAWS DAYS 2014

0d5d8fb9cc4c06f581825f5a61d3f5f1?s=128

Gosuke Miyashita
PRO

March 15, 2014
Tweet

More Decks by Gosuke Miyashita

Other Decks in Technology

Transcript

  1. Immutable Infrastructure࣌୅ͷ ߏ੒؅ཧπʔϧج൫SpecInfra JAWS DAYS 2014 Immutable Infrastructure Track ٶԼ

    ߶ี
  2. ࣗݾ঺հ

  3. ٶԼ ߶ี http://mizzy.org/ @gosukenator mizzy@github http://serverspec.org/

  4. αʔόߏ੒؅ཧͱ͸

  5. αʔόͷ੩తͳঢ়ଶΛ ؅ཧ͢Δ͜ͱ

  6. αʔόͷ੩తͳঢ়ଶ ! Πϯετʔϧ͞Ε͍ͯΔ ϛυϧ΢ΣΞ΍ઃఆͳͲ =

  7. αʔόߏ੒؅ཧπʔϧ

  8. (Puppet)

  9. (Chef)

  10. (Ansible)

  11. ߏ੒؅ཧπʔϧͷجຊݪଇ • એݴతʮԿΛ͍͔ͨ͠Ͱ͋ͬͯɺͲ͏͢Δ͔Ͱ͸ͳ͍ʯ • ந৅Խʮ͋ͳͨͷ୅ΘΓʹ໘౗Λݟͯ͘ΕΔʯ • ႈ౳ੑʮඞཁͳͱ͖͚࣮ͩߦ͢Δʯ • ऩଋԽʮ์͓͚ͬͯ͹Ͳ͏ʹ͔ͳΔʯ ΦϥΠϦʔδϟύϯʰ΢ΣϒΦϖϨʔγϣϯ

    5ষ ίʔυͱͯ͠ͷΠϯϑϥʱΑΓ
  12. None
  13. None
  14. Immutable͕αʔό ߏ੒؅ཧʹ༩͑ΔӨڹ

  15. ߏ੒؅ཧπʔϧͷجຊݪଇʢ࠶ܝʣ • એݴతʮԿΛ͍͔ͨ͠Ͱ͋ͬͯɺͲ͏͢Δ͔Ͱ͸ͳ͍ʯ • ந৅Խʮ͋ͳͨͷ୅ΘΓʹ໘౗Λݟͯ͘ΕΔʯ • ႈ౳ੑʮඞཁͳͱ͖͚࣮ͩߦ͢Δʯ • ऩଋԽʮ์͓͚ͬͯ͹Ͳ͏ʹ͔ͳΔʯ

  16. ႈ౳ੑ ! ঢ়ଶ͕ෆఆͳͷͰ࣮ߦ ͕ඞཁ͔Ͳ͏͔൑அ =

  17. ऩଋԽ ! ෆఆͳঢ়ଶΛҰఆͷ ঢ়ଶʹऩଋͤ͞Δ =

  18. Immutableલఏͱͨ͠ ߏ੒؅ཧπʔϧͷجຊݪଇ • એݴతʮԿΛ͍͔ͨ͠Ͱ͋ͬͯɺͲ͏͢Δ͔Ͱ͸ͳ͍ʯ • ந৅Խʮ͋ͳͨͷ୅ΘΓʹ໘౗Λݟͯ͘ΕΔʯ • ႈ౳ੑʮඞཁͳͱ͖͚࣮ͩߦ͢Δʯ • ऩଋԽʮ์͓͚ͬͯ͹Ͳ͏ʹ͔ͳΔʯ

  19. ႈ౳ੑ/ऩଋԽ͕ෆཁͳΒ ߏ੒؅ཧ͸΋ͬͱ γϯϓϧʹͰ͖ΔͷͰ͸ʁ

  20. ImmutableͳΜ͔ͩΒ खಈͰΠϝʔδ࡞ͬͱ ͚͹͍͍Μ͡Όͳ͍ʁ

  21. Ͱ΋࠶ݱՄೳͳखॱ͸ ࢒͓͖͍ͯͨ͠

  22. γΣϧεΫϦϓτ΍ DockerfileͰ΋͍͍ͷ͸ʁ

  23. Dockerfile # Memcached # # VERSION 1.0 ! # use

    the ubuntu base image provided by dotCloud FROM ubuntu MAINTAINER Guillaume J. Charmes, guillaume@dotcloud.com # make sure the package repository is up to date RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list RUN apt-get update ! # install memcached RUN apt-get install -y memcached
  24. ΋͏গ͠ந৅Խ͍ͨ͠

  25. ΍͸Γߏ੒؅ཧ πʔϧ͸ඞཁ

  26. configspec

  27. configspecʹΑΔߏ੒؅ཧίʔυ

  28. syllabus

  29. syllabusʹΑΔߏ੒؅ཧίʔυ

  30. None
  31. None
  32. None
  33. None
  34. configspec/syllabus ͱ΋ʹίϚϯυ࣮ߦ͸ SpecInfraΛར༻

  35. SpecInfra͸൚༻తίϚ ϯυ࣮ߦϑϨʔϜϫʔΫ

  36. ࣮ߦܗࣜͷࠩҟ ʢϩʔΧϧ/SSH/WinRM౳ʣ

  37. OS/σΟετϦϏϡʔγϣϯ ຖͷίϚϯυͷࠩҟ

  38. ͜ΕΒΛٵऩͯ͘͠Ε ΔϑϨʔϜϫʔΫ

  39. ݩʑ͸serverspecͷ Ұ෦ͩͬͨ΋ͷΛ෼཭

  40. SpecInfraͷ֓ཁ API OSந৅Խ ϨΠϠʔ Linux༻ίϚϯυ܈ ࣮ߦܗࣜ ந৅Խ ϨΠϠʔ Darwin༻ίϚϯυ܈ Solaris༻ίϚϯυ܈

    Windows༻ίϚϯυ܈ … API! ݺͼग़͠ ίϚϯυ! ࣮ߦ
  41. configspecͷ࣮૷

  42. configspecʹΑΔߏ੒؅ཧίʔυ

  43. None
  44. Configspec::Type::Package.new(‘apache2’) ↓ package(‘apache2’) ! ͱॻ͚Δ

  45. configspecʹΑΔߏ੒؅ཧίʔυ

  46. package(‘apache2’).installed? ͕ݺ͹ΕΔ

  47. None
  48. None
  49. OSͷҧ͍΍࣮ߦܗࣜͷҧ͍͸ SpecInfra͕ٵऩͯ͘͠ΕΔͷ Ͱbackend.installΛݺͿ͚ͩ

  50. SpecInfraΛར༻ͨ͠ ࠷খ࣮૷

  51. None
  52. None
  53. Exec, SshҎ֎ʹ΋ɺCmd, WinRM, Docker, LXC༻ͷ όοΫΤϯυ͕͋Δ

  54. Immutableͩͱຖճ͍ ͔ͪΒߏங͢Δ͔Β ͕͔͔࣌ؒΔͷͰ͸ʁ

  55. None
  56. None
  57. None
  58. None
  59. None
  60. DockerfileόοΫΤϯυͷग़ྗ಺༰

  61. ShellScript όοΫΤϯυ

  62. None
  63. ShellScriptόοΫΤϯυͷग़ྗ಺༰

  64. ࠓޙͷ՝୊

  65. υΩϡϝϯτ੔උ

  66. ػೳॆ࣮

  67. ϦϑΝΫλϦϯά ʢಛʹCommandҎԼʣ

  68. ςετίʔυ੔උ ʢserverspecͱͷ੾Γ෼͚ʣ

  69. ·ͱΊ • Immutableલఏʹ͢Δͱߏ੒؅ཧπʔϧʹႈ౳ੑ΍ऩ ଋԽ͸͍Βͳ͘ͳΓͦ͏ʢ͋ͬͯ΋͍͍͚Ͳʣ • SpecInfra͸OSຖͷίϚϯυͷҧ͍΍࣮ߦܗࣜΛٵऩ ͯ͘͠ΕΔ൚༻ίϚϯυ࣮ߦϑϨʔϜϫʔΫ • SpecInfraΛϕʔεʹͯࣗ͠෼ʹ͋ͬͨγϯϓϧͳߏ੒ ؅ཧπʔϧΛͭͬͯ͘ΈΑ͏

    • ՝୊͸͍ͬͺ͍͋ΔͷͰίϛολʹͳΕΔνϟϯε
  70. ࢀߟϦϯΫ • Immutable Infrastructure࣌୅ͷConfiguration Management Toolͷཁ͓݅Αͼͦͷ࣮ ૷ʹ͍ͭͯ - delirious thoughts

    • http://blog.kentarok.org/entry/2013/12/01/221729 • infrastructure - specinfraΛ࢖ͬͯΈΑ͏ - Qiita • http://qiita.com/sawanoboly/items/d1e7794739d9d31a5316 • Immutable Infrastructure ͷ༗༻ੑ - Togetter·ͱΊ • http://togetter.com/li/594684 • ssig33.com - Docker ΛϓϩμΫτͷσϓϩΠʹ࢖͏ • http://ssig33.com/text/Docker%20ΛϓϩμΫτͷσϓϩΠʹ࢖͏