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

まだまだbitbucketを信じたい。bitbucket pipelineで行うCodedeploy(仮)

まだまだbitbucketを信じたい。bitbucket pipelineで行うCodedeploy(仮)

【AWS×Deployment】TechTalk #5
2017/05/23

0c8a5b8ae78cc20afa906b2199e912ba?s=128

masakuni.ito.19

May 23, 2017
Tweet

Transcript

  1. © 2017 LIG inc. · ͩ · ͩ B i

    t b u c k e t Λ ৴ ͡ ͨ ͍ ɻ B i t b u c k e t P i p e l i n e s Ͱ ߦ ͏ C o d e d e p l o y ʢ Ծ ʣ 2017/05/23
  2. © 2017 LIG inc. λ Π τ ϧ վ Ί

    Ͱ ͋ Δ 2
  3. © 2017 LIG inc. ຊ ౰ ʹ ɺ େ ޷

    ͖ ͩ ͬ ͨ Α … … 
 B i t b u c k e t P i p e l i n e Ͱ ߦ ͏ C o d e D e p l o y 3
  4. © 2017 LIG inc. ࣗ ݾ ঺ հ 4

  5. © 2017 LIG inc. ג ࣜ ձ ࣾ L I

    G ό ο Ϋ Τ ϯ υ Τ ϯ δ χ Ξ ҏ ౻ ਖ਼ ܇ 5
  6. © 2017 LIG inc. ਓ ෺ ঺ հ 3 4

    ࡀ ʢ உ ੑ ʣ 4 ೥ લ ʹ W e b ۀ ք ΁ M a c ʹ · ͩ ׳ Ε ͳ ͍ ͩ ͍ ͨ ͍ P H P e r ࠷ ۙ ͸ P y t h o n ΍ Γ ͨ ͍ 6 @ l i g _ m a s a k u n i
  7. © 2017 LIG inc. Ξ δ Σ ϯ μ 7

  8. © 2017 LIG inc. 8 Ξ δ Σ ϯ μ

    ✦Pi pelines ʹ͍ͭͯ ✦Bi tbucket ͔ΒC o d e D e p l o y΁ͷಓے ✦ϋϚ ͬͨ͜ͱʗݏͳ͜ͱ ✦·ͱΊ ✦࠙਌ձͰ͓࿩͠·͠ΐ͏
  9. © 2017 LIG inc. P i p e l i

    n e s ʹ ͭ ͍ ͯ 9
  10. © 2017 LIG inc. 10 P i p e l

    i n e ʹ ͭ ͍ ͯ Bitbucket ͕࢝ΊͨC Iπʔϧ
  11. © 2017 LIG inc. 11 P i p e l

    i n e ʹ ͭ ͍ ͯ Bitbucket ͰC IΛ׬݁ͤ͞Δ͜ͱ͕Ͱ͖Δ ৭ ʑߟ ͑ͨ ͚ Ͳɺ ͓ ͦ Β ͘ ࠷ େ ͷ ϝ Ϧ ο τ
  12. © 2017 LIG inc. 12 P i p e l

    i n e ʹ ͭ ͍ ͯ ϦϙδτϦʹ bitbucket-pipelines.yml Λઃஔ
  13. © 2017 LIG inc. 13 P i p e l

    i n e ʹ ͭ ͍ ͯ p u s h΍merge ɺखಈΛى఺ͱͯ͠
  14. © 2017 LIG inc. 14 P i p e l

    i n e ʹ ͭ ͍ ͯ Bi tbucket ಺ͰD o c k e rίϯςφ্ཱ͕͕ͪΓ
  15. © 2017 LIG inc. 15 P i p e l

    i n e ʹ ͭ ͍ ͯ εΫϦϓτ౳Λ࣮ߦ
  16. © 2017 LIG inc. ศ ར 16

  17. © 2017 LIG inc. B i t b u c

    k e t ͔ Β C o d e D e p l o y ΁ ͷ ಓ ے 17
  18. © 2017 LIG inc. 18 B i t b u

    c k e t ͔ Β C o d e D e p l o y ΁ ͷ ಓ ے ✦C o d e D e p l o yͷ ઃఆ ͸ ऴ Θ ͬͯ ͍ Δ ✦IAM ͷ τ ʔ Ϋϯ Λ ࢖ͬͯ σ ϓϩΠ Ͱ ͖ Δ ✦ί ʔ υ ͸ zi p Ͱ · ͱΊͯ S3 ʹ ্ ͛Β Ε Δ ✦B i t b u ck e t ͔ Β ͸௚ ઀σ ϓ ϩΠͰ ͖ ͳ ͍ ͨ Ί ✦σ ϓ ϩ Π ʹ͔ ͔ Δ࣌ ؒΛ ༧ ଌ͢Δ ඞ ཁ ͕ ͋ Δ ✦5 0 / m i n / m o n t hΛ௒ ͑ͳ ͍ Α͏ʹ ✦A m a z o n ۘ ੡ ͷc od e d e p l oy _ d epl o y. p y Λ ࢖ ༻ ͢ Δ
 h t t p s : / / b i t b u c k e t . o r g / a w s l a b s / a w s - c o d e d e p l o y - b i t b u c k e t - p i p e l i n e s - p y t h o n / o v e r v i e w લఏ
  19. © 2017 LIG inc. 19 B i t b u

    c k e t ͔ Β C o d e D e p l o y ΁ ͷ ಓ ے ϑϩʔશମ
  20. © 2017 LIG inc. 20 B i t b u

    c k e t ͔ Β C o d e D e p l o y ΁ ͷ ಓ ے p u s h͞ΕΔίʔυ
  21. © 2017 LIG inc. 21 ✦ϦϙδτϦͷτοϓσΟϨΫτϦʹ
 b i t b

    u c k e t - p i p e l i n e s . y m l͕ଘࡏ͢Δ ✦C o d e D e p l o y༻ʹ a p p s p e c . y m l͕ଘࡏ͢Δ ✦Amazon ۘ੡codedep loy_ d epl oy.py ͕ଘࡏ͢Δ B i t b u c k e t ͔ Β C o d e D e p l o y ΁ ͷ ಓ ے p u s h͞ΕΔίʔυ
  22. © 2017 LIG inc. 22 B i t b u

    c k e t ͔ Β C o d e D e p l o y ΁ ͷ ಓ ے Pipeline s ͷ࣮ߦ
  23. © 2017 LIG inc. 23 1.Bitb u cke t ͕

    D o c k e rί ϯ ς φ Λ ىಈ 2.b i t b u c k e t - p i p e l i n e s . y m lʹ هࡌ ͞Ε ͨ
 εΫϦ ϓτ ͕ ৭ʑ࣮ ߦ ͞ Ε Δ 3.D o c k e rίϯ ς φͷத Ͱ ର ৅ ί ʔ υ Λz i p Խ 4.co de d e pl o y_ d e p l o y.p y ͕ z i p ϑ Ν Πϧ ΛS3 ΁ 5.co de d e pl o y_ d e p l o y.p y ͕ C o d e D e p l o yΛ Ω ο Ϋ B i t b u c k e t ͔ Β C o d e D e p l o y ΁ ͷ ಓ ے Pipeline s ͷ࣮ߦ
  24. © 2017 LIG inc. 24 B i t b u

    c k e t ͔ Β C o d e D e p l o y ΁ ͷ ಓ ے C o d e D e p l o yͷ࣮ߦ
  25. © 2017 LIG inc. 25 1.Pi pelines ʹΑͬͯC o d

    e D e p l o y͕ىಈ 2.S3 ͔Βର৅ιʔείʔυΛऔಘ 3.ର৅EC2 ʹίʔυΛల։ 4.σϓϩΠ׬ྃ B i t b u c k e t ͔ Β C o d e D e p l o y ΁ ͷ ಓ ے C o d e D e p l o yͷ࣮ߦ
  26. © 2017 LIG inc. ศ ར 26

  27. © 2017 LIG inc. 27 IAM ͷτʔ Ϋ ϯ΍ɺ C

    o d e D e p l o yͷ Ξ ϓ Ϧ έ ʔ γ ϣ ϯ ໊ ͳ Ͳ ͸ɺBit bu ck e t ͷ ઃఆ Ͱ ؀ ڥ ม ਺ ͱͯ͠ อ ࣋ ͢ Δ B i t b u c k e t ͔ Β C o d e D e p l o y ΁ ͷ ಓ ے ิ଍
  28. © 2017 LIG inc. ϋϚ ͬ ͨ ͜ ͱ ʗ

    ݏ ͳ ͜ ͱ 28
  29. © 2017 LIG inc. 29 ҰԠɺ b r a n

    c hτϦ Ψ ͡ Ό ͳ ͘ ͯɺ खಈ ͰP i pel i nes Λ ࣮ ߦ ͢ Δ ํ๏΋ ͋Δ ͕ ɺ࣮ߦ ͢ Δ ৔ ॴ ͕ ί ϛ ο τ ϩ ά ͷ த ϋϚ ͬ ͨ ͜ ͱ ʗ ݏ ͳ ͜ ͱ खಈͰͷσϓϩΠ͕΍Γʹ͍͘
  30. © 2017 LIG inc. 30 ✦ϒϥϯν͝ͱʹS3 ͷόέοτΛ෼͚ΒΕͳ͍ ✦τʔΫϯ΋؀ڥ͝ͱʹ෼͚ΒΕͳ͍ ✦όέ οτʹ্͕ΔϑΝΠϧ໊΋ݻఆత

    ϋϚ ͬ ͨ ͜ ͱ ʗ ݏ ͳ ͜ ͱ Amazon ۘ੡ͷεΫϦϓτ͕ྗෆ଍ e t c … Χ ε λϚΠζ ͠ · ͠ ΐ͏
  31. © 2017 LIG inc. 31 ϋϚ ͬ ͨ ͜ ͱ

    ʗ ݏ ͳ ͜ ͱ Free ϓϥϯͩͱ 5 0 m i n / m o n t h ࣮ ຿ ʹ ͸ ઈ ๬ త
  32. © 2017 LIG inc. 32 ϋϚ ͬ ͨ ͜ ͱ

    ʗ ݏ ͳ ͜ ͱ Free ϓϥϯͩͱ 5 0 m i n / m o n t h ࣮ ຿ ʹ ͸ ઈ ๬ త ద੾ʹ ͓ۚΛ ࢧ෷͍·͠ΐ͏
  33. © 2017 LIG inc. · ͱ Ί 33

  34. © 2017 LIG inc. 34 · ͱ Ί ✦Bi tbucket

    Pip elines Λ࢖͏͜ͱͰɺ
 C I΍ӡ༻Λ؆қԽ͢ΔݟࠐΈ͕͋Δ ✦ͪΌΜͱ࿈ܞͷͨΊͷπʔϧ͕༻ҙ͞Ε͓ͯΓɺ
 ໰୊ͳ࣮͘຿Ͱར༻Ͱ͖͍ͯΔ ✦Free ϓϥϯΛۀ຿Ͱ࢖͏ઌʹ଴ͭͷ͸ࢮ
  35. © 2017 LIG inc. ࠙ ਌ ձ Ͱ ͓ ࿩

    ͠ · ͠ ΐ ͏ 35
  36. © 2017 LIG inc. 36 ࠙ ਌ ձ Ͱ ͓

    ࿩ ͠ · ͠ ΐ ͏ ✦ͱ͸ݴ͑ɺBit bucket ʹ͓ੈ࿩ʹͳ͖ͬͯͨ͜ͱ ✦ݱঢ়ಛʹࠔΔ͜ͱͳ࣮͘຿ӡ༻Ͱ͖͍ͯΔ͜ͱ ✦Bl ue/G ree n σϓϩΠͷ࣮ࡍ ✦ϩʔϧόοΫΛ࣮ӡ༻Ͱ࢖͍·͔͢ʁ
  37. © 2017 LIG inc. ͝ ਗ਼ ௌ ͋ Γ ͕

    ͱ ͏ ͝ ͟ ͍ · ͠ ͨ ɻ 
 L I G ͷ α ʔ Ϗ ε ΋ ɺ Ͳ ͏ ͧ Α Ζ ͠ ͘ ɻ 37