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

普段使ってるインフラ構成などについて

 普段使ってるインフラ構成などについて

AWSとかDocker諸々基本的なところから

Kazuhiro Tamiwa

February 18, 2018
Tweet

More Decks by Kazuhiro Tamiwa

Other Decks in Programming

Transcript

  1. 2 ໨࣍ • ࣗݾ঺հ • શମߏ੒ • Docker • CI

    / AWS ECSσϓϩΠ • CloudFormationʹΑΔઃఆ؅ཧ ࣌ؒ଍Γͳ͍ͷͰলུ͠ͳ͕Βɻɻɻ ؒҧͬͨ͜ͱઆ໌ͯͨ͠ΒऴΘ͔ͬͯ Βͬͦ͜Γڭ͍͑ͯͩ͘͞m(_ _)m
  2. 3 ࣗݾ঺հ • ̠ɽ̨ɽϩδϟʔεגࣜձࣾ • ίʔυϨϏϡʔ໺࿠ • ΞϓϦ։ൃ / ΢Σϒ։ൃ

    / ͦͷଞR&D • ࠷ۙΑ͘࢖͏ݴޠ
 PHP/Ruby/Java/Kotlin/Swift etc Ұॹʹ࡞ͬͨਓ→
  3. 5 Amazon
 Route 53 Application Load Balancer Auto Scaling group

    web app server web app server Amazon S3 
 bucket CloudFront distribution Amazon
 RDS શମߏ੒ Amazon
 RDS multi-AZ ϝʔϧૹ৴ Τϥʔ؂ࢹ CloudWatch Logs ϩʔΧϧ GitLab Runner GitLab ECS ECR GitLab PhalconPHP(PHP7.x) ϩάղੳ
  4. 8 D o c k e r Docker ࣗલͰ։ൃ؀ڥͷ%PDLFSGJMF࡞੒ ࡞੒ͨ͠*NBHFΛ(JU-BC$POUBJOFS3FHJTUSZʹQSJWBUFʹอଘ

    %PDLFS$PNQPTFΛ࡞੒
 ˠ%# "QQMJDBUJPO  3FEJT &MBTUJD4FBSDI4PMS w ։ൃ؀ڥΛॳΊͯࢀՃ͢ΔϦϞʔτͷΤϯδχΞͰ΋3&"%.&͚ͩ Ͱઆ໌ͳ͠ʙ࣌ؒ͘Β͍Ͱߏஙͱ࢖͍ํͷཧղ͕׬ྃ ͦͷ݁Ռ
  5. 9 ։ ൃ ؀ڥ ஈ ֊Ͱ ಘ ΒΕͨ ΋ ͷ

    Docker શһͷ։ൃ؀ڥͷ౷Ұ
 ηοτΞοϓͳͲͷ࣌ؒ୹ॖ
 ςϯϓϨʔτΞϓϦέʔγϣϯΛ࡞੒͢Δ͜ͱͰॳ଎ͷ͋Δ։ൃ
  6. 11 ج ຊ తྲྀ Ε ECSσϓϩΠ GitLab Runner (CI) GitLab

    ECR GitLab Auto Scaling group web app server web app server ECS develop push master push ίϯςφ ΠϝʔδΛ push ίϯςφϦϙδτϦ
  7. 12 Gi t L a b R u nner ECSσϓϩΠ

    $*πʔϧɻϊϦ͸$JSDMF$*΍5SBWJT$*Έ͍ͨͳ͔Μ͡ ઃఆϑΝΠϧ͸ZBNM (JU-BCͷQJQFMJOF͔Β
  8. 14 E C S ECSσϓϩΠ λεΫఆٛΛ࡞੒
 ίϯςφͷ৘ใͷઃఆ
 %PDLFSΠϝʔδͷઃఆ$16ϝϞϦFUD 
 ΫϥελʔΛ࡞੒


    &$·ΘΓઃఆ
 &$ΠϯελϯελΠϓ&#4FUD 
 αʔϏεΛઃఆ͢Δ
 ΫϥελʔͰ࣮ߦͯ͠ҡ࣋͢ΔλεΫఆٛΛઃఆ
 &-#ͷઃఆͳͲ
  9. 19 E C S ɿ σ ϓ ϩ Πϝϯτ Φ

    ϓγϣϯ ECSσϓϩΠ λεΫͷ਺: 4 ࠷খϔϧε཰: 50%ɺ࠷େ཰: 100% [ग़ల] https://aws.amazon.com/jp/ blogs/compute/amazon-ecs- launches-new-deployment- capabilities-cloudwatch- metrics-singapore-and- frankfurt-regions/ λεΫͷ਺ʹैͬͯɺߋ৽࣌ʹλεΫఆٛ ͷΠϯελϯεΛΫϥελʔʹ഑ஔ࣮ͯ͠ ߦঢ়ଶʹ͞ΕΔɻ͜ͷͱ͖4×50%=2୆ͣͭ ߋ৽͞ΕΔɹϩʔϦϯάɾσϓϩΠ
  10. 20 E C S ɿ σ ϓ ϩ Πϝϯτ Φ

    ϓγϣϯ ECSσϓϩΠ λεΫͷ਺: 4 ࠷খϔϧε཰: 100%ɺ࠷େ཰: 200% [ग़ల] https://aws.amazon.com/jp/ blogs/compute/amazon-ecs- launches-new-deployment- capabilities-cloudwatch- metrics-singapore-and- frankfurt-regions/ Πϯελϯε͸8୆·Ͱ࢖͑ΔͷͰɺ 4×100%=4୆͕Ұؾʹߋ৽͞ΕΔ
 ϒϧʔάϦʔϯɾσϓϩΠ
  11. 21 E C S ɿ st a g ingͱprod uctio

    n ECSσϓϩΠ TUBHJOH
 ୆ߏ੒Ͱे෼ͳͷͰɺλεΫͷ਺ɺ࠷খϔϧε཰ɺ࠷େ཰ ͰϩʔϦϯάɾσϓϩΠ QSPEVDUJPO
 O୆ߏ੒ͰɺλεΫͷ਺Oɺ࠷খϔϧε཰ɺ࠷େ཰Ͱϩʔ ϦϯάɾσϓϩΠɻαʔϏεεέʔϧͨ͠Β࠷খϔϧε཰ɺ ࠷େ཰ͷϒϧʔάϦʔϯɾσϓϩΠΛ࠾༻ɻ ׬ྃޙ$*͔Β4MBDL΁ ׬ྃ௨஌
  12. 22 ͸ · Γϙ Π ϯτ ECSσϓϩΠ &-#Λ͋ͱ͔ΒઃఆͰ͖ͳ͍ ΞϓϦέʔγϣϯͱ͔Ϛ΢ϯτͯ͠։ൃͯ͠ΔͷͰɺEPDLFSDQ͠ ͳ͍ͱσϓϩΠ͞Εͨίϯςφ্ͰΞϓϦέʔγϣϯͷྶѹ͕ফ͑

    Δ (JU-BC3VOOFS͸ࣗલͷαʔόʔͰ༻ҙ͢ΔͷͰɺຖճϏϧυͷͨ ͼʹJNBHF͕ͨ͘͞Μ૿͑ΔɻσϓϩΠऴΘͬͨΒEPDLFSSNJ͠ͳ ͍ͱϠόΠɻͲ͏ͤ&$3Ͱอଘ͞Ε·͢͠ɻ