Pro Yearly is on sale from $80 to $50! »

Serverspec at JTF2014

Serverspec at JTF2014

0d5d8fb9cc4c06f581825f5a61d3f5f1?s=128

Gosuke Miyashita

June 22, 2014
Tweet

Transcript

  1. ServerspecʹݟΔ ٕज़τϨϯυΛ ੜΈग़͢ώϯτ

  2. ࣗݾ঺հ 4 ٶԼ ߶ี 4 http://mizzy.org/ 4 mizzy@github 4 gosukenator@twitter

    4 ϑϦʔϥϯεΤϯδχΞ/Serverspec Operations
  3. ΞδΣϯμ 4 ࠷ۙͷΠϯϑϥܥٕज़τϨϯυ 4 Serverspecͱ͸ 4 Serverspec͕ੜ·Εͨഎܠ 4 Serverspecͷೝ஌౓ 4

    Serverspecͷ੒ޭཁҼ 4 ·ͱΊ
  4. ࠷ۙͷΠϯϑϥؔ࿈ٕज़ τϨϯυৼΓฦΓ

  5. ஫: OS͔Βϛυϧ΢ΣΞ ͱ͍ͬͨιϑτ΢ΣΞϨΠϠʔΛ ࢦ͢ݴ༿ͱͯ͠ͷΠϯϑϥͰ͢

  6. Πϯϑϥؔ࿈ٕज़τϨϯυ 4 αʔόߏ੒؅ཧπʔϧ 4 Chefਓؾ 4 ࠓ೥ʹͳͬͯ4݄,5݄ͱཱͯଓ͚ʹॻ੶ൃץ 4 USͰ͸2014೥ʹPuppetͷγΣΞΛ௒͑ͨΒ͍͠ 4

    Ansible 4 Chef΁ͷΧ΢ϯλʔ
  7. Πϯϑϥؔ࿈ٕज़τϨϯυʢ͖ͭͮʣ 4 Ծ૝Խؔ࿈πʔϧ 4 Vagrant 4 Docker 4 ςετۦಈΠϯϑϥͱΠϯϑϥCI 4

    Test Kitchen 4 Serverspec
  8. Πϯϑϥؔ࿈ٕज़τϨϯυʢ͖ͭͮʣ 4 Immutable Infrastructure 4 Trash Your Servers and Burn

    Your Code: Immutable Infrastructure and Disposable Components 4 WEB+DB PRESS Vol.81
  9. ςετۦಈΠϯϑϥ ΠϯϑϥCI

  10. None
  11. ςετۦಈΠϯϑϥ/ΠϯϑϥCI 4 ΞϓϦέʔγϣϯ։ൃͷख๏ΛΠϯϑϥߏஙʹԠ༻ 4 @riywo͘Μ͕2012೥ʹΠϯϑϥCIʹ͍ͭͯॻ͍ͯΔ 4 http://blog.riywo.com/2012/05/27/145310 4 ࣗ෼ࣗ਎ߏ૝͸2007೥͙Β͍͔Β͋ͬͨ 4

    ʮςετۦಈαʔόߏஙʯͱ͍͏ݴ༿Λߟ͍͑ͯͨ 4 http://d.hatena.ne.jp/dayflower/ 20070405/1175782564#c
  12. ςετۦಈΠϯϑϥ/ΠϯϑϥCI 4 Ҏલ͔Β֓೦͸͋ͬͨͱ͸͍͑ʮΠϯϑϥΛςετՄೳʹ ͢Δʯͱ͍͏ੈքΛ޿͛ͨͷ͸Serverspec 4 ୯ʹςετՄೳʹ͢Δ͚ͩͰ͸ͳ͘ɺGitHub FlowʹΑΓ ΠϯϑϥมߋΛϓϧϦΫΤετ͠ɺCIαʔόʹΑΓܧଓత ʹςετ͢Δɺͱ͍͏ੈքΛ։͍ͨ

  13. None
  14. Serverspec

  15. Serverspecͱ͸ 4 2013೥3݄຤ʹϦϦʔε 4 RSpecͰαʔόͷঢ়ଶΛςετ 4 ຊ࣭͸αʔόͷঢ়ଶΛهड़ͨ͠ίʔυΛςετ 4 PuppetϚχϑΣετ΍ChefϨγϐͳͲ 4

    Πϯϑϥίʔυͷ։ൃ΍ϦϑΝΫλϦϯάΛޮ཰ྑ͘ߦ͏ ͨΊͷπʔϧ
  16. ServerspecʹΑΔςετίʔυ describe package('nginx') do it { should be installed }

    end describe service('nginx') do it { should be_enabled } it { should be_running } end
  17. Serverspecͷεϖϧ 4 ਖ਼ 4 Serverspec/serverspec/SERVERSPEC 4 ޡ 4 ServerSpec/Server Spec

  18. Serverspec͸ͳͥ ੜ·Εͨͷ͔ʁ

  19. ςετπʔϧ։ൃͷ͖͔͚ͬ 4 2006೥ʹPuppetΛ࢖͍࢝Ίͨ 4 αʔόߏங͸PuppetʹΑͬͯࣗಈԽͰ͖ͨ 4 ͡Ό͋࣍͸ߏஙޙͷνΣοΫΛࣗಈԽ͍ͨ͠ 4 ExcelνΣοΫγʔτͰͷ໨ࢹ֬ೝ΍Ί͍ͨ

  20. Assurer 4 2007೥ʹͭͬͨ͘Perl੡αʔόςετϑϨʔϜϫʔΫ 4 ϓϥάΠϯͰ֦ுՄೳ 4 PlaggerͷӨڹ 4 Filter, Format,

    Notify, Publish, Test 4 make testͰςετΛ࣮ߦ/TAPܗࣜͰ݁Ռग़ྗ 4 CPAN AuthorͳͷͰPerlͰͷςετͷ΍ΓํΛ౿ऻ
  21. AssurerͷഊҼ 4 Serverspecͱҧ͍ৼΔ෣͍Λςετ 4 ঢ়ଶͷςετΑΓ΋ཁ͕݅ෳࡶ 4 ཉுͬͯ৭ʑ٧ΊࠐΈ͗ͯ͢ߋʹෳࡶʹͳͬͨ 4 ϑΣʔζ෼͚/ϓϥΨϒϧ/෼ࢄॲཧ/γΣϧ 4

    ίϯηϓτ͕Serverspec΄Ͳ໌֬Ͱ͸ͳ͔ͬͨ 4 ։ൃऀͰ͋Δࣗ෼͢Β࢖Θͳ͍΋ͷʹͳͬͨ
  22. AssurerҎޙ 4 ࣌ʑࢥ͍ฦ͢͜ͱ͸͚͋ͬͨͲੵۃతʹԿ͔͠Α͏ͱ΋͠ ͳ͔ͬͨ 4 ݱ৔͔Βएׯڑ཭Λஔ͍͍ͯͯɺPuppetͳͲ΋ͦΜͳʹ৮ Βͳ͘ͳͬͨ

  23. ·ͨPuppet͞ΘΓ͸͡Ίͨ 4 ࣗ෼͕͔ͭͯॻ͍ͨPuppetϚχϑΣετ͕ϨΨγʔίʔυ ʹͳ͍ͬͯͨ 4 ϦϑΝΫλϦϯάͨ͘͠ͳͬͨ 4 ϦϑΝΫλϦϯά͢ΔͳΒ౰વςετ͕ඞཁͩ͠CI΋΍Γ ͍ͨ

  24. Πϯϑϥςετͷલ४උ 4 ΠϯϑϥCI΍Ζ͏ͱࢥͬͯɺ·ͣ͸CIΛ࣮ߦ͢Δ؀ڥΛ੔ ͑ͨ 4 LXCίϯςφͰςετ͢ΔͨΊʹɺίϯςφΛͬ͘͞ͱͭ ͘ΕΔPuppetϚχϑΣετॻ͍ͨ 4 ͪΐ͏Ͳಉ͡λΠϛϯάͰDocker͕ग़͖ͯͯແ༻ͷ௕ ෺ʹͳͬͨ

  25. ςετπʔϧ୳͠ 4 ؀ڥ͸໨ॲ͕͍ͭͨͷͰ࣍͸ςετπʔϧ 4 ·ͣ͸طଘͷ΋ͷͰΑ͛͞ͳ΋ͷ͕ͳ͍͔୳ͨ͠ 4 rspec-puppet͙Β͍͔͠PuppetͰ࢖͑Δ΋ͷ͸ͳ͞ ͦ͏ 4 Chefपลͷํ͕ॆ࣮

    4 ChefSpec, Test Kitchen, Cucumber-Chef, minitest-chef-handler
  26. ࣗલͰͭ͘Δ͜ͱʹͨ͠ 4 ͨͩ͠rspec-puppet͸͖ͪΜͱϞδϡʔϧԽ͞Ε͍ͯͳ ͍ͱ࢖͑ͳ͍ 4 ࣗ෼ͷϚχϑΣετ͸ϞδϡʔϧԽ͞Εͯͳ͍ϨϕϧͷϨ Ψγʔ͞ 4 rspec-puppet͸࣮ࡍͷαʔόͷঢ়ଶΛςετ͢ΔΘ͚ ͡Όͳ͍

    4 ͡Ό͋ࣗ෼Ͱ࡞Δ͔ɺͬͯ͜ͱʹ
  27. Serverspec஀ੜ 4 ౰࣌ͷಉ྅(@hiboma)͕LXCͷίϯςφΛςετ͢Δίʔ υΛRSpecͰॻ͍͍ͯͨ 4 Α͠ɺͦΕύΫͬͯ൚༻తʹ࢖͑ΔΑ͏͠Α͏ 4 ϓϩτλΠϓΛҰ೔Ͱͭ͘Γɺཌ೔ʹ͸rubygems.orgͰ ެ։

  28. ॳظͷServerspec 4 ࠷ॳ͸RedHatܥLinuxͷΈରԠɺSSHόοΫΤϯυͷΈɻ ExecόοΫΤϯυ͸ͳ͔ͬͨɻ 4 @tkmr͞Μ͕ෳ਺OSରԠͱDebianରԠͯ͘͠Εͨ 4 @raphink͞Μ͕όοΫΤϯυ੾Γସ͑ରԠͯ͘͠Εͨ 4 ͜Μͳײ͡Ͱ৭ΜͳਓΛר͖ࠐΜͩ

  29. Serverspecͦͷޙ 4 Star: 738, Fork: 149, Contributors: 69 4 ରԠOS૿͑ͨΓɺαϙʔτ͢Δػೳ΋૿͑ͨΓ

    4 ݱࡏv2.0ʹ޲͚ͨ࡞ۀத 4 ΑΓ֦ு͠΍͘͢͢ΔͨΊͷϦϑΝΫλϦϯά͕ϝΠϯ
  30. ຊ౰ʹ޿͘ ࢖ΘΕͯΔͷʁ

  31. Serverspecͷೝ஌౓ 4 Black Duck Open Source Rookies of the Year

    2013 4 Docker, InfluxDB, Appium౳ͱฒΜͰड৆ 4 Thought Works Technology Radar 2014 4 Provisioning Testingͷ߲໨ʹServerspecͷจࣈ͕ग़ ͯ͘Δ 4 rubygems.orgͰͷμ΢ϯϩʔυ਺໿30ສ 4 Chef͕໿400ສ
  32. None
  33. ࡶࢽʹ͓͚Δݴٴ 4 WEB+DB PRESS Vol.75 4 WEB+DB PRESS Vol.76 4

    WEB+DB PRESS Vol.80 4 WEB+DB PRESS Vol.81
  34. None
  35. ॻ੶ʹ͓͚Δݴٴ 4 Test-Driven Infrastructure with Chef, 2nd Edition 4 Chef׆༻ΨΠυ

    4 νʔϜ։ൃ࣮ફೖ໳ 4 Chef࣮ફೖ໳ 4 ύʔϑΣΫτRuby on Rails
  36. None
  37. None
  38. None
  39. None
  40. None
  41. ւ֎Ͱͷ൓Ԡ

  42. None
  43. None
  44. None
  45. None
  46. None
  47. None
  48. ͳͥServerspec͸ ੒ޭͨ͠ͷ͔ʁ

  49. ೳಈతͳཁҼ

  50. ผྖҬͰ੒ޭ͍ͯ͠ΔϓϥΫςΟε Λ࣋ͪࠐΉ 4 ιϑτ΢ΣΞ։ൃͷੈքͷϓϥΫςΟε 4 ςετۦಈ։ൃ 4 ܧଓతΠϯςάϨʔγϣϯ 4 ಉ͡༻ޠ࢖͏ͱΠϝʔδ΋͠΍͍͢

    4 ςετۦಈΠϯϑϥ/ΠϯϑϥCI
  51. ໊લॏཁ 4 Server + RSpecͱ͍͏௚ٿͳ໊લ 4 ໊લ͔ΒԿΛ͢Δ΋ͷͳͷ͔͕ྨਪ͠΍͍͢ 4 ֮͑΍͍͢

  52. ӳޠυΩϡϝϯτ 4 ೔ຊࠃ֎Ͱ΋޿͘ೝ஌ͯ͠΋Β͓͏ͱࢥͬͨΒɺ͜Ε͸େ લఏ 4 README΍serverspec.orgͳͲ͸࠷ॳ͔ΒӳޠͰॻ͍ͨ

  53. ϝδϟʔͳΩʔϫʔυ/ϓϩμΫτ ʹͷ͔ͬΔ 4 Puppet΍Chefͱ͍ͬͨϫʔυΛࢄΓ͹ΊΔ 4 ࣮ࡍʹؔ࿈͢Δπʔϧͩ͠ 4 Puppet΍ChefͷதͷਓʹरΘΕͯɺ൴Β͕πΠʔτ͢Δ ͜ͱͰ޿·ͬͨײ

  54. υΩϡϝϯτͷΘ͔Γ΍͢͞ 4 ӳޠͰυΩϡϝϯτΛॻ͍ͯɺϝδϟʔͳϫʔυࢄΓ͹Ί ͯϦʔνϟϏϦςΟߴΊΔ͚ͩͰ͸·ͩෆे෼ 4 ͬ͟ͱࣼΊಡΈ͚ͨͩ͠ͰԿ͕Ͱ͖Δπʔϧͳͷ͔͙͢ʹ Θ͔ΔΑ͏ʹ͢Δͷ͕ॏཁ 4 ͙͢ʹΘ͔Βͳ͍ͱɺڵຯΛࣦͬͯ཭୤͞Εɺೋ౓ͱ໭Β ͳ͍͔΋͠Εͳ͍

  55. πʔϧࣗମͷγϯϓϧ͞ 4 υΩϡϝϯτΛΘ͔Γ΍͘͢͢ΔͨΊʹ͸ɺπʔϧͦͷ΋ ͷ͕γϯϓϧͰΘ͔Γ΍͍͢ඞཁ͕͋Δ 4 Serverspec͸ςετͷΈʹಛԽͨ͠ 4 ଞͷπʔϧʹ͋Δߏ੒؅ཧπʔϧͱͷ࿈ܞ΍VMͷૢ࡞ ౳͸ল͍ͨ 4

    Ώ͑ʹγϯϓϧͰΘ͔Γ΍͍͢
  56. γϯϓϧ͚ͩͲ֦ு͠΍͍͢ 4 جຊతͳػೳ͸͋·Γ૿΍͞ͳ͍ํ਑ 4 ͨͩ͠ϓϩάϥϜΛॻ͍֦ͯு͠΍ͯ͘͢͠Δ 4 ଞͷπʔϧͱ΋૊Έ߹Θͤ΍͍͢ 4 UNIX఩ֶ 4

    Keep It Simple, Stupid
  57. ଞπʔϧͱͷ૊Έ߹Θͤ 4 busser-serverspec 4 beaker-rspec 4 vagrant-serverspec 4 sensu-community-plugins/plugins/serverspec

  58. ΤʔδΣϯτϨε 4 ͍͘ΒศརͰ΋ɺαʔόʹ৭ʑೖΕΔͷ͸ݏͰ͢ΑͶʁ 4 Serverspec͸ςετΛ࣮ߦ͢ΔϚγϯʹRuby͕͋Ε͹OK 4 ςετର৅ͷϚγϯʹ͸SSHͰΞΫηεͰ͖Ε͹OK 4 Ruby͢Βඞཁͳ͍

  59. ࢖͏·ͰͷෑډΛԼ͛Δ 4 Serverspec͸Ruby 1.8.7Ҏ߱Λαϙʔτ 4 RedHat 6ܥͷύοέʔδΠϯετʔϧͰೖΔRubyʹରԠ 4 ผ్RubyΛμ΢ϯϩʔυͯ͠ίϯύΠϧɺͳͲ͢Δඞ ཁ͕ͳ͍

    4 serverspec-initίϚϯυ 4 ίϚϯυҰൃͰͻͳܗΛੜ੒͙ͯ͢͠ʹࢼͤΔ
  60. ࣗ෼ҰਓͰ΍Γ͗͢ͳ͍ 4 ࣗ෼͕࢖͏ػೳ͔͠جຊతʹ͸࣮૷͠ͳ͍ 4 γϯϓϧʹอͭ͏͑Ͱ΋େࣄ 4 ཉ͍͠ػೳ͕͋Ε͹ࣗ෼Ͱ࣮૷ͯ͘͠Εɺͱ͍͏ελϯε 4 OSSͳͷͰ 4

    ݁Ռͱͯ͠ଟ͘ͷਓΛר͖ࠐΊͨ
  61. ೳಈతཁҼ·ͱΊ 4 ଞྖҬͷϓϥΫςΟεΛ࣋ͪࠐΉ 4 ໊લ΍υΩϡϝϯτॏཁ 4 ϝδϟʔͳϓϩμΫτʹ৐͔ͬΔ 4 γϯϓϧ͔֦ͭுՄೳ 4

    ࢖͏ෑډΛԼ͛Δ 4 ଞऀΛר͖ࠐΉ
  62. ٕज़τϨϯυཁҼ

  63. αʔόߏ੒؅ཧπʔϧͷ੒ख़ 4 Puppetొ৔͔Β9೥ 4 Chefొ৔͔Β5೥ 4 ΈΜͳ͕ͦͷ࣍Λݟਾ͑ͩͨ͠

  64. Vagrantͷීٴ 4 ςετΛ࣮ߦ͢ΔͨΊʹ͸खݩͰVMΛಈ͔ͤΔํ͕ḿΔ 4 VagrantʹΑΓखݩͰςετίʔυΛॻ͍࣮ͯߦ͢Δ؀ڥ ͕ͭ͘Γ΍͘͢ͳͬͨ

  65. Chefք۾Ͱͷςετͷ੝Γ্͕Γ 4 ݩʑChefք۾ͷਓͨͪ͸ςετʹର͢Δҙ͕ࣝߴ͔ͬͨ 4 ChefSpec, Test Kitchen, Cucumber-Chef, minitest- chef-handlerͳͲςετܥπʔϧ͸Chefք۾͕ॆ࣮

  66. Jenkins΍CI as a Serviceͷීٴ 4 Jenkins͕։ൃͷੈքͰ͸౰ͨΓલͷΑ͏ʹ࢖ΘΕ͍ͯΔ 4 CI as a

    Serviceͷීٴ 4 Travis, CircleCI, Drone, WerckerͳͲ
  67. GitHubͷීٴ 4 GitHubͰΠϯϑϥίʔυΛ؅ཧ 4 ϓϧϦΫΤετϕʔεͰมߋ 4 CI as a Serviceͱͷ࿈ܞ

    4 ςετۦಈΠϯϑϥ/CIͱ૬ੑ͕ྑ͍
  68. ٕज़τϨϯυཁҼ·ͱΊ 4 ߏ੒؅ཧ+Ծ૝Խ+ςετ+CIͱ͍͏τϨϯυ 4 GitHub͕͜ͷτϨϯυΛߋʹޙԡ͠ 4 Ծ૝Խɺߏ੒؅ཧɺCIʹ͍ͭͯ͸ఆ൪͕Ͱ͖ͯͨ 4 ςετπʔϧ͸ܾఆ൛͕ͳ͔ͬͨ 4

    ͦ͜ʹServerspec͕͸·ͬͨ 4 ͦΕʹΑΓ͜ͷτϨϯυΛߋʹՃ଎ͤ͞Δ͜ͱʹͳͬͨ
  69. ·ͱΊ

  70. Serverspecͷ੒ޭཁҼ 4 ଞྖҬͰ੒ޭ͍ͯ͠ΔϓϥΫςΟεΛ࣋ͪࠐΉ 4 ςετۦಈ։ൃ/ܧଓతΠϯςάϨʔγϣϯ 4 ࠷ॳ͔ΒීٴΛҙࣝͨ͠׆ಈ 4 ໊લɺυΩϡϝϯτɺϝδϟʔϓϩμΫτʹͷ͔ͬΔ 4

    γϯϓϧ͔֦ͭுՄೳʹ 4 UNIX఩ֶ/Keep It Simple, Stupid
  71. Serverspecͷ੒ޭཁҼ 4 ׶͑ͯ伱Λͭͬͯ͘ਓΛר͖ࠐΉ 4 τϨϯυʹͷ͔ͬΔ 4 ߏ੒؅ཧ+Ծ૝Խ+ςετ+CI 4 ςετπʔϧҎ֎ͷఆ൪͸طʹ͋ͬͨ 4

    伱ؒΛຒΊͨͷ͕Serverspec
  72. Serverspecͷ੒ޭཁҼ 4 Өڹྗͷ͋ΔਓʹϦʔν͢Δ 4 ࠃ಺Ͱ͸ҏ౻௚໵ࢯͷϒϩάΤϯτϦ΍ࡶࢽهࣄͷӨڹ ͕େ͖ͦ͏

  73. Serverspecͷ੒ޭཁҼ 4 ٕज़τϨϯυΛੜΉͱ͔ߟ͑ͳ͍ 4 ੜ΋͏ͱࢥͬͯੜΊΔ΋ͷͰ΋ͳ͍ 4 ࣗ෼͕ཉ͍͠΋ͷɺ͓΋͠Ζ͍ͱࢥ͏΋ͷΛࣗ෼ͷͨΊʹ ͭ͘Δ 4 ਓྨͷٕज़ൃలͨΊͷແঈ։ൃɺͱ͍͏ελϯεͰ͸͍

    ͍΋ͷ͸Ͱ͖ͳ͍
  74. ·ͱΊ 4 ٕज़τϨϯυΛੜΈग़ۙ͢ಓ͸ͳ͍ 4 গͳ͘ͱ΋ࣗ෼͸஌Βͳ͍ 4 ͨͩࣗ෼͕ཉ͍͠΋ͷɺ͓΋͠Ζ͍ͱ͓΋͏΋ͷΛͭ͘Δ/ ެ։͢Δ 4 ͦͷੵΈॏͶ͕ૉ੖Β͍͠΋ͷΛੜΉ͜ͱʹͭͳ͕Δ

    4 ࣗ෼͕ͭͬͯ͘ެ։ͨ͠΋ͷ͸ɺখ͞ͳ΋ͷؚΊͯ100 Ҏ্͸͋Δ
  75. Shut the fuck up and write some code Openness is

    our driver for excellence ஌೭ऀෆ೗޷೭ऀ޷೭ऀෆ೗ᒜ೭ऀ