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

201909-PHPCon北海道-PHPでCI_CD.pdf

B51ca7a51ae1fd06bc536fe83e6113e2?s=47 Kaz Watanabe
September 21, 2019

 201909-PHPCon北海道-PHPでCI_CD.pdf

B51ca7a51ae1fd06bc536fe83e6113e2?s=128

Kaz Watanabe

September 21, 2019
Tweet

Transcript

  1. PHPͰCI/CD ࢲ͸࠷ۙ͜Μͳײ͡Ͱ΍ͬͯ·͢ Θͨͳ΂@kaz_29 @PHPΧϯϑΝϨϯε๺ւಓ 2019

  2. WHO? ౉ลҰ޺(@kaz_29) גࣜձࣾϋʔτϏʔπ ։ൃࣄۀ෦ WebΞϓϦέʔγϣϯͷ։ൃ iOS/AndroidΞϓϦέʔγϣϯͷ։ൃ Ϋϥ΢υΠϯϑϥͷߏஙɾӡ༻

  3. None
  4. None
  5. #hbSAKABA podcast΍ͬͯ·͢

  6. ΑΖ͘͠ ͓ئ͍͠·͢

  7. PHPͰCI/CD

  8. Q?

  9. Q CIΛ࣮ફ͍ͯ͠Δਓ?

  10. Q CDΛ࣮ફ͍ͯ͠Δਓ?

  11. CI ܧଓతΠϯςάϨʔγϣϯ

  12. XP - ։ൃͷϓϥΫςΟε • ςετۦಈ։ൃ • ϖΞϓϩάϥϛϯά • ϦϑΝΫλϦϯά •

    ιʔείʔυͷڞಉॴ༗ • ܧଓతΠϯςάϨʔγϣϯ • YAGNI
  13. ܧଓతΠϯςάϨʔγϣϯ • ιʔείʔυ͕मਖ਼͞ΕΔͨͼʹϏϧυΛ࣮ߦ • ςετΛࣗಈ࣮ߦ͠GREENͳঢ়ଶΛอͭ • Ϗϧυઐ༻ͷػࡐ΍αʔϏεΛ࢖͏ • ϝτϦοΫΛऔಘ͢Δ

  14. CD ܧଓతσϦόϦʔ

  15. ܧଓతσϦόϦʔ CIͰςετ͞Εͨιϑτ΢ΣΞΛ ࣗಈతʹϦϦʔε͢Δ https://www.amazon.co.jp/dp/4048707876

  16. ܧଓతσϦόϦʔ • ϓϩδΣΫτ։͔࢝࣌ΒࣗಈԽ͢Δ • ͢΂ͯͷ؀ڥΛಉ͡ํ๏ͰσϓϩΠ͢Δ CDͷϓϩηεࣗମ͕܁Γฦ͠ςετ͞ΕΔ͜ͱʹͳΔ

  17. CI/CDΛ࢝ΊΔͨΊʹ • ιʔείʔυͷόʔδϣϯ؅ཧ • σʔλϕʔεϚΠάϨʔγϣϯͷࣗಈԽ • ࣗಈςετ • UnitTest •

    ݁߹ςετ
  18. ͳͥ΍Δͷ͔ʁ

  19. None
  20. https://www.ryuzee.com/contents/blog/6102 https://slide.meguro.ryuzee.com/slides/59

  21. িܸΛड͚ͨ

  22. ͳͥ΍Δͷ͔ʁ • ҆৺ͯ͠ϦϦʔε͍ͨ͠ • ࣗಈςετ • ୭Ͱ΋ϦϦʔεͰ͖Δ • ૉૣ͘ϦϦʔεͯ͠ϑΟʔυόοΫΛ΋Β͏ •

    ૉૣ͘վળͯ͠සൟʹϦϦʔε • ΞϓϦͷঢ়ଶΛ೺Ѳ͍ͨ͠ • ςετͷঢ়گΛอଘ • ੩తղੳ݁Ռͷอଘ
  23. ࣮ફͨ͠ • 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
  24. ࢲ͸࠷ۙ͜Μͳײ͡Ͱ ΍ͬͯ·͢

  25. #1

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

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

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

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

  30. #3 • CircleCI(v2) • UnitTest • dockerԽ • Ansistrano •

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

  32. #4 ʙ ͍· AWS CodePipeline Azure DevOps ΋ͪΖΜଞͷαʔϏε΋࢖ͬͯ·͢

  33. AWS CodePipeline

  34. AWS CodePipeline • AWS͕ఏڙ͢ΔϑϧϚωʔδυͳCI/CDαʔϏε • ෳ਺ͷαʔϏεΛऔΓ·ͱΊΔܗͰߏ੒͞Ε͍ͯΔ CodeCommit / CodeBuild /

    CodeDeploy • AWSͷαʔϏεͱͷߴ͍਌࿨ੑ
  35. None
  36. AWS FargateͰB/G(1) • Cloud Formation • AWS Fargate • Amazon

    Aurora • AWS CodePipeline
  37. https://github.com/aws-samples/ecs-blue-green-deployment/tree/fargate Λϕʔεʹߏங

  38. AWS FargateͰB/G(2) • AWS cdk(Cloud Formation) • AWS Fargate •

    Amazon Aurora • AWS Codepipeline NEW!
  39. None
  40. AWS FargateͰB/G(2) • AWS cdkͰߏங • ϦιʔεߏஙͱύΠϓϥΠϯΛ෼཭Ͱ͖ͨ • CloudFormationΛ௚઀࢖Θͳ͍ •

    ࢖͍׳ΕͨίʔυͰΠϯϑϥΛߏஙͰ͖Δ • IDEͷίʔυิ׬ͷԸܙ
  41. Azure DevOps

  42. Azure DevOps • MS͕ఏڙ͢ΔϚωʔδυͳCI/CDαʔϏε چVSTSΛࡢ೥Ϧϒϥϯυ • ෳ਺ͷαʔϏεͰߏ੒ Board / Repos

    / Pipelines / Artifacts • Azureͷ֤छαʔϏεͱͷ਌࿨ੑ
  43. None
  44. Azure WebAppͰB/G • Azure WebApp for Containers • Azure Container

    Registory • Azure Database for PostgreSQL • Azure DevOps
  45. Azure WebAppͰB/G

  46. Azure AKSͰB/G • Azure Kubernetes Service (AKS) • Azure Container

    Registory • Azure Database for PostgreSQL • Azure DevOps
  47. None
  48. ·ͣ͸΍ͬͯΈΑ͏ʂ

  49. ·ͱΊ

  50. ·ͱΊ • CI/CDΛߏங͢Δͱ҆৺ͯ͠վળΛਐΊΒΕΔ • ୭Ͱ΋ૉૣ҆͘શʹϦϦʔεͰ͖Δ • ঢ়ଶΛ೺ѲͰ͖ΔΑ͏ʹͳΔ(͠΍͘͢ͳΔ) • ؀ڥ͸࣌୅ͱͱ΋ʹมԽ͍ͯ͘͠ •

    PaaSͷར༻͕૿͖͑ͯͨ • Ϋϥ΢υϕϯμʔఏڙͷ΋ͷΛ࢖͏ػձ͕૿͑ͨ
  51. ͓͠·͍ ͜Μͳ෩ʹ΍ͬͯΔͱ͔ɺ͜ΜͳࠔΓࣄ͕͋Δͱ͔ੋඇฉ͔͍ͤͯͩ͘͞ʂ