Infrastructure as Code at Codenize Meetup

Infrastructure as Code at Codenize Meetup

0d5d8fb9cc4c06f581825f5a61d3f5f1?s=128

Gosuke Miyashita

December 08, 2016
Tweet

Transcript

  1. Infrastructure as Codeͱ͸ Կ͔ͦͯ͠ԿͰ͋Δ΂͖͔ Codenize Meetup 2016/12/08 1

  2. ࣗݾ঺հ • ٶԼ ߶ี (mizzy@github, gosukenator@twitter) • ߹ಉձࣾServerspec Operations୅ද •

    גࣜձࣾϦΫϧʔτςΫϊϩδʔζATLٕज़ސ໰ • ઍגࣜձٕࣾज़ސ໰ • ϞϏϯΪגࣜձࣾ/גࣜձࣾDEPARTUREͷ͓ख఻͍ Codenize Meetup 2016/12/08 2
  3. ࠓ೔͓࿩͢͠Δ͜ͱ • Infrastructure as Codeͱ͸Կ͔ • Infrastructure as Code͸ͳͥඞཁͳͷ͔ •

    Infrastructure as Codeͷݪଇ • Infrastructure as CodeͷϓϥΫςΟε • ΞϯνϑϥδϟΠϧͱਓؒத৺ઃܭ Codenize Meetup 2016/12/08 3
  4. Infrastructure as Code ͱ͸Կ͔ Codenize Meetup 2016/12/08 4

  5. Infrastructure as Codeͱ͸Կ͔ • ௚༁͢Δͱʮίʔυͱͯ͠ͷΠϯϑϥʯ • ΠϯϑϥΛίʔυͰهड़͢Δ͜ͱ • ݴ༿͕ग़࢝Ίͨ࣌͸ʮࣗಈԽʯ͕য఺ •

    ݱࡏ͸ιϑτ΢ΣΞ։ൃͷϓϥΫςΟεΛΠϯϑϥ؅ཧʹ׆ ͔͢Ξϓϩʔνͱଊ͑ΒΕ͍ͯΔ Codenize Meetup 2016/12/08 5
  6. ιϑτ΢ΣΞ։ൃͷϓϥΫςΟε • ίʔυϨϏϡʔ • GitHubϑϩʔ • ςετ • Continuous Integration/Continuous

    Deployment • (ϞσϦϯά) Codenize Meetup 2016/12/08 6
  7. Infrastructure as Code ͸ͳͥඞཁͳͷ͔ Codenize Meetup 2016/12/08 7

  8. Ծ૝Խ΍Ϋϥ΢υͷൃలɾීٴ • μΠφϛοΫΠϯϑϥετϥΫνϟ • खܰʹΠϯϑϥ͕ߏஙͰ͖ΔΑ͏ʹͳͬͨ • ΠϯϑϥௐୡͷϦʔυλΠϜ͕ϘτϧωοΫͰ͸ͳ͘ͳͬͨ • ͜ΕΒʹΑΓ৽ͨͳΠϯϑϥ؅ཧ্ͷ໰୊͕ݦࡏԽͨ͠ Codenize

    Meetup 2016/12/08 8
  9. μΠφϛοΫΠϯϑϥετϥΫνϟʹΑΓݦࡏԽͨ͠໰୊ • αʔόʔεϓϩʔϧ • ߏ੒υϦϑτ • εϊʔϑϨʔΫαʔόʔ • ੬ऑͳΠϯϑϥ •

    Φʔτϝʔγϣϯڪා঱ • γεςϜർ࿑ Codenize Meetup 2016/12/08 9
  10. αʔόʔεϓϩʔϧ • sprawlʲsprɔ́ːlʳ: όϥόϥʹ޿͕Δɺແடংʹ޿͕Δ • αʔό͕؆୯ʹཱͯΒΕΔͷͰ؅ཧೳྗΛ௒͑ͯཚཱ • ઃఆมߋ΍ύον౰ͯͷ࡞ۀʹ௥ΘΕΔ • ·ͨ͸์ஔ͞ΕΔ

    • ඍົʹߏ੒/ઃఆ͕ҧ͏αʔό͕૿͑Δ → ߏ੒υϦϑτ Codenize Meetup 2016/12/08 10
  11. ߏ੒υϦϑτ • ͕࣌ؒܦͭʹͭΕͯߏ੒/ઃఆͷࠩҧ͕ฆΕࠐΉ • ಛఆͷαʔό͚ͩҰ࣌తͳରԠͯ͠໭͠๨ΕΔ • ৬ਓʹΑΔख࡞ۀɺ͔͠΋ਓʹΑͬͯ΍Γํҧ͏ • εϊʔϑϨʔΫαʔό΍Φʔτϝʔγϣϯڪා঱ΛੜΈग़͢ Codenize

    Meetup 2016/12/08 11
  12. εϊʔϑϨʔΫαʔό • ଞͷαʔόͱߏ੒/ઃఆ͕ҟͳΔαʔό • εϊʔϑϨʔΫ ʹ ઇͷͻͱ͔͚Β • ࠶ݱ͢Δͷ͕೉͍͠ •

    ߏ੒/ઃఆ͕೺Ѳ͖͠ΕͣΞϯλονϟϒϧʹ • εϊʔϑϨʔΫαʔόͷ૿৩ → ੬ऑͳΠϯϑϥ Codenize Meetup 2016/12/08 12
  13. ੬ऑͳΠϯϑϥ • εϊʔϑϨʔΫαʔό͕ຮԆͯ͠Πϯϑϥશମ͕੬ऑʹͳΔ • γεςϜશମ͕؆୯ʹյΕम෮ෆೳ Codenize Meetup 2016/12/08 13

  14. Φʔτϝʔγϣϯڪා঱ • εϊʔϑϨʔΫαʔό͕૿͑ΔͱɺࣗಈԽπʔϧ͕΋ͨΒ͢ ݁Ռ͕༧ଌෆೳʹͳΔ • ݁Ռͱͯ͠πʔϧ͕े෼ʹ׆͔ͤͳ͍ɺ࢖͑ͳ͍ • ࣗಈԽʹΑΓ໰୊ΛղফΛͨͯ͘͠΋Ͱ͖ͳ͍ѱ॥؀ Codenize Meetup

    2016/12/08 14
  15. γεςϜർ࿑ • ݪจͰ͸Erosionʢਁ৯ɺ่յɺࢎḝͳͲʣ • Կ΋͠ͳͯ͘΋࣌ؒͷܦաͱͱ΋ʹγεςϜ͕յΕ͍ͯ͘ Codenize Meetup 2016/12/08 15

  16. ݦࡏԽͨ͠໰୊఺·ͱΊ • αʔόʔεϓϩʔϧ • ߏ੒υϦϑτ • εϊʔϑϨʔΫαʔόʔ • ੬ऑͳΠϯϑϥ •

    Φʔτϝʔγϣϯڪා঱ • γεςϜർ࿑ • ཁ͢ΔʹɺαʔόΛ͹Μ͹ΜཱͯΒΕΔΑ͏ʹͳ͍ͬͨͤͰɺมߋ؅ཧ͕ഁ໓ͯ͠ γεςϜ͕ࢮ͵ Codenize Meetup 2016/12/08 16
  17. ΠϯϑϥมߋͷϦʔυλΠϜ • ͦΕ·Ͱආ͚೉͍ϘτϧωοΫͱଊ͑ΒΕ͍ͯͨϦʔυλΠ Ϝ͕ϘτϧωοΫͰ͸ͳ͘ͳͬͨ • ϏδωεཁٻͷมԽʹΠϯϑϥଆ΋ਝ଎ʹରԠ͢Δඞཁੑ͕ ग़͖ͯͨ • ैདྷͷ؅ཧΞϓϩʔνͰ͸͜ͷ଎౓ʹ͍͍͚ͭͯͳ͍ Codenize

    Meetup 2016/12/08 17
  18. ͦ͜ͰInfrastructure as Code • μΠφϛοΫΠϯϑϥετϥΫνϟͷൃలɾීٴʹΑΓɺ৽ͨʹ ग़͖ͯͨ໰୊Λղܾ͢ΔͨΊͷΞϓϩʔν͕Infrastructure as Code • ϏδωεཁٻͷมԽʹ͋Θͤͯਝ଎ʹΠϯϑϥΛมߋ͢Δ

    • ৽ͨʹݦࡏԽͨ͠มߋ؅ཧ্ͷ໰୊Λղܾ͢Δ • ཁ͢Δʹʮมߋ؅ཧ͕༰қͳΠϯϑϥΛͭ͘ΔʯͨΊͷΞϓϩ ʔν͕Infrastructure as Code Codenize Meetup 2016/12/08 18
  19. Infrastructure as Code ͷݪଇ Codenize Meetup 2016/12/08 19

  20. Infrastructure as Codeͷݪଇ • ؆୯ʹ࠶ݱͰ͖ΔγεςϜ • ࢖͍ࣺͯʹͰ͖ΔγεςϜ • ౷ҰతͳγεςϜ •

    ൓෮Մೳͳϓϩηε • มߋ͠΍͍͢σβΠϯ Codenize Meetup 2016/12/08 20
  21. ؆୯ʹ࠶ݱͰ͖ΔγεςϜ • ͋ΒΏΔߏ੒ཁૉ͸ਓखΛ͔͚ͣʹ࣮֬ʹ࠶ߏஙͰ͖Ͷ͹ͳ Βͳ͍ • εϊʔϑϨʔΫԽΛආ͚ΒΕΔ • ߏஙɺ࠶ߏங͕؆୯Ͱ͋Ε͹ɺมߋΛՃ͑Δͱ͖ͷϦεΫ΍ ڪා৺ͷେ൒͕औΓআ͔ΕΔ Codenize

    Meetup 2016/12/08 21
  22. ࢖͍ࣺͯʹͰ͖ΔγεςϜ • μΠφϛοΫΠϯϑϥετϥΫνϟʹΑΓϦιʔε͕؆୯ʹ࡞ ੒ɺഁغɺަ׵ɺมߋɺҠಈͰ͖Δ • ͜ͷϝϦοτΛ׆͔ͨ͢Ίʹ͸ɺαʔό͕ফ͑ͨΓݱΕͨΓมԽ ͨ͠Γͯ͠΋ɺαʔϏε͕ܧଓͰ͖ΔΑ͏ʹઃܭ͢΂͖ • ͍ͭͰ΋࢖͍ࣺͯʹͰ͖Δͱ͍͏͜ͱ͸ɺมԽΛॊೈʹॲཧͰ ͖ɺվྑɺमਖ਼ΛՃ͑Δ͜ͱ͕؆୯ʹͳΔ

    • Τϥʔ଱ੑ΋ߴ͘ͳΔ Codenize Meetup 2016/12/08 22
  23. ౷ҰతͳγεςϜ • ಉ͡Α͏ͳαʔϏεΛఏڙ͢Δෳ਺ͷαʔό͸ಉ͡ߏ੒/ઃఆͰ ͋Δ΂͖ • ߏ੒/ઃఆʹҧ͍͕͋ΔͱࣗಈԽπʔϧ͕΋ͨΒ݁͢Ռ͕༧ଌෆ ೳʹ • ࣗಈԽͷ৴པੑ͕ଛͳΘΕΔͱɺมߋ͕ࠔ೉ʹͳΔ •

    ౷ҰతͳγεςϜΛ࠶ߏஙՄೳʹ͓ͯ͘͠ͱɺߏ੒υϦϑτͷղ ফʹ໾ཱͭ Codenize Meetup 2016/12/08 23
  24. ൓෮Մೳͳϓϩηε • Πϯϑϥʹର͢ΔΞΫγϣϯΛεΫϦϓτͳΓπʔϧͳΓͰ ൓෮Մೳʹ͢Δ • ࠶ߏஙͷ͠΍͢͞ʹͭͳ͕Γɺ؆୯ʹ࠶ݱͰ͖Δ౷Ұతͳγ εςϜΛߏ੒Ͱ͖Δ • ςετ͠΍͘͢ͳΔ Codenize

    Meetup 2016/12/08 24
  25. มߋ͠΍͍͢σβΠϯ • μΠφϛοΫΠϯϑϥετϥΫνϟͰ͸طଘγεςϜʹมߋ ΛՃ͑Δͷ͸؆୯ • ͜Ε͸͢΂ͯͷ෦෼͕มߋ͠΍͘͢ઃܭ͞Ε͍ͯΔͱ͍͏લ ఏͷݩ • ιϑτ΢ΣΞͱΠϯϑϥ͸ɺมߋ͠΍͍͢Α͏Ͱ͖ΔݶΓ୯ ७ʹઃܭ͞Ε͍ͯͳ͚Ε͹ͳΒͳ͍

    Codenize Meetup 2016/12/08 25
  26. Infrastructure as Codeͷݪଇʢ࠶ܝʣ • ؆୯ʹ࠶ݱͰ͖ΔγεςϜ • ࢖͍ࣺͯʹͰ͖ΔγεςϜ • ౷ҰతͳγεςϜ •

    ൓෮Մೳͳϓϩηε • มߋ͠΍͍͢σβΠϯ Codenize Meetup 2016/12/08 26
  27. Infrastructure as Code ͷϓϥΫςΟε Codenize Meetup 2016/12/08 27

  28. Infrastructure as CodeͷϓϥΫςΟε • ఆٛϑΝΠϧ • ࣗݾهड़γεςϜͱϓϩηε • όʔδϣϯ؅ཧ •

    ܧଓతςετ • খࠁΈͳมߋ • ʢܧଓతʹαʔϏεΛར༻Մೳঢ়ଶʹอͭʣ Codenize Meetup 2016/12/08 28
  29. ఆٛϑΝΠϧ • جૅதͷجૅ • PuppetͷϚχϑΣετ΍ChefͷϨγϐ • Πϯϑϥཁૉͱͦͷߏ੒/ઃఆํ๏Λࢦఆ͢Δ • ςΩετϑΝΠϧͰ؅ཧ Codenize

    Meetup 2016/12/08 29
  30. ࣗݾهड़γεςϜͱϓϩηε • υΩϡϝϯτΛͳΔ΂͘ॻ͔ͳ͍ • ϓϩηεΛ࣮ࢪ͢ΔͨΊͷखॱ͸ɺ࣮ࡍʹϓϩηεΛ࣮૷͠ ͍ͯΔεΫϦϓτɺఆٛϑΝΠϧɺπʔϧʹॻ͖ࠐ·Ε͍ͯΔ • ͍Θ͹ʮ࣮ߦͰ͖ΔυΩϡϝϯτʯ • ͦΕҎ֎ʹ͸ɺॳΊͯ࢖͏ਓͷͨΊͷ࠷খݶͷυΩϡϝϯτ

    ʹཹΊΔ Codenize Meetup 2016/12/08 30
  31. όʔδϣϯ؅ཧ • ͋ΒΏΔ΋ͷΛόʔδϣϯ؅ཧ͢Δͷ͕๬·͍͠ • τϨʔαϏϦςΟ • ϩʔϧόοΫ • ૬ؔؔ܎ͷ؅ཧ •

    Մࢹੑ • ΞΫγϣφϏϦςΟ Codenize Meetup 2016/12/08 31
  32. ܧଓతςετ • Πϯϑϥίʔυʹมߋ͕͋Δ౓ʹςετΛ࣮ߦ • ςελϏϦςΟΛߴΊΔͱૄ݁߹ͰΫϦʔϯͰ୯७ͳઃܭ͕ ଅ͞ΕΔ • มߋʹର͢ΔϑΟʔυόοΫ͕ૣ͘ɺͻΜͺΜʹมߋΛՃ͑ ͯ΋େৎ෉ͩͱ͍͏ࣗ৴͕ੜ·ΕΔ Codenize

    Meetup 2016/12/08 32
  33. খࠁΈͳมߋ • খ͞ͳมߋΛςετ࣮ͯ֬͠ʹಈ࡞͢ΔΑ͏ʹ͢Δํ͕؆୯ Ͱ࡞ۀྔ͕গͳ͍ • มߋʹΑΓൃੜͨ͠໰୊ͷݪҼ͕ಛఆ͠΍͍͢ • ϩʔϧόοΫ΋͠΍͍͢ • ͻΜͺΜʹมߋͯ͠ϦϦʔε͢Δํ͕Ϟνϕʔγϣϯ্͕Δ

    Codenize Meetup 2016/12/08 33
  34. Infrastructure as CodeͷϓϥΫςΟεʢ࠶ܝʣ • ఆٛϑΝΠϧ • ࣗݾهड़γεςϜͱϓϩηε • όʔδϣϯ؅ཧ •

    ܧଓతςετ • খࠁΈͳมߋ • ʢܧଓతʹαʔϏεΛར༻Մೳঢ়ଶʹอͭʣ Codenize Meetup 2016/12/08 34
  35. ΞϯνϑϥδϟΠϧͱਓؒத৺ઃܭ Codenize Meetup 2016/12/08 35

  36. ΞϯνϑϥδϟΠϧ • Infrastructure as Code͸ݎ࿚Λ௒͑ͯΞϯνϑϥδϟΠϧͳ ΠϯϑϥΛ໨ࢦ͢ • ਓؒ͸τϨʔχϯά͠ͳ͍ͱମ͕ऑ͘ͳΓյΕ΍͘͢ͳΔ • γεςϜ΋ಉ༷ɺมߋΛ࠷খݶʹ཈͑Δͱݎ࿚ʹͳΒͳ͍

    • γεςϜΛઈ͑ͣมߋ͠վྑ͢Δ͜ͱͰΑΓݎ࿚ʹͳΔ Codenize Meetup 2016/12/08 36
  37. ਓؒத৺ઃܭ • ࣗಈԽ͚ͩͰ͸ΞϯνϑϥδϟΠϧʹͰ͖ͳ͍ • γεςϜΛΑ͘ཧղ͠ɺܧଓతʹมߋΛՃ͑ΒΕΔਓͷଘࡏ ͕ॏཁ • มԽʹରԠͰ͖ΔγεςϜΛઃܭ͢ΔͨΊͷൿ݃͸ɺਓΛத ৺ʹͯ͠ઃܭ͢Δ͜ͱ Codenize

    Meetup 2016/12/08 37
  38. ·ͱΊ • ͔ͭͯ͸ITΠϯϑϥ͕มԽͷ੍໿ʹͳ͍ͬͯͨ • μΠφϛοΫΠϯϑϥετϥΫνϟͷൃలɾීٴʹΑΓมԽͷ੍ ໿Ͱ͸ͳ͘ͳͬͨ • ੍໿Λલఏͱͨ͠ैདྷతͳΞϓϩʔν͸௨༻͠ͳ͘ͳͬͨ • μΠφϛοΫΠϯϑϥετϥΫνϟ࣌୅ʹରԠ͠ɺมԽʹڧ͍Ξ

    ϯνϑϥδϟΠϧͳΠϯϑϥΛͭ͘ΔͨΊͷΞϓϩʔν͕ Infrastructure as CodeͰ͋Δ Codenize Meetup 2016/12/08 38
  39. ࢀߟࢿྉ • Infrastructure as Code - O'Reilly Media • http://shop.oreilly.com/product/0636920039297.do

    • Infrastructure as Code ࠶ߟ - Gosuke Miyashita • http://mizzy.org/blog/2016/04/22/1/ • serverspec ͷ࿦จެ։͠·͢ - Gosuke Miyashita • http://mizzy.org/blog/2014/03/11/1/ • Recruit Technologies Open Lab #03 ςʔϚɿInfrastructure as Code • http://atl.recruit-tech.co.jp/blog/4240/ Codenize Meetup 2016/12/08 39