Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Blue/Green deploymentへの道のり
Search
Hirokazu Sugiuchi
October 20, 2016
Technology
1
120
Blue/Green deploymentへの道のり
2016/10/07 社内勉強会で発表した資料です
Hirokazu Sugiuchi
October 20, 2016
Tweet
Share
More Decks by Hirokazu Sugiuchi
See All by Hirokazu Sugiuchi
FFLT_12.pdf
critical_alert
0
68
AWS認定 ソリューションアーキテクトアソシエイトを受けてきた話
critical_alert
1
350
Hue で始める おうちハック入門
critical_alert
1
2.1k
入門Let's Encrypt
critical_alert
2
2.3k
Mackerelでサーバ監視はじめた話
critical_alert
0
1.6k
Other Decks in Technology
See All in Technology
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
130
アジャイルチームがらしさを発揮するための目標づくり / Making the goal and enabling the team
kakehashi
3
150
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
The Role of Developer Relations in AI Product Success.
giftojabu1
0
140
AGIについてChatGPTに聞いてみた
blueb
0
130
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
520
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
130
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
3
630
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
3.2k
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
600
Featured
See All Featured
Teambox: Starting and Learning
jrom
133
8.8k
KATA
mclloyd
29
14k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Typedesign – Prime Four
hannesfritz
40
2.4k
A Modern Web Designer's Workflow
chriscoyier
693
190k
The Invisible Side of Design
smashingmag
298
50k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Code Review Best Practice
trishagee
64
17k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Designing Experiences People Love
moore
138
23k
Transcript
Blue/Green deploymentͷಓͷΓ 2016/10/07 feedforce Inc. / Hirokazu Sugiuchi
࠷ۙBlue/Green deployment ʹڽͬͯ·͢
ࢥ͍ΛͤΔ͏ͪʹௐͨΓ ͨ͜͠ͱଟ͘ͳ͖ͬͯͨͷ Ͱ͜ͷลͰ Blue/Green deploymentɹ ͱԿ͔ɺ ͲΜͳํ๏Ͱ࣮ݱͰ͖Δͷ͔ ·ͱΊ͓ͯ͜͏ͱࢥ͍·ͨ͠
τϐοΫ • Blue/Green deployment ͱԿ͔ • AWSʹ͓͚Δ Blue/Green ͷํ๏͍Ζ͍Ζ •
Blue/Green deployment ͷಓͷΓ • ʓʓ • ·ͱΊ
Ͱɺͦͦ Blue/Green deployment ͬͯͳΜͩ
Blue/Green deploymentͱ deployͷʹ৽͍͠ڥΛ ༻ҙͯ͠Γସ͑Δํ๏
Blue/Green deployment • Martin FowlerࢯʹΑΔϒϩάΤϯτϦ͕༗໊ • http://martinfowler.com/bliki/ BlueGreenDeployment.html • ຊ൪ڥΛೋͭ(blueڥɺgreenڥɺ)༻ҙͯ͠
৽͍͠όʔδϣϯͷΞϓϦέʔγϣϯ/αʔόΛยํ ͷڥʹσϓϩΠ͠τϥϑΟοΫΛΓସ͑Δɺͱ͍ ͏ϦϦʔεํ๏
AWSʹ͓͚Δ Blue/Green ͷ ํ๏͍Ζ͍Ζ
DNSΓସ͑ํࣜ • DNSϨίʔυͷ͖ઌΛBlue͔ΒGreenεΠον ͢Δ • round robinͰঃʑʹΣΠτΛௐ͠εΠον͢Δ • (ऑ) TTL
ʹҾͬுΒΕΔͷͰίϯτϩʔϧͮ͠Β ͍
ELB + ASG Γସ͑ํࣜ • DNSͻͱͭͷELBΛࢦͨ͠··ͰELBʹͿΒԼ͛Δ ASG ΛεΠον͢Δ • Auto
Scaling ࠷ۙॻ͍ͨQiitaهࣄΛࢀরͯͩ͘͠ ͍͞ • ͜Ε https://feedforce.qiita.com/critical-alert/items/ 1a39749d838d29b5631a
ECSΓସ͑ํࣜ • ίϯςφΛ͏ • ࠓ͞ͳ͍
ҙࣝ
͍·ͷࢲʹ͋Γ͕ͪͳ͜ͱ • Χʔωϧʹ੬ऑੑ͕...ύονͯͨ͋ͱ࠶ىಈ͠ͳ͍ͱ • 1ͮͭ ELB ͔ΒΓ͠ → 1ͮͭͤͬͤͱ yum
update → ࠶ىಈ → ELB ʹ͢ • όοναʔόͦΖͦΖ͍ͬͺ͍͔ͩΒΠϯελϯε1૿͠·͠ΐ͏ • ΠϯελϯεىಈˠChefͰϓϩϏδϣχϯάˠΞϓϦέʔγϣϯίʔυͷσϓϩΠɻ खಈͰΔͷ໘͍ͩ͠... • OSͷΞοϓσʔτ͕͍ͨ͠ • Ξοϓσʔτͯ͠ಈ͔ͳ͘ͳͬͨͲ͏͠Α͏ • ৽͘͠αʔό૿ͨ͠Βͦͷ yum update ͢Δʁ
ͳͥBlue/Green͍͔ͨ͠ • ELBͷ͖ઌΛม͑Δ͚ͩ • θϩμϯλΠϜϦϦʔε • ͕͋Εݩͷڥʹ͢ͱϩʔϧόοΫ • ൿͷλϨΛࢭ͢Δ •
(Immutable Infrastructure)
λϨͷ݅ • Chef Ͱίʔυཧ͞Ε͍ͯͯɺServerspe Λॻ͍ ͍ͯͯ·৽͘͠αʔόཱͯͨΒͪΌΜͱಈ͘ͷ͔ʁ ͱ͍͏ෆ͕͖҆ͭ·ͱ͏ɻ(පؾ͔͠Εͳ͍) • Blue/Green ͩͱڧ੍తʹ৽͍͠αʔόΛཱͯΔ͜ͱ
ʹͳΔͷͰҟৗ͕͋ͬͨͱͯ͠ݪҼٻ͕͍͢͠ • ͍εύϯͰԿཱͯΔ͜ͱͰλϨԽΛ͙
ΠϯελϯεΛࣺͯ͘͢͢Δ • ΠϯϑϥͷίʔυԽ(࠶ݱ͘͢͠Δ) • ૄ݁߹ʹ͓ͯ͘͠ • ফ͑ͯࠔΔϑΝΠϧϩά֎ʹอଘ͢Δ • ࣗಈԽ͕ඞਢ
Blue/Green deploymentɹ ͷಓͷΓ
Γӽ͑ͳ͍ͱ͍͚ͳ͍՝
ʓʓ • AMIͲ͏͢Δ • ΞϓϦέʔγϣϯͷσϓϩΠͲ͏͢Δ • ϩάͲ͏͢Δ
DockerԽ͠·͢
ऴ
!
αʔϏεΠϯ·Ͱͷϓϩηε(ݱࡏ) • 1.ΠϯελϯεΛىಈ͢Δ • 2.ChefͰϓϩϏδϣχϯάΛ͢Δ • 3.CapistranoͰΞϓϦέʔγϣϯίʔυΛɹɹɹ σϓϩΠ͢Δ • 4.ELBʹΠϯελϯεΛͿΒԼ͛Δ
2ͱ3͕͍ɻ ͢ΔͱAMIΛ࡞ΓࠐΉ͔ɹɹ ͱ͍͏ʹͳΔɻ
AMIͲ͏͢Δ • શ෦ೖΓ • OS,ϛυϧΣΞઃఆ,ΞϓϦέʔγϣϯίʔυ • ௨শΰʔϧσϯΠϝʔδ • ͚ͩઃఆࡁΈ •
OS,ϛυϧΣΞͷΈઃఆࡁΈ(ChefͰϓϩϏδϣχϯά͚ͩ͢Δ) • ࠷খߏ(͍·͜͜) • OSͷΈ
શ෦ೖΓ • ҡ࣋͢Δϋʔυϧ͕ߴ͍ • ىಈ͢Δ͚ͩͰαʔϏεΠϯՄೳ͕ͩɹɹɹ ΞϓϦέʔγϣϯίʔυ͕ߋ৽͞ΕΔͨͼʹ AMIΛ࡞Δඞཁ͕͋Δ
͚ͩઃఆࡁΈ • Chef ͰϓϩϏδϣχϯάΛࡁ·ͤͨঢ়ଶͰAMIΛ࡞ ͢Δ • ΞϓϦέʔγϣϯίʔυΑΓߋ৽සগͳ͍ • ىಈ͖ͯͨ͠ΒΞϓϦέʔγϣϯίʔυΛσϓϩΠ͠ ͯαʔϏεΠϯ
• ͳ͔ͳ͔ݱ࣮తͳϥΠϯ
AMIԽPackerΛ͏ https://www.packer.io/
ΞϓϦέʔγϣϯͷσϓϩΠɹ Ͳ͏͢Δ
ΞϓϦέʔγϣϯͷσϓϩΠɹ Ͳ͏͢Δ • ͔ͤͬ͘ϓϩϏδϣχϯάࡁΈͷΠϯελϯε͕ىಈ ͯ͠ίʔυ͕ແ͍ͱαʔϏεΠϯͰ͖ͳ͍ • CapistranoΛखಈͰ࣮ߦ͔… • Auto Scaling
Ͱىಈͨ͠ΒखಈͰ࣮ߦͳΜͯͬͯΒ Εͳ͍ • ࣗ͜͜ಈԽ͠ͳ͍ͱ͍͚ͳ͍
Πϯελϯε͕ىಈͨ͠Βɹ ࣗͰΞϓϦέʔγϣϯίʔ υΛ࣋ͬͯ͘ΔΑ͏ʹ͍ͨ͠
PullܕDeploy • Consul + stretcher (dragonͰ࠾༻) • AWS Code Deploy(֯ߴΊ/MakerͰͬͯ
ͨʁ) • EC2 Run Command(ະௐ͍͍ࠪͱ͜Ζ)
·ͩ·ͩݕ౼தɻ
ϩάͲ͏͢Δ • Fluentd ͓͚͍͍ͬͯ • ࠷ۙͷྲྀΕ Fluentd ܦ༝Ͱ Big Query
• ͔Βͷ Re:dash ͰՄࢹԽͰ͠ΐ͏͔
͜͜·ͰΕ৸ͯΔؒʹ Auto Scaling ͰΠϯελϯε ͕૿͑ͯউखʹαʔϏεΠ ϯͯ͘͠ΕΔ
ࠓ Auto Scaling ಋೖͯ͠Δ ͱ͜ΖͰ͢
Α͏͘ͷ΅Γ͡Ί͔ͨ Γ͔ͩΒͳ ͜ͷͯ͠ͳ͘ɹ ԕ͍Blue/GreenࡔΛΑ (͜ͷΜʹը૾)
͓·͚
ͦΕDockerͰry
ͦΕDockerͰͰ͖ΔΑ • Ҏ্ͷΑ͏ͳ͜ͱΛߟ͍͑ͯΔͱ Docker ͷϙʔλ ϏϦςΟΰΠεʔͬͯؾ࣋ͪʹͳͬͯ͘Δ • ΞϓϦέʔγϣϯίʔυͱΞϓϦέʔγϣϯ࣮ߦ ڥΛίϯςφʹ·ͱΊΔ͜ͱͰ͚ͯߟ͑ͳ͍ͯ͘ ͍Α͏ʹྑ͘ͳΔͷΠΠ
• ΰʔϧσϯΠϝʔδઓ๏ΛͬͯEC2͕ىಈ͢Δ ࣌ؒΛॖ͢Δ͜ͱ΄΅ෆՄೳʹ͍ۙ
·ͱΊ
·ͱΊ • DockerΛ͑ʂ • ΞϓϦέʔγϣϯରԠͰ͖ΔͳΒΔՁ͋Δ • ͋ͱ࠷ॳ͔Β Docker લఏͰ࡞Δ •
Blue/Green deployment ͱԿ͔આ໌ͨ͠ • αʔόΛࣺͯ͘͢͢ΔʹͲ͏͢Δ͔આ໌ͨ͠ • ͍Ζ͍Ζͳ͕͋Δ͜ͱΛઆ໌ͨ͠