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
70
AWS認定 ソリューションアーキテクトアソシエイトを受けてきた話
critical_alert
1
360
Hue で始める おうちハック入門
critical_alert
1
2.1k
入門Let's Encrypt
critical_alert
2
2.3k
Mackerelでサーバ監視はじめた話
critical_alert
0
1.7k
Other Decks in Technology
See All in Technology
5分でわかるDuckDB
chanyou0311
10
3.2k
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
220
Opcodeを読んでいたら何故かphp-srcを読んでいた話
murashotaro
0
230
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
160
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
250
kargoの魅力について伝える
magisystem0408
0
210
Qiita埋め込み用スライド
naoki_0531
0
5k
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
1
200
DUSt3R, MASt3R, MASt3R-SfM にみる3D基盤モデル
spatial_ai_network
2
110
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
3
2.3k
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
Wantedly での Datadog 活用事例
bgpat
1
440
Featured
See All Featured
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
The World Runs on Bad Software
bkeepers
PRO
65
11k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
GraphQLとの向き合い方2022年版
quramy
44
13k
KATA
mclloyd
29
14k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
98
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
How GitHub (no longer) Works
holman
311
140k
Unsuck your backbone
ammeep
669
57k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
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 ͱԿ͔આ໌ͨ͠ • αʔόΛࣺͯ͘͢͢ΔʹͲ͏͢Δ͔આ໌ͨ͠ • ͍Ζ͍Ζͳ͕͋Δ͜ͱΛઆ໌ͨ͠