2019/02/27 PHP勉強会 #135 PHPでCI・CD

B51ca7a51ae1fd06bc536fe83e6113e2?s=47 Kaz Watanabe
February 27, 2019

2019/02/27 PHP勉強会 #135 PHPでCI・CD

B51ca7a51ae1fd06bc536fe83e6113e2?s=128

Kaz Watanabe

February 27, 2019
Tweet

Transcript

  1. @ k a z _ 2 9 2 0 1

    9 / 2 / 2 7 @ p h p ษ ڧ ձ # 1 3 5 P H P Ͱ C I / C D ʙ ࠷ ۙ ͜ Μ ͳ ײ ͡ Ͱ ΍ ͬͯ · ͢
  2. W H O ? ౉ลҰ޺(@kaz_29) גࣜձࣾϋʔτϏʔπ ։ൃࣄۀ෦ WebΞϓϦέʔγϣϯͷ։ൃ iOS/AndroidΞϓϦέʔγϣϯͷ։ൃ Ϋϥ΢υΠϯϑϥͷߏஙɾӡ༻

  3. None
  4. P o d c a s t ࢝ Ί ·

    ͠ ͨ ʂ #hbsakaba
  5. – J O H N N Y A P P

    L E S E E D “we are hiring”
  6. C I / C D

  7. C I / C D • CI - Continuous Integration

    • ܧଓతΠϯςάϨʔγϣϯ • CD - Continuous Delivery • ܧଓతσϦόϦʔ
  8. “CI/CD͸1ͭͷٕज़Λࢦ͢΋ͷͰͳ͘ɺιϑτ ΢ΣΞͷมߋΛৗʹςετͯࣗ͠ಈͰຊ൪؀ڥʹ ϦϦʔεՄೳͳঢ়ଶʹ͓ͯ͘͠ɺιϑτ΢ΣΞ։ ൃͷख๏”

  9. Q u e s t i o n ? C

    I / C D ࣮ ફ ͯ͠ ͍ Δ ํ
  10. ग़ ձ ͍

  11. 2 0 1 2 / 1 1 / 0 3

  12. None
  13. https://www.ryuzee.com/contents/blog/6102 https://slide.meguro.ryuzee.com/slides/59

  14. ࣮ ફ ͠ ͨ • 2012-10-01 - CakePHP2࣮ફೖ໳͕Ͱ·ͨ͠(deployͷষΛॻ͍ͨ) • http://kaz29.hatenablog.com/entry/2012/10/01/100150

    • 2012-10-30 - ࠓ࣌ͳCakePHPͰͷ։ൃ؀ڥʂʁ • http://kaz29.hatenablog.com/entry/2012/11/30/173424 • 2013-04-30 - ʮCIΛ൒೥ؒ·Θͯ͠Έͯʯͱ͍͏͓୊ͰLTΛ͖ͯ͠·ͨ͠ • http://kaz29.hatenablog.com/entry/2013/04/30/122642 • 2013-04-30 - ʮCakePHPͰֶͿܧଓతΠϯςάϨʔγϣϯʯ- CakePHPΛ࢖ͬͯܧଓ తΠϯςάϨʔγϣϯΛ࣮ફ͢Δͳ͕ΕΛղઆͨ͠ॻ੶͕ग़൛͞Ε·͢ • http://kaz29.hatenablog.com/entry/2014/09/03/095358
  15. None
  16. C I / C D ؀ ڥ ͷ ม ભ

    / ; Γ ͔͑Γ
  17. # 1

  18. # 1 • Jenkins • εςʔδϯάαʔόʹ͍͋ͷΓ • ઐ༻CIαʔό • Capistrano2

    • εςʔδϯά͸ࣗಈߋ৽ • ։ൃ؀ڥ • Mac্ͷApache/PHP
  19. # 2

  20. # 2 • CircleCI(v1) • UnitTest • Capistrano • ࣗಈσϓϩΠ͸΍ͬͯͳ͍

    • ։ൃ؀ڥ • Vagrant (+Chef)
  21. # 3

  22. # 2 • CircleCI(v1) • UnitTest • dockerԽ • Ansistrano

    • ࣗಈσϓϩΠ͸΍ͬͯͳ͍ • ϓϩϏδϣχϯάͱಉ͡πʔϧ • ։ൃ؀ڥ • Vagrant+Ansible • Docker
  23. # 4 ʙ N O W

  24. # 4 ʙ N O W • AWS CodePipeline •

    Azure DevOps
  25. A W S C o d e P i p

    e l i n e
  26. A W S C o d e P i p

    e l i n e • Docker imageͷbuild • ECR΁ͷPush • Deploy • ECS(Fargate)΁ͷB/G deploy • खಈapproveͰB/GΛswap
  27. S A M P L E AWS CodePipeline + ECS

    Fargate
  28. S a m p l e https://github.com/aws-samples/ecs-blue-green-deployment/tree/fargate

  29. A W S C o d e P i p

    e l i n e
  30. A W S C o d e P i p

    e l i n e
  31. A W S C o d e P i p

    e l i n e https://docs.aws.amazon.com/ja_jp/codebuild/latest/userguide/sample-docker.html buildspec.yml sample
  32. A z u re D e v O p s

  33. A z u re D e v O p s

    • Visual Studio Team ServicesʢVSTSʣΛϦϒϥϯυͯ͠࠶ߏஙͨ͠αʔϏε • ։ൃऀ5໊·Ͱ͸ແྉͰ࢖͑Δ(10Ϣʔβ ¥3,360/݄) • Ұݸͷδϣϒ (1,800෼/݄·Ͱ) • ͔Μ͹ΜϘʔυ • GitϦϙδτϦແ੍ݶ(Githubͱ΋࿈ܞՄೳ) • ؔ܎ऀແ੍ݶ(ϦϙδτϦ͸ݟΕͳ͍) • Visual Studio αϒεΫϥΠόʔ͸Χ΢ϯτ͞Εͳ͍
  34. A z u re D e v O p s

    • Azure Boards -> ͔Μ͹ΜϘʔυ • Azure Pipelines -> CI/CDͷ࣮ߦϓϥοτϗʔϜ • Azure Repos -> Git ϦϙδτϦ • Azure Test Plans -> ୳ࡧςετ(?) • Azure Artifacts -> ύοέʔδϦϙδτϦ
  35. A z u re D e v O p s

    • Git repository • ͔Μ͹ΜϘʔυ • Build pipeline • UnitTest • Docker imageͷbuild • ACR΁ͷpush • AKS΁ͷB/G deploy • खಈapproveͰGreenΛstage
  36. S A M P L E Azure DevOps + Azure

    Kubernetes Service(AKS)
  37. S a m p l e

  38. A z u re D e v O p s

  39. A z u re D e v O p s

  40. A z u re D e v O p s

  41. A z u re D e v O p s

  42. A z u re D e v O p s

  43. A z u re D e v O p s

  44. · ͱ Ί

  45. · ͱ Ί • CI/CD؀ڥͷӡ༻͸݁ߏେม • ࡞Γͬͺͳ͠ʹ͢Δͱࢮ͵ • ཁ݅తʹڐ͢ͳΒSaaSָ͕ •

    Ϋϥ΢υϕϯμඪ४ͷ΋ͷΛ࢖͏ͱศར • ݸਓతʹAzure DevOpsΦεεϝ
  46. ࠙ ਌ ձ Ͱ օ ͞ Μ Ͳ Μ ͳ

    ײ ͡ ͔ ੋ ඇ ฉ ͔ ͤ ͯ͘ ͩ ͞ ͍ ʂ ͓͠·͍