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
エンジニア向けSaaSを支えるInfrastructure as Code
Search
Kazuma Watanabe
July 03, 2016
Programming
5
2.3k
エンジニア向けSaaSを支えるInfrastructure as Code
YAP(achimon)C::Asia Hachioji 2016 Day2
Kazuma Watanabe
July 03, 2016
Tweet
Share
More Decks by Kazuma Watanabe
See All by Kazuma Watanabe
SmartHRにおけるBiTemporal Data Modelの実践のその後 / After the practice of BiTemporal Data Model in SmartHR
wata727
1
2.3k
PHPを検査するPHPを書く / Write PHP inspection by PHP
wata727
1
2.1k
快適なコードレビューを目指して / For a comfortable code review
wata727
1
590
現実世界でのコンテナの運び方
wata727
3
1.1k
Lintの付き合い方とPahoutのご紹介
wata727
0
150
Querlyで始めるコードレビューの自動化
wata727
2
440
コンテナをSpot Fleetで起動するという選択肢
wata727
2
1k
SideCIのインフラ構築を自動化した話
wata727
1
2.1k
Other Decks in Programming
See All in Programming
最新TCAキャッチアップ
0si43
0
140
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.7k
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
CSC509 Lecture 09
javiergs
PRO
0
140
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
910
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
2
1.1k
役立つログに取り組もう
irof
28
9.6k
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Building Adaptive Systems
keathley
38
2.3k
How to Ace a Technical Interview
jacobian
276
23k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Code Reviewing Like a Champion
maltzj
520
39k
Code Review Best Practice
trishagee
64
17k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Transcript
ΤϯδχΞ͚SaaSΛࢧ͑Δ Infrastructure as Code YAP(achimon)C::Asia Hachioji 2016 Day2
ࣗݾհ • ᬒҰਅ (@wata727_) • Engineer in Actcat, Inc. ΠϯϑϥدΓαʔόαΠυ
࠷ॳʹ
ཧͱݱ࣮
ImmutableͰ͋Δ͜ͱͷ͠͞ • ࠷ॳImmutable Infrastructureʹ͍ͭͯτʔ Ϋ͢ΔͭΓͩͬͨ • ࣮ݱ͢ΔͨΊʹ՝͕ଟ͗ͨ͢ʢޙड़ʣ
ΤϯδχΞ͚ SaaS
SideCI
SideCI ࣗಈίʔυϨϏϡʔ
GitHub࿈ܞ
https://github.com/integrations/sideci
ࠓͷ͓ • SideCIͷAWSҠߦࣄྫ • Πϯϑϥͷӡ༻ํࣜΛબͨ͠ • ࣮ݱ͢ΔͨΊͷInfrastructure as Code
AWSͷҠߦ
Ҏલͷߏ
ϋΠϒϦοτΫϥυߏ • AWS + GCP • VPNͰଓͯ͠ωοτϫʔΫΛߏங • ҰํͷϕϯμʔͷোͰαʔϏε͕མͪΔ͜ ͱ͕͋ͬͯɺҰຊԽ͍ͨ͠ͱ͍͏͕͋ͬͨ
Ҡߦͷ՝
ߏཧ͞Ε͍ͯͳ͍ • Ҿ͖ܧ͕Εͨखॱॻ.mdͷΈ • νʔϜ͕εέʔϧ͢ΔͱଐਓԽͷΛট͖ ͦ͏ͱ͍͏ผͷ… • ԿΒ͔ͷࣗಈԽ͕ඞཁ
ߏཧ͞Ε͍ͯͳ͍ • Ҿ͖ܧ͕Εͨखॱॻ.mdͷΈ • νʔϜ͕εέʔϧ͢ΔͱଐਓԽͷΛট͖ ͦ͏ͱ͍͏ผͷ… • ԿΒ͔ͷࣗಈԽ͕ඞཁ Infrastructure as
Code ΛΔͧʂʂ
Πϯϑϥͷ ӡ༻ํࣜͷબ
Ͳ͏ͬͯίʔυԽ͢Δ͔ • ·ͣΠϯϑϥɺσϓϩΠͷཧɺӡ༻ΛͲ ͏͢Δ͖͔ߟ͔͑ͯΒɺπʔϧΛબ͢Δ • PushܕɺPullܕɺImmutable…
Pushܕ
Pushܕͷӡ༻ɺσϓϩΠ • ΫϥΠΞϯτ͔Β֤αʔόʹϛυϧΣΞม ߋΞϓϦέʔγϣϯͷσϓϩΠΛSSHܦ༝ ͳͲͰߦ͏ • Ansible, Itamae, CapistranoͳͲ
Pushܕͷӡ༻ɺσϓϩΠ
Pushܕͷӡ༻ɺσϓϩΠ
ϝϦοτͱσϝϦοτ • ΫϥΠΞϯτͷΈͰಈ࡞͢ΔͷͰαʔόଆʹ ઃఆ͕ෆཁͰཧָ͕ • αʔόͷ͕ଟ͔ͬͨΓɺΦʔτεέʔϦ ϯάͰ૿ݮ͢Δͱద༻͕͘͠ͳΔ
Pullܕ
Pullܕͷӡ༻ɺσϓϩΠ • ֤αʔό͕ࣗͰඞཁͳϛυϧΣΞɺΞϓ ϦέʔγϣϯͷมߋΛࣗࣗʹద༻͢Δ • Chef, AWS CodeDeploy, StretcherͳͲ
Pullܕͷӡ༻ɺσϓϩΠ
Pullܕͷӡ༻ɺσϓϩΠ
Pullܕͷӡ༻ɺσϓϩΠ
ϝϦοτͱσϝϦοτ • ֤αʔό͕Λ࣋ͭͷͰεέʔϧ͢ΔɺΦʔ τεέʔϦϯάͰવͳ͠ • ֤αʔόʹର͢ΔݩͱͳΔαʔό͕SPOF ʹͳΓ͕ͪͳͷͰɺԽͳͲߟ͑Δͱϝϯ ςφϯείετ͕ߴ͍
Immutable
Immutableͳӡ༻ɺσϓϩΠ • ֤αʔό࠷ॳ͔ΒมߋࡁΈͰɺมߋΛཁ͢ Δ߹ʹαʔό͝ͱഁغ͢Δ • ؔ࿈πʔϧPacker, DockerͳͲ
Immutableͳӡ༻ɺσϓϩΠ
Immutableͳӡ༻ɺσϓϩΠ
ϝϦοτͱσϝϦοτ • ֤αʔόશʹෳՄೳͰɺϩʔϧόοΫ ͕༰қʢBlue-Green Deployʣ • ΰʔϧσϯΠϝʔδͷੜίετ͕ߴ͍
Immutableͳ ํࣜͷ࠾༻
ΰʔϧσϯΠϝʔδͷϏϧυ • αʔϏεΠϯՄೳͳϚγϯΠϝʔδΛ PackerͰϏϧυ͢Δ • αʔϏεΠϯՄೳͰ͋Δ͜ͱPackerͷϏϧ υͷ࠷ޙʹServerspecΛ࣮ߦͯ͠୲อ͢Δ
ImmutableͳσϓϩΠ • ৽͍͠ϚγϯΠϝʔδ͝ͱʹαʔόΛBlue- GreenతʹೖΕସ͑Δ • TerraformʹΑΔαʔό࠶ஔͷࣗಈԽ • طଘͷϦιʔεTerraformingͰநग़
αʔόߏஙϑϩʔ QBDLFSCVJMETFSWFSKTPO
QBDLFSCVJMETFSWFS KTPO Server ݩʹͳΔ αʔόͷىಈ αʔόߏஙϑϩʔ
αʔόߏஙϑϩʔ QBDLFSCVJMETFSWFS KTPO Server αʔόΛߏங QSPWJTJPOFST< \ UZQFTIFMM FYFDVUF@DPNNBOE\\7BST^^TVEP&CBTIF
\\1BUI^^\\VTFSAFOWJSPONFOUA^^ TDSJQUT< TDSJQUTSPPU@VQHSBEFTI TDSJQUTSPPU@JOTUBMMTI > ^ ʜ
αʔόߏஙϑϩʔ QBDLFSCVJMETFSWFS KTPO Server 4FSWFSTQFDͰ ಈ࡞ςετ
αʔόߏஙϑϩʔ QBDLFSCVJMETFSWFS KTPO Server Machine Image αʔό͔ΒϚγϯ ΠϝʔδΛநग़
αʔόߏஙϑϩʔ QBDLFSCVJMETFSWFS KTPO Machine Image αʔόΛআ
αʔόߏஙϑϩʔ UFSSBGPSNBQQMZ Machine Image
αʔόߏஙϑϩʔ UFSSBGPSNBQQMZ Machine Image ݩʹͳΔϚγϯ ΠϝʔδΛࢦఆ
αʔόߏஙϑϩʔ UFSSBGPSNBQQMZ Machine Image Security Group ༻͢ΔηΩϡϦςΟ άϧʔϓΛࢦఆ
αʔόߏஙϑϩʔ UFSSBGPSNBQQMZ Machine Image Security Group Server ͦΕͧΕͷઃఆ͔Β αʔόΛىಈ
ൃੜ
ΠϝʔδͷϏϧυ͕͗͢Δ • 30͘Β͍͔͔Δ • σϓϩΠͷ͕2ˠ30ʙͱ͔ʹͳΔ • ϦϦʔεʹର͢Δ߅ײͷ૿େ
σϓϩΠ͚ͩPushܕʹ • σϓϩΠैདྷ௨ΓCapistrano • ϛυϧΣΞมߋ࣌ͷΈϚγϯΠϝʔδΛߋ ৽͢ΔΑ͏ʹมߋ
Ҡߦ࡞ۀͷ࣮ࢪ
ҠߦͷྲྀΕ • ฒྻͰࣄલʹϓϩμΫγϣϯڥΛՔಇͤ͞ ͓ͯ͘ʢNOT εςʔδϯάʣ • ՄೳͳݶΓɺELBͱRoute53ͷΓସ͚͑ͩͰ τϥϑΟοΫͷྲྀΕΛมߋ͢ΔΑ͏ʹ͢Δ
Ҡߦલ
Ҡߦޙ
ແࣄྃ
Infrastructure as CodeΛಋೖ͢Δ ͱ͍͏͜ͱ
ָͳӡ༻Λߟ͑Δ • ྫ͑ɺΠϝʔδͷϏϧυʹ͕͔͔࣌ؒΓ͢ ͗ͨΓɺϏϧυͷͨΊʹෳࡶͳڥΛߏங͢ Δඞཁ͕͋Δͱɺͳ͔ͳ͔ਁಁ͠ͳ͍ • ·ͩ·ͩվળͷ༨͋Γ…
نʹ͋ͬͨํ๏ΛબͿ • AutoScalingΛඞཁͱ͠ͳ͍গͷαʔόͳΒ PushܕͰेͳ͜ͱ͋Δ • ͦΕͧΕʹదͨ͠πʔϧ͕͋ΔͷͰɺྲྀߦΓ ഇΓʹΘ͞Εͳ͍
Thank you!