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

Mackerelにおける Cloud Nativeへの取り組みと チームへ与えた変化 / Cl...

Hayato Imai
September 08, 2020

Mackerelにおける Cloud Nativeへの取り組みと チームへ与えた変化 / CloudNative Days Tokyo 2020

Hayato Imai

September 08, 2020
Tweet

More Decks by Hayato Imai

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ • ࠓҪ൏ਓ (id:hayajo_77 / @hayajo) • גࣜձࣾ͸ͯͳ • MackerelνʔϜ

    • SRE https://developer.hatenastaff.com/entry/2019/06/10/120000
  2. 2ͭͷΞϓϩʔν͕ඞཁ • εέʔϥϒϧͳΞϓϦέʔγϣϯͷߏங ◦ ճ෮ੑɺ؅ཧྗɺՄ؍ଌੑͷ͋ΔγεςϜͷߏங ◦ Cloud Native Trail Map,

    Cloud Native Landscape • εέʔϥϒϧͳΞϓϦέʔγϣϯͷӡ༻ ◦ ΞϓϦέʔγϣϯͷ։ൃɺϦϦʔεɺӡ༻ϑϩʔͷ࣮ફ ◦ DevOpsϓϥΫςΟε
  3. Cloud Native΁ͷऔΓ૊ΈͱνʔϜʹ༩͑ͨӨڹ 1. ίϯςφσβΠϯύλʔϯʹΑΔઃܭ 2. ϞχλϦϯάαΠυΧʔͷ։ൃ 3. OpenTelemetryϥΠϒϥϦͷ։ൃ 4. CI/CDͷߏங

    5. Ҡߦ࣌ͷΧφϦΞϦϦʔε 6. SLOΛఆٛ 7. ϚωʔδυαʔϏε΁ͷҠߦ 8. Terraformͷ࠾༻ 9. ো֐ରԠԋश 10. ίϯςφνΣοΫϦετͷ࡞੒ ͦΕͧΕͷऔΓ૊Έ͸ؔ࿈͍͋ͬͯ͠ΔͨΊɺ঺հॱ͸࣮ࡍʹऔΓ૊ΜͩॱংΛ൓ө͍ͯ͠Δ΋ͷͰ͸͋Γ·ͤΜɻ
  4. 1. ίϯςφσβΠϯύλʔϯʹΑΔઃܭ ~΍ͬͨ͜ͱ~ • ίϯςφԽͨ͜͠ͱͰΞϓϦέʔγϣϯઃܭ͕มԽ • ίϯςφσβΠϯύλʔϯʹΑΔઃܭΛߦ͏Α͏ʹͳͬͨ ◦ αΠυΧʔɺΞϯόαμɺΞμϓλͳͲ •

    ίϯςφ୯ҐͰؔ৺Λ෼཭͠ɺσβΠϯύλʔϯʹԊͬͨܗͰػೳ ௥Ճ΍ػೳͷڞ௨Խɺૄ݁߹ԽΛਤͬͨ ◦ ؂ࢹػೳΛ௥Ճ͢ΔΤʔδΣϯτ΍ϝοηʔδΩϡʔͱ΍Γͱ Γ͢ΔϓϩΩγͳͲ
  5. 2. ϞχλϦϯάαΠυΧʔͷ։ൃ ~νʔϜʹ༩͑ͨӨڹ~ • ʮߏஙʯʹ༩͑ͨӨڹ ◦ αΠυΧʔʹ͢Δ͜ͱͰΞϓϦέʔγϣϯʹखΛೖΕΔ͜ͱͳ͘؂ࢹ ػೳΛ௥Ճ ◦ ӡ༻ΤϯδχΞʹΑͬͯσϓϩΠ͞Εͦͷઃఆʹด͍ͯͨ͡؂ࢹػೳ

    ͕ɺ։ൃΤϯδχΞͰ΋؆୯ʹ௥ՃՄೳʹͳͬͨ • ʮӡ༻ʯʹ༩͑ͨӨڹ ◦ ؂ࢹઃఆϑΝΠϧΛશ୆ʹ഑෍ɺઃఆ͢Δඞཁ͕ͳ͘ͳͬͨ ◦ σϓϩΠϑϩʔ͕ίϯςφͷσϓϩΠʹ౷Ұ͞Εͨ
  6. 4. CI/CDͷߏங ~΍ͬͨ͜ͱ~ • Build Stage ◦ ੒Ռ෺ (ΞʔςΟϑΝΫτ) Λ࡞੒͢Δεςʔδ

    ◦ ςετɺίϯςφΠϝʔδͷϏϧυɺϦϙδτϦ΁ͷPUSH ◦ GitHub Actions (or Jenkins) • Release Stage ◦ ੒Ռ෺ΛϦϦʔε͢Δεςʔδ ◦ PUSH͞ΕͨίϯςφΠϝʔδͷσϓϩΠ ◦ CodePipeline + CodeDeploy
  7. GitHub GHA or Jenkins Code Pipeline Code Deploy ECS ECR

    S3 Build Stage Release Stage 4. CI/CDͷߏங ~΍ͬͨ͜ͱ~ Test/Build Push Image Put Metadata Get Metadata Start Deployment Deploy Pull Image
  8. 5. ҠߦظؒͷΧφϦΞϦϦʔε ~΍ͬͨ͜ͱ~ Code Pipeline Code Deploy ECS Lambda ALB

    TG For EC2 TG For ECS Start Deployment Deploy Run Collect Task IPs Modify Listener Rule Register Task IPs Weighted Routing
  9. 5. ҠߦظؒͷΧφϦΞϦϦʔε ~νʔϜʹ༩͑ͨӨڹ~ • ʮӡ༻ʯʹ༩͑ͨӨڹ ◦ ECSҠߦظؒʹ͓͚ΔϦϦʔεͷϦεΫ͕ݮͬͨ ▪ ෆ۩߹͕͋ͬͨ৔߹Ͱ΋ૣ͍ஈ֊Ͱؾͮ͘͜ͱ͕Ͱ͖ͨ ▪

    ΞϓϦέʔγϣϯઃఆΛ੾Γସ͑Δඞཁͳ͘ɺ WeightedRoutingͷൺ཰Λઃఆͯ͠σϓϩΠ͠௚͚ͩ͢Ͱ؆ ୯ʹݩͷঢ়گʹ໭͢͜ͱ͕Ͱ͖ͨ
  10. 6. SLOΛఆٛ ~νʔϜʹ༩͑ͨมԽ~ • ʮӡ༻ʯʹ༩͑ͨӨڹ ◦ Ҡߦ࣌ͷ੒ޭ཰΍ϨΠςϯγʹΑΔ੾Γ໭͠൑அ ▪ ΧφϦΞϦϦʔεͷൺ཰΍੾Γ໭͠ͳͲ ◦

    ϞχλϦϯά͍ͨ͠ϝτϦοΫ(SLI)͕໌֬ʹͳͬͨ ▪ ϞχλϦϯάαΠυΧʔ΍OpenTelemetryͰՄࢹԽ ◦ ࠓ·Ͱ঺հͨ͠औΓ૊Έ಺༰ͱSREͷݪଇ͕૬ޓʹ࡞༻ͯ͠ӡ༻ ΛճͤΔΑ͏ʹͳͬͨ
  11. 7. ϚωʔδυαʔϏε΁ͷҠߦ ~΍ͬͨ͜ͱ~ • ʮAWS Purpose-Built Databases WeekʯͰElastiCache΁ͷҠߦࣄ ྫΛ঺հ •

    ʰMackerelͷ࣌ܥྻσʔλϕʔεʹ͓͚ΔRedis Clusterͷར༻ ͱAmazon ElastiCache΁ͷҠߦʹ͍ͭͯʱ • https://speakerdeck.com/astj/aws-purpose-built-databases-week
  12. 7. ϚωʔδυαʔϏε΁ͷҠߦ ʙ νʔϜʹ༩͑ͨมԽ ʙ • ʮߏஙʯʹ༩͑ͨӨڹ ◦ ෳࡶͳϓϩϏδϣχϯάπʔϧɺσϓϩΠπʔϧ͔Βͷ୤٫ ◦

    CloudFormation, TerraformͳͲͷϚωʔδυαʔϏεͱ਌࿨ੑͷߴ͍ πʔϧʹΑͬͯߏஙָ͕ʹͳͬͨ • ʮӡ༻ʯʹ༩͑ͨӨڹ ◦ εέʔϥϒϧͰߴՄ༻ͳγεςϜΛ࣮ݱ ◦ ؅ཧʹඞཁͳखॱ΍ೳྗ͕গͳ͘ͳͬͨ ◦ ΩϟύγςΟϓϥϯχϯά͕΍Γ΍͘͢ͳͬͨ
  13. 8. Terraformͷ࠾༻ ~΍ͬͨ͜ͱ~ • ͜Ε·Ͱ͸ෳ਺ͷπʔϧΛ࢖ͬͯΠϯϑϥߏங͍ͯͨ͠ ◦ CloudFormation, Chef, CapistranoͳͲ •

    ϚωʔδυαʔϏε΁Ҡߦ͢Δ͜ͱͰIaC͠΍͍͢౔୆͕Ͱ͖ͨ • ϚϧνΫϥ΢υରԠΛߟྀͯ͠TerraformΛ࠾༻ͨ͠
  14. 8. Terraformͷ࠾༻ ~νʔϜʹ༩͑ͨมԽ~ • ʮߏஙʯʹ༩͑ͨӨڹ ◦ σϓϩΠ·ΘΓ΋ϚωʔδυαʔϏεʹҠߦͨ͜͠ͱͰ։ൃΤϯδχ Ξʹ΋Θ͔Γ΍͍͢ίʔυԽ͕ਐΜͩ ◦ ෳ਺ͷ؀ڥͰಉ͡Α͏ʹ࡞੒͢ΔϦιʔεఆٛΛϞδϡʔϧͱͯ͠ڞ

    ௨Խ͢Δ͜ͱͰߏஙͷෛ୲͕ݮͬͨ • ʮӡ༻ʯʹ༩͑ͨӨڹ ◦ γεςϜߏ੒ΛϦϙδτϦ؅ཧͯ͠։ൃϑϩʔʹࡌͤΔ͜ͱͰɺ։ൃ ΤϯδχΞͰ΋มߋ͠΍͘͢ͳͬͨ