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

MDH-LT-Thursday-20170126

A8f802dfbbdd43f6e3be9936c3cbed7f?s=47 Shuhei Kimura
January 26, 2017

 MDH-LT-Thursday-20170126

A8f802dfbbdd43f6e3be9936c3cbed7f?s=128

Shuhei Kimura

January 26, 2017
Tweet

More Decks by Shuhei Kimura

Other Decks in Technology

Transcript

  1. ECS্Ͱಈ͘DockerΞϓϦέʔγϣϯΛTerraformΛ ࢖ͬͯσϓϩΠ͢ΔΑ͏ʹͯ͠Έͨ࿩ Dynalyst System Engineer Shuhei Kimura

  2. DynalystͰ͸γεςϜ͸͢΂ͯAWSͰߏங͞Ε͍ͯ·͢ ֓ཁ - ϦλʔήςΟϯά޿ࠂ഑৴αʔϏεϓϥοτϑΥʔϜͰ͢ɻ - ੈքதͷސ٬ʹαʔϏεΛఏڙ͠·͢ɻ ن໛ײ - RTBͰ͸ɺϐʔΫ࣌໿13ສQPS@Asia/Tokyo Region,

    10ສQPS@US/East Region - ೖࡳαʔό਺͸྆RegionͰ໿120୆ - ܭଌͳͲॾʑؚΊͯEC2 200୆ۙ͘Instance͕Քಇத - ֤छϩά͸͓Αͦ1.5TB/dayΛS3ʹอଘ
  3. Ͳ͏΍ͬͯΞϓϦέʔγϣϯͷϦϦʔεͯ͠·͔͢ʁ ࣮ߦ؀ڥ x σϓϩΠํ๏ = Ұൠతʹͱͯ΋ଟ༷Ͱ͋Δ - Fabric/CapistranoͳͲΛ࢖ͬͯEC2ʹΞϓϦΛϦϦʔε - Apex/aws-cliͳͲΛ࢖ͬͯLambdaFunctionΛϦϦʔε

    - ElasticbeanstalkΛར༻ͯ͠ELB+EC2ߏ੒ͷΞϓϦΛRollingUpdateϦϦʔε - Chef/Ansible/PuppetͳͲͰपล؀ڥؚΊͯprovisionͯ͠ϦϦʔε DynalystͰ͸ɺ͍Ζ͍Ζͳٕज़త௅ઓͷ݁Ռ .. ͍Ζ͍Ζͳ࣮ߦ؀ڥͰ৭ʑͳΞϓϦ͕ಈ͍͍ͯΔঢ়ଶΛ ίπίπFabricͷtaskΛ௥Ճͨ͠Γϝϯςͨ͠Γ͠ͳ͕Βɺ ͳΜͱ͔΍Γ͘Γ͍ͯ͠Δঢ়ଶɻ
  4. σϓϩΠͷ؍఺͔ΒEC2 Container Service ʹະདྷΛײͨ͡ ECS Cluster - αʔόϦιʔε͸ແବͳ͘༗ޮʹ࢖͍ͭͭ ECS Task

    Definition - ʓʓͳΞϓϦΛ ECS Service - XXͳ෩ʹಈ͔͍ͨ͠ ͍ΖΜͳΞϓϦέʔγϣϯΛಈ͔͢େલఏ͕ͱͯ΋౷Ұ͞Εͨঢ়ଶʹͳΔ Batch΋API΋Worker΋Consumer΋͍͍ͩͨECS্Ͱಈ͔ͤΔ DockerContainerԽ͢Δ͜ͱ͕σϓϩΠͷγϯϓϧԽʹܨ͕Δͱ͍͏ߟ͑
  5. ECS Docker ApplicationΛTerraformΛ࢖ͬͯϦϦʔε͠Α͏ ͳΜͰTerraformʁ - ίʔυͰ͔͚Δ - ECSͱͷIntegration͕ͪΌΜͱ։ൃ͞Εͯͨ - ੜͷAPIୟ͘ͷ͸͖ͬͱͲ͔͜Ͱ࠳ં͢Δ,

    retryͱ͔πϥͦ͏ - terraformͷΊΜͲ͍͘͞ͱ͜ΖΛ͋Μ·Γؾʹ͠ͳͯ͘Α͍ 㱺 stateյΕͯ΋ͳΜͱ΋ͳ͍ɻ࠶ߏஙͯ͠deploy͠௚ͤ͹͍͍ɻ - MultiRegionΛߟ͑Δͱɺಉ࣌ʹσϓϩΠͱ͔͕౰ͨΓલʹͳͬͯ͘͸ͣ 㱺 ݁ہͷͱ͜Ζத਎͸AWS APIͳͷͰ౿Έ୆αʔό͍ΒͣͰσϓϩΠͰ͖Δʂ 㱺 CircleCI͔Βterraform࣮ߦ͢Δͱ͔͢Ε͹ɺσϓϩΠ؀ڥߏங΋͍Βͳ͍
  6. ΍ͬͯΈͨΒ͜͏ͳͬͨᶃ ͱΓ͋͑ͣɺTerraform࣮ߦ؀ڥతʹ͸CircleCI೚ͤʹͯ͠ΈΔ

  7. ΍ͬͯΈͨΒ͜͏ͳͬͨᶄ TaskDefinition Service ErrorLogCount LogGroup

  8. ΍ͬͯΈͨΒ͜͏ͳͬͨᶅ ΞϓϦέʔγϣϯ͕ಈ͚ͩ͘Ͱͳ͘ɺͦͷपล΋ؚΊͯ ༻ҙͰ͖Δ఺͸ඇৗʹΘ͔Γ΍ͯ͘͢Α͘ͳͬͨɻ

  9. ෳ਺Regionʹෳ਺ͷAppΛϦϦʔε͢Δͷ΋ɺRollback΋؆୯ ޷͖ͳΑ͏ʹpr͢Δɻ ౰વreviewϑϩʔ࡞ͬͯ΋͍͍ɻ

  10. ·ͱΊ ECS x Terraform ͷ૊Έ߹ΘͤࢥͬͯͨΑΓྑ͛͞ ࠓޙ΋͍Ζ͍Ζͳٕज़͕ग़ͯ͘ΔͷͰɺࢼߦࡨޡ͍ͯ͘͠ ʮSSHͨ͠Βෛ͚ʯΛݱ࣮ͷ΋ͷʹ͢Δ΂͘ϒϥογϡΞοϓ