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
Bloxが切り開くECSの世界
Search
Koji Nakayama
August 26, 2017
Technology
1
1.1k
Bloxが切り開くECSの世界
第二回 合同勉強会 in 福岡 の発表資料です。
https://connpass.com/event/60964/
Koji Nakayama
August 26, 2017
Tweet
Share
More Decks by Koji Nakayama
See All by Koji Nakayama
Software Testing in AWS IoT with The Power of Python
knakayama
0
1.5k
The ~~Ten~~ Three Most Critical Security Risks in Serverless Architectures
knakayama
2
1.4k
サーバーレス x IoT 〜我々はどういった課題に直面してそれをどのように解決したのか〜
knakayama
0
1.3k
AWS Serverless Application Modelのデプロイ戦略
knakayama
4
2.3k
github-classmethod-study-20170426
knakayama
1
3.6k
サーバレスアーキテクチャはじめの一歩
knakayama
1
1.3k
Other Decks in Technology
See All in Technology
新R25、乃木坂46 Mobileなどのファンビジネスを支えるマルチテナンシーなプラットフォームの全体像 / cam-multi-cloud
cyberagentdevelopers
PRO
1
130
急成長中のWINTICKETにおける品質と開発スピードと向き合ったQA戦略と今後の展望 / winticket-autify
cyberagentdevelopers
PRO
1
160
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.6k
AWS CDKでデータリストアの運用、どのように設計する?~Aurora・EFSの実践事例を紹介~/aws-cdk-data-restore-aurora-efs
mhrtech
4
640
Nix入門パラダイム編
asa1984
2
200
IaC運用を楽にするためにCDK Pipelinesを導入したけど、思い通りにいかなかった話
smt7174
1
110
バクラクにおける可観測性向上の取り組み
yuu26
3
410
[JAWS-UG金沢支部×コンテナ支部合同企画]コンテナとは何か
furuton
3
240
Shift-from-React-to-Vue
calm1205
3
1.3k
LeSSに潜む「隠れWF病」とその処方箋
lycorptech_jp
PRO
2
120
2024-10-30-reInventStandby_StudyGroup_Intro
shinichirokawano
1
620
MAMを軸とした動画ハンドリングにおけるAI活用前提の整備と次世代ビジョン / abema-ai-mam
cyberagentdevelopers
PRO
1
110
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
65
4.4k
Measuring & Analyzing Core Web Vitals
bluesmoon
1
40
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Intergalactic Javascript Robots from Outer Space
tanoku
268
27k
Facilitating Awesome Meetings
lara
49
6k
Designing for humans not robots
tammielis
249
25k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Producing Creativity
orderedlist
PRO
341
39k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Making the Leap to Tech Lead
cromwellryan
132
8.9k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.6k
Unsuck your backbone
ammeep
668
57k
Transcript
Blox͢ڔΠ樄ͥECS΄Ӯኴ ᒫԫࢧ ݳݶۣ䔶տ in ᐰ䍫 #gbfukuoka 2017/08/26 Ӿઊ ଛလ 1
ᛔ૩奧Օ • Ӿઊ ଛလ • μ϶φϮϊϐϖ ϯϝαϸίϤϷςЄϠφ᮱ AWSϊϷϲЄτϴЀίЄκϓμϕ • AWSΨڥአͭ͵αЀϢ϶΄戔懯/䯤塈
• GitHub: knakayama • 奺䵉 • ηЀϤϹςЄϝ΄晁አ3ଙ • AWSΚΠ͵͡͵΄ͽμ϶φϮϊϐϖ敢实 • ๋ᬪϯϝαϸίϤϷςЄϠφ᮱Ύ吖㵕 2
ίυδЀύ 1. ECS΄ͫ͠Ο͚ 2. Blox΄扖 3. Δ;Η 3
෭΄ρЄϸ • ECS/Bloxͺ͚ͼᎣΡ • Blox΄ਂࣁఽ͢ᡀ͚΄ͽ ECSΨֵ͜ӤͽBlox;͚͜晝䝑ᙏ͢ਂ ࣁͯΡͩ;ΨᎣΡ • ེ๗ϷϷЄφݻͧBlox΅嘦䋚昲۸ͭͼ͚Ρ΄ͽͳ΄๗இఽ ΨوํͯΡ
4
1. ECS΄ͫ͠Ο͚ 5
ͳ΄ڹ ͳΘͳΘΩͽECSֵ͜΄͡ 6
ςЄϝϹφͮΙͶΗΩͽͯ͡ ! 7
ςЄϝϹφ is • ϜϫΡ䦒΅๋ṛ ! • ͽΘݻͣӧݻͣ͘ΠΔͯΞ • ϢϹЄϭϼЄμֵ͚͵͚ΩͽͯͧͿ •
RDSֵ͚͵͚ΩͽͯͧͿ • Ϳͭ͜ͼΘګᴴ͢… • ϫϚЄυϖςЄϠφ΄ͽϳЄσ㯎ͽͽͣΡͩ;͢ᴴΟΡ • ق᮱Lambdaضኞ͠氎͚ͽͣ͵Ο๋ṛͶͧͿ柞΄䔺ԃ΅͚ 8
ECS΄͚ͭ͜;ͩΣ • ϳЄσͽᓕቘͽͣΡ᮱ړ;AWS͠Δ͡ͱͽͣΡ᮱ړ΄䂜͢Ξ͚ • Devፓ娄 • πЀϓϗͽ㵕֢ͫͱΡϊЄφπЄϖ;DockerfileΨᓕቘͯΆ͚͚ • Opsፓ娄 •
ϔϤϺα͢䮭 → αϮЄυ֢ͼϔϤϺαͯΆECS͢ΞͭΚͼͥΡ • CloudFormationͽᓕቘͽͣΡ;ͩΣΘΞ͚ • ٖ᮱ጱEC2ֵͼΡ΄ͽϳЄσ㯎ͽϷϊЄφ䃀ΚͱΡ • Lambda/API GatewayͶ͵ΟͿ͜ΡҘ • ECSᛔ֛΅僻ා 9
ECS༷ᥝ • AWSͽDockerπЀϓϗΨᓕቘͯΡ͵Η΄ϫϚЄυϖςЄϠφ • DockerπЀϓϗΨ֜㳌/Ϳ͜ΚͼᯈᗝͫͱΡ΄͡ • ՜AWSςЄϠφ;昧൭ͭͼπЀϓϗΨᓕቘͽͣΡ • Auto Scaling
Group/CloudFormation/CloudWatch/etc... • ECSᛔ֛΅僻ාͽڥአݢᚆ • ՜΄AWSςЄϠφ䌏ͯΡ抓ᰂ • ԆEC2/S3 10
ECS΄ͫ͠Ο͚(ͳ΄1) • πЀϓϗαЀφόЀφ • Amazon ECS container agent͢㵕֢ͯΡEC2αЀφόЀφ • πЀϓϗαЀφόЀφӤͽDockerπЀϓϗ͢㵕֢ͯΡ
• Ӟᛱጱ΅Amazon ECS container agent͢αЀφϕЄϸͫ͵ECS-optimized AMI͡Ο᩸㵕ͫͱΡ • चጱDockerπЀϓϗ͢ڥአͯΡϷϊЄφ΄ϤЄϸ;ͭͼᘍ͞ͼᜉ͚ • μ϶φό • 1ͺզӤ΄πЀϓϗαЀφόЀφᮭ • DockerπЀϓϗ΅μ϶φόٖ΄ϷϊЄφ(CPU/ϮϯϷͿ)Ψڥአͭͼ䋚ᤈͫΡ 11
ECS΄ͫ͠Ο͚(ͳ΄2) • όφμਧ嬝 • Ϳ͚͜͵戔ਧͽDockerπЀϓϗΨ᩸㵕ͫͱΡ͡΄ਧ嬝 • Ϳ΄αϮЄυ͡ΟDockerπЀϓϗΨ᩸㵕ͫͱΡ͡ • Ϳ΄ᑕଶμ϶φόٖ΄ϷϊЄφ(CPU/ϮϯϷ)Ψֵ͞Ρ͡ •
etc... • όφμ • όφμਧ嬝चͻͣ᩸㵕ͭ͵DockerπЀϓϗ 12
ECS΄ͫ͠Ο͚(ͳ΄3) • ECR(Elastic Container Registry) • IAMचͻͣίμψφګகݢᚆϫϚЄυϖϤ϶αϦЄϕϷ ϪυϕϷ • ӞᛱጱECSͽᇿᛔ΄αϮЄυΨڥአͯΡ䁰ݳ΅ECRΨֵ͜
• כਂͭ͵αϮЄυςαχ䖕ͮͼ抓ᰂͫΡ • ٖ᮱ጱS3͢ڥአͫͼ͚Ρ 13
㾩ͯΡ;ͩΩఽͮ 14
ECS΄Ԇᥝ༷ஷ(ͳ΄4) • ςЄϠφ • ECSͧ͠ΡφξυϲЄ϶(;ᘍ͞ͼΘय़ͣͥϜχϹͼ͚) • ςЄϠφΨ᭗ͭͼόφμΨ᩸㵕ͫͱΡͩ;ͽόφμΨ๗இͭ͵ᇫ䙪φξυϲЄϷЀνͭͼͥΡ • ͚ͥͺόφμΨ᩸㵕ͫͱΡ͡/Ϳ΄πЀϓϗαЀφόЀφόφμΨᯈᗝͯΡ͡Ϳ •
όφμᯈᗝ䜐ኼ/όφμᯈᗝګᴴ • ςЄϠφ͡Ο᩸㵕ͯΡόφμΨͿ͚͜͵ϸЄϸͽμ϶φόӤᯈᗝͯΡ͡ • μ϶φό΄ϷϊЄφၾ揲ᰁ๋͢ੜΡΞͭ͜͵͚(όφμᯈᗝ䜐ኼ) • ṛ͚αЀφόЀφόαϤ΄πЀϓϗαЀφόЀφ΄Εᯈᗝͫͱ͵͚(όφμᯈᗝګᴴ) • ՜Θ奞ͥ͡ਧݢᚆ 15
ECS΄Ԇᥝ༷ஷ(ͳ΄5) • όЄοϐϕνϸЄϤ(㷗ੂ΅ALB΄༷ஷ) • ALB͡Οόφμϕ϶ϢΰϐμΨϸЄϓΰЀνͯΡ͵Η΄㶨֖ • όЄοϐϕνϸЄϤ΅ςЄϠφ;樛昧՞ͧͫݱόφμϕ϶Ϣΰϐμ͢ၞΡ • ALB΅όЄοϐϕνϸЄϤΎ΄ϥϸφώδϐμΨ᭗ͭͼςЄϠφϔΰφθϝϷΨ䋚匍ͯΡ •
ύαϗϬϐμϨφϕϪЄϕϫϐϡЀν • πЀϓϗαЀφόЀφ;όφμͽڥአͯΡϪЄϕΨ㵕ጱϫϐϡЀνͭͼͥΡ䱛ᚆ • ͚ͩ͢;ݶͮϪЄϕΨڥአͯΡόφμ͢ݶӞπЀϓϗαЀφόЀφͽ᩸㵕ͽ͚ͣ • CLB΅䌏䖕ͭͼ͚ 16
㾩ͯΡ;ͩΩఽͮ 17
ECS΄Ԇᥝ༷ஷ(ͳ΄6) • ECS Events • ECSٖ΄ᇫ䙪䄜۸᩸ͣ͢͵䁰ݳCloudWatch EventsΎͫΔͬΔ αϦЀϕΨᭆͼͥΡ • πЀϓϗαЀφόЀφ/όφμ᩸͢㵕
or ؊ྊͭ͵/etc... • ՜΄AWSςЄϠφΨόЄοϐϕͯΡͩ;ͽαϦЀϕϖϷϣЀ㳌 ቘ͢ݢᚆ • Slack᭗ᎣͯΡ/ෛ͚ͭόφμΨ᩸㵕ͫͱΡ/etc... 18
2. Blox΄扖 19
Blox༷ᥝ • ECSͽ㵕֢ͯΡπЀϓϗ΄θφόϭφξυϲЄ϶ • ECS㶨֛ͽ΅櫞͚ͭφξυϲЄϷЀνΨ䋚匍ͽͣΡ • 2016ଙ΄re:Inventͽ咲ᤒͫ͵ • Apache2.0΄ηЄϤЀϊЄφϤϺυδμϕ •
v0.3.0;v1.0͢ਂࣁ • 匍ࣁv1.0Ύ妣搒ᑏᤈӾ • v1.0΅ΔͶྋୗϷϷЄφͫͼ͚ https://github.com/blox/blox 20
v0.3.0;v1.0΄晅͚ • v0.3.0΅ϊЄφπЄϖل樄ͭ͵͡ΟΕΩͽ樄咲ͭͼ͚ͩ͜Ͳ;͚͜ఽͮ • Go䋚ᤰ • Bloxአ΄厏हΨᛔړͽ֢Ρᥝ͘͢Ρ • Deprecated •
v1.0΅ϫϚЄυϖςЄϠφΨፓͭͼ͚Ρ • ͺΔΠ ECS΄䱛ᚆ;ͭͼ׀ͫΡ (Ԩਧ) • ϫϚυϮЀϕπЀϊЄϸ/CLI/SDKs͡Ο֢ݢᚆ(Ԩਧ) • Java䋚ᤰ https://github.com/blox/blox/blob/dev/FAQ.md 21
v0.3.0;v1.0ͽ΅Ͷ͚Ό晅͜΄ͽ ړͧͼ抍กͭΔͯ 22
ͳ΄ڹͲθφόϭφξυϲЄ϶ ͢ᥝ΄͡ ! 23
ECS΅ͯͽԆᥝφξυϲЄϷЀ νොୗΨςϪЄϕͭͼ͚Ρ 24
όφμᯈᗝ䜐ኼ 䜐ኼ ޱ binpack μ϶φό΄CPU/ϮϯϷၾ揲ᰁ๋͢ ੜ;ΡΞ͜όφμΨᯈᗝ random μ϶φόόφμΨ϶Ѐύϭͽᯈᗝ spread ਧͭ͵ં
/ instanceId / host ࣐͢ᒵΡΞ͜όφμΨᯈᗝ http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html 25
όφμᯈᗝګᴴ ګᴴ ޱ distinctInstance όφμ͢吖ΡπЀϓϗαЀφ όЀφᯈᗝͫΡΞ͜ګᴴ memberOf Cluster Query Languageͽᤒ匍
ͭ͵ୗΨ伋͵ͯΞ͜όφμ΄ ᯈᗝΨګᴴ http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html 26
ͳ΄՜ • ςЄϠφ΄Desired Countͽ๕ͯΡόφμහΨ姘೮ • ALB/CLB΄ϥϸφώδϐμΨڥአͭ͵ςЄϠφϔΰφθϝϷ • CloudWatch Metricsचͻ͚͵ςЄϠφ΄ηЄϕφξЄϷЀν •
RunTask or StartTask APIͽձ΄όαϬЀνͽόφμΨ᩸㵕 • cron୵ୗͽᇙਧ΄䦒樌όφμΨ᩸㵕 http://docs.aws.amazon.com/AmazonECS/latest/developerguide/scheduling_tasks.html 27
ϔϢζϸϕ΄φξυϲЄ϶ͽ΅ᥝկΨ伋͵ͭ ͚ͥ䁰ݳ • μ϶φό΄ᇫ䙪䖕ͮ͵αϦЀϕϖϷϣЀόφμ΄ᯈᗝ • πЀϓϗαЀφόЀφ᩸͢㵕/؊ྊͭ͵ΟόφμΘ᩸㵕/؊ྊͯΡ • ΞΠ愢櫏ϥϸφώδϐμचͻ͚͵όφμ΄ᯈᗝ • ALB΅HTTP(S)ϹϦϸ΄ϥϸφώδϐμͭ͡ͽ͚ͣ
• CLBͽ΅φξЄϸ͚ͭͥ(ύαϗϬϐμϨφϕϪЄϕϫϐϡЀν๚䌏䖕 ΄ͽ) 28
BloxΞͼ๗இͽͣΡͩ; • θφόϭφξυϲЄ϶Ψ樄咲ͭͼ͚ͥच哷;ΠΡ • ෬ਂAWSςЄϠφΨ奲ΕݳΥͱͼᇿᛔφξυϲЄ϶Ψ֢౮ͯΡͩ;΅ݢᚆ • ͚ͭͭ͡ͷ͚ͷᛔړͽ՛奲ΕΨ֢Π旿Ζᥝ͘͢Ρ • ηЄϤЀϊЄφͯΡͩ;ΞΠπϬϲϘϓΰϦЄφͽ樄咲ͽͣΡ •
՜΄Ո֢͢͵φξυϲЄ϶Ψ䌙فͯΡΕ͵͚ͩ;ΘͽͣΡ෭͢Ρ͡Θ • ECS΄䱛ᚆ΄ӾͽθφόϫαχͽͣΡ • KubernetesΘ͚͚ͧͿՈ(AWS)΄ᙒ㪥Π͵͚ 29
ྋፗ͚͜;ϔϢζϸϕφξυϲЄ ϶ͽᥝկ伋͵ͱ͚厏ह᭺᭬ͭ͵ ͩ;΅ΔͶ͚ ! 30
v0.3.0ͺ͚ͼ 31
v0.3.0΄༷ᥝ • μ϶φό΄ᇫ䙪ᓕቘ;ςЀϤϸ;ΡφξυϲЄ϶͢ݶ䬕 • cluster-state service → ᇫ䙪ᓕቘ • daemon-scheduler
→ φξυϲЄ϶ • ͩΟΨREST APIͽ֢ݢᚆ • ϺЄθϸPC/AWSϔϤϺαݢᚆ • DockerαϮЄυΘአͭͼͥͼ͚Ρ • ᛔړͽGoΨπЀϞαϸͯΡͩ;ΘݢᚆͶ͢πЀϓϗͽ㵕ͯ͡;͠ಋ敽 • 厏हΨ䯤塈ͯΡ͵Η΄ςЀϤϸCloudFormationϓЀϤϹЄϕΘ͘Ρ • DeprecatedͶ༷͢ஷᛔ֛΅v1.0;֒ͼ͚Ρ΄ͽ݇ᘍΡ 32
cluster-state service • μ϶φό΄ᇫ䙪ΨϷίϸόαϭᓕቘ • μ϶φόෛ͚ͭπЀϓϗαЀφόЀφ/όφμ᩸͢㵕 or ؊ྊͭ͵Ϳ • ͩΟ΄ఘ䁭Ψetcdכਂ
• cluster-state service΄ఘ䁭Ψڥአͭͼᛔړ΄厏हݳ͵φξυϲЄ϶͢䋚ᤰݢᚆ • 㶨֛ͽ΅μ϶φό΄ᇫ䙪ᓕቘ͚ͭͭ͡ • Ϸίϸόαϭ΄ఘ䁭㷧ᵞECS EventsΨڥአͭͼ͚Ρ • ECS Events΄όЄοϐϕਧͫ͵SQS͡ΟϮϐψЄυΨݐͭͼetcdכਂ • CloudWatch Events/SQS/etcd΅㳨᭔አͯΡᥝ͘Π https://github.com/blox/blox/tree/v0.3/cluster-state-service 33
deamon-scheduler • πЀϓϗαЀφόЀφ䶅1ͺ΄όφμΨᯈᗝͯΡφξυϲЄ϶ • 哶憙/Ϻν㷧ᵞᔮ΄όφμ(Datadog/FluentdͿ)ΨᓕቘͯΡ͵Ηֵ͞Ρ • ݱπЀϓϗαЀφόЀφ䶅όφμ᩸͢㵕ͭͼ͚Ρᥝ͘͢Ρ͵Η • ٖ᮱ጱcluster-state serviceΨڥአͭͼ͚Ρ
• ϷϢήϹЀφϯϔϸ;͚֖͜ᗝ՞ͧ • μ϶φόෛ͚ͭπЀϓϗαЀφόЀφ͢ጭ梍ͫ͵ΟόφμΨ᩸㵕ͫͱΡ • ᭋπЀϓϗαЀφόЀφ͢ڷᴻͫ͵ΟόφμΘڷᴻͯΡ https://github.com/blox/blox/tree/v0.3/daemon-scheduler 34
daemon-scheduler΄Ԇᥝ༷ஷ • Environment • όφμਧ嬝;μ϶φόΨΈΘ՞ͧ͵ఘ䁭 • Environment΄ᇫ䙪Ψdaemon-scheduler͢姘೮ͭΞ͜;ͭͼͥΡ • Environment΅ͥ͘Δͽఘ䁭ͽ͘Πզӥ΄DeploymentΨ䋚ෞͭͼতΗͼECSόφμ ᩸͢㵕ͯΡ
• Deployment • EnvironmentΨμ϶φόӤϔϤϺαͯΡ֢ • DeploymentΨ᭗ͭͼEnvironment͢μ϶φόӤ樄ͫΡ https://github.com/blox/blox/tree/v0.3/daemon-scheduler 35
v0.3.0΄ίЄκϓμώϰ(ϺЄθϸPC) ※ πЀϓϗͽ㵕֢ͫͱ͵䁰ݳ 36
v0.3.0΄ίЄκϓμώϰ(AWS) ※ πЀϓϗͽ㵕֢ͫͱ͵䁰ݳ 37
cluster-state service΄REST API Path(Base Path΅ /v1) Method 㳌ቘ /instances GET
قͼ΄πЀϓϗαЀφόЀφΨᤒᐏ /tasks GET قͼ΄όφμΨᤒᐏ /instances/{cluster}/{arn} GET {cluster} ٖ΄ {arn} ͽਧͫ͵πЀ ϓϗαЀφόЀφΨᤒᐏ /tasks/{cluster}/{arn} GET {cluster} ٖ΄ {arn} ͽਧͫ͵όφ μΨᤒᐏ /stream/instances GET ϞφϞ϶ϮЄόͽਧͫ͵αЀφό Ѐφ΄ఘ䁭ΨφϕϷЄϭͽᤒᐏ /stream/tasks GET ϞφϞ϶ϮЄόͽਧͫ͵όφμ΄ ఘ䁭ΨφϕϷЄϭͽᤒᐏ https://github.com/blox/blox/blob/v0.3/cluster-state-service/swagger/v1/swagger.json 38
deamon-scheduler΄REST API Path(Base Path΅ /v1) Method 㳌ቘ /ping GET HTTPφϓЄόφπЄϖ200Ψᬬᒼ
/environments GET قͼ΄EnvironmentΨᤒᐏ /environments POST EnvironmentΨ֢౮ /environments/{name} GET {name} ͽਧͫ͵EnvironmentΨᤒᐏ /environments/{name} DELETE {name} ͽਧͫ͵EnvironmentΨڷᴻ /environments/{name}/deployments GET {name} ͽਧͫ͵Environment戔ਧͫ ͼ͚Ρقͼ΄DeploymentΨᤒᐏ /environments/{name}/deployments POST {name} ͽਧͫ͵Environment䌏ͭͼ DeploymentΨ֢౮ /environments/{name}/deployments/{id} GET {name} ͽਧͫ͵Environment戔ਧͫ ͼ͚Ρ {id} ;͚͜挷㳨ৼ΄DeploymentΨᤒᐏ https://github.com/blox/blox/blob/v0.3/daemon-scheduler/swagger/v1/swagger.json 39
Environment΄ఘ䁭 $ curl -s 127.0.0.1:2000/v1/environments/test | jq { "deploymentToken": "c6f05550-0c2a-42b9-aa81-f66c3c60853e",
"health": "healthy", "instanceGroup": { "cluster": "arn:aws:ecs:ap-northeast-1:111122223333:cluster/blox2" }, "name": "test", "taskDefinition": "arn:aws:ecs:ap-northeast-1:111122223333:task-definition/nginx:37" } 40
Deployment΄ఘ䁭 $ curl -s 127.0.0.1:2000/v1/environments/test/deployments | jq { "items": [
{ "environmentName": "test", "failedInstances": [], "id": "95d3644f-3624-4324-81fe-35d50583f420", "status": "completed", "taskDefinition": "arn:aws:ecs:ap-northeast-1:111122223333:task-definition/nginx:37" } ] } 41
v1.0ͺ͚ͼ 42
զӥ΄ఘ䁭΅2017/08/26䦒ᅩ΄Θ ΄΄ͽՔ䄜ΥΡݢᚆ͘͢Ρᅩ ဳͭͼͥͶ͚ͫ 43
v1.0΄༷ᥝ • AWSӤͽ㵕֢ͯΡECS΄ϫϚЄυϖθφόϭφξυϲЄ϶ • ECS΄䱛ᚆ;ͭͼ׀ͫΡ΄ͽϳЄσ΅BloxΨԪڹ䯤塈ͯΡᥝ͚͢ • Ӟ䖕ϳЄσ΄AWS厏हͽΘ㵕͡ͱΡ΄ͽᇿᛔθφόϫαχͯΡͩ;Θݢᚆ • ΔͶ戔懯樛ͯΡϖκϲϮЀϕ͘͢ΡͶͧͽ䋚ᤰ΅Α;ΩͿͽͣͼ͚ •
v0.3.0;ݶͮΞ͜ΔͰ΅daemon-schedulerΨ䋚ᤰ • Ք՜΄φξυϲЄ϶Ψ᭄ےͭͼ͚ͥԨਧ • ECS΄ϊЄφπЄϖ΄Ӟ᮱ΨApache 2.0ͽل樄ͭͼ͚ΡҘ • v1.0΄֖ᗝ՞ͧ͢ྋፗΞͥړ͡Ο͚ ! https://github.com/blox/blox/blob/dev/FAQ.md 44
v1.0΄daemon schedulerίЄκϓμώϰ https://github.com/blox/blox/blob/dev/docs/daemon_infrastructure.md#architecture 45
v1.0΄daemon schedulerίЄκϓμώϰ 46
Blox frontend • BloxΨ֢ͯΡ͵Η΄HTTPεЀϖϪαЀϕ • API Gateway;Lambda͡Ο䯤౮ͫΡ • AWS Proxyͽጭ梍ͫ͵Lambda͢䋚檭΄㳌ቘΨ䋚ෞ
• Invokeͫ͵Lambda΅Data ServiceΨΉڊͭDynamoDBΎϔЄόΨכਂ • Ϯϊϐϖ䶅㳨΄LambdaͯΡ΄ͽ΅ͥق᮱1ͺ΄Lambdaͽ㳌ቘͫͱΡ • API Gateway;΅IAMͽ扯戣ͯΡ • ϳЄσ΅Blox frontendΨ᭗ͭͼREST APIͽ֢ͯΡ https://github.com/blox/blox/blob/dev/docs/frontend_design.md 47
Data Service • Environment/Deployment΄ఘ䁭Ψכਂ/ݐͯΡ檭Ήڊͫ ΡAPI • ݱπЀϪЄϚЀϕ΅DynamoDBΨፗള݇ᆙͯΡ΄ͽ΅ͥͩ΄ APIΨ᭗ͭͼϔЄόίμψφͯΡ https://github.com/blox/blox/blob/dev/docs/daemon_design.md#data-service 48
DynamoDB • v0.3.0;΅吖ΠϔЄόφϕί;ͭͼDynamoDBΨڥአͯΡ • Data ServiceአϓЄϣϸ • Environment;Deployment΄ᇫ䙪Ψכਂ • State
ServiceአϓЄϣϸ • ECS΄ᇫ䙪Ψכਂ • Data ServiceአϓЄϣϸ΄DynamoDB Streams奺ኧͽScheduling ManagerΨ ΉڊͭDeploymentΨ䋚ෞ 49
Scheduling Manager • DeploymentΨ䋚ෞͭͼόφμΨπЀϓϗαЀφόЀφӤᯈᗝ • Step Functions͡Ο᩸㵕ͫ͵Lambdaͽ䋚ෞͯΡ • ՔScheduler(Scheduling Controller)᮱ړ΅ڔΠڊͯԨਧ
• Data ServiceΨΉڊͭͼEnvironment/Deployment΄ᇫ䙪Ψݐ /כਂͯΡ • State ServiceΨΉڊͭͼECS΄ᇫ䙪Ψݐ/כਂͯΡ https://github.com/blox/blox/blob/dev/docs/daemon_design.md#scheduling-manager 50
State Service • ECS EventsͽჁͫ͵ఘ䁭ΨDynamoDBכਂͯΡLambda͡Ο䯤౮ͫΡ • ECS΄ᇫ䙪䄜۸᩸ͣ͢͵䁰ݳϷίϸόαϭͽ㳌ቘͯΡͩ;͢ݢᚆ • ݶ䦒Scheduled CloudWatch
Events͡ΟInvokeͫ͵Lambda奺ኧͽμ϶φό΄ᇫ䙪Ψݐ ͯΡΟ͚ͭ • ͵ͶECS Eventsͽ䱛ᚆ͢᪃ΠΡ΄͡䘁ΩͽΡΓ͚ • ECS Events΅ͯΏͼ΄ఘ䁭Ψ㬃晄ͭͼͥΡΥͧͽ΅͚ • αϦЀϕΨݐΠͩΒͯݢᚆ͘͢Ρ • ϳЄσ΄ECS͡ΟAWSίθγЀϕ㯎(ϫϚЄυϖBlox͢䯤塈ͫΡίθγЀϕ)ΎαϦЀϕΨͿ ͜ΚͼᭆΡ΄͡ https://github.com/blox/blox/blob/dev/docs/daemon_design.md#state-service 51
daemon scheduler΄API API 㳌ቘ CreateEnvironment ෛ͚ͭEnvironmentΨ֢౮ StartDeployment ෛ͚ͭDeploymentΨ֢౮ RollbackDeployment զڹ΄Deployment䜟ͯ
StopDeployment DeploymentΨ؊ྊͯΡ UpdateEnvironment EnvironmentΨๅෛ DeleteEnvironment EnvironmentΨڷᴻ GetEnvironment ᇙਧ΄EnvironmentΨᤒᐏ ListEnvironments قͼ΄EnvironmentΨᤒᐏ GetDeployment ᇙਧ΄DeploymentΨᤒᐏ ListDeployments قͼ΄DeploymentΨᤒᐏ https://github.com/blox/blox/blob/dev/docs/daemon_design.md#user-experience 52
v1.0΄Environment΅ͩΩఽͮͽֵ͞ΡҘ # EnvironmentΨ֢౮ $ aws ecs create-environment \ --name <name>
\ --task-definition <task-definition> \ --instance-group <instance-group> \ --role <role> \ --deployment-configuration <deployment-configuration> # قͼ΄EnvironmentΨᤒᐏ $ aws ecs list-environments \ --environment-type <environment-type> # ᇙਧ΄EnvironmentΨᤒᐏ $ aws ecs get-environment \ --environment-name <environment-name> https://github.com/blox/blox/blob/dev/docs/daemon_design.md#user-experience 53
v1.0΄Deployment΅ͩΩఽͮͽֵ͞ΡҘ # DeploymentΨ֢౮ $ aws ecs start-deployment \ --environment-name <environment-name>
\ --environment-version <environment-version> # قͼ΄DeploymentΨᤒᐏ $ aws ecs list-deployments \ --environment-name <environment-name> # ᇙਧ΄DeploymentΨᤒᐏ $ aws ecs get-deployment \ --environment-name <environment-name> \ --deployment-id <deployment-id> https://github.com/blox/blox/blob/dev/docs/daemon_design.md#user-experience 54
3. Δ;Η 55
3ᤈͽ • ςЄϝϹφͽ΅櫞͚ͭ;͵ΟECS΅ᜉ͚晝䝑ᙏ • ECSΨΞΠϞϼϢϸͯΡ䱛ᚆ;ͭͼBlox͘͢Ρ • Blox v1.0΅ϫϚЄυϖςЄϠφΨፓͭͼ͚Ρ 56
͠ΥΠ 57