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.5k
PHPを検査するPHPを書く / Write PHP inspection by PHP
wata727
1
2.1k
快適なコードレビューを目指して / For a comfortable code review
wata727
1
610
現実世界でのコンテナの運び方
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
CloudNativePGがCNCF Sandboxプロジェクトになったぞ! 〜CloudNativePGの仕組みの紹介〜
nnaka2992
0
140
DMMオンラインサロンアプリのSwift化
hayatan
0
230
ゼロからの、レトロゲームエンジンの作り方
tokujiros
3
1.1k
SRE、開発、QAが協業して挑んだリリースプロセス改革@SRE Kaigi 2025
nealle
1
2.8k
QA環境で誰でも自由自在に現在時刻を操って検証できるようにした話
kalibora
1
150
社内フレームワークとその依存性解決 / in-house framework and its dependency management
vvakame
1
430
はてなにおけるfujiwara-wareの活用やecspressoのCI/CD構成 / Fujiwara Tech Conference 2025
cohalz
3
3k
テストコード書いてみませんか?
onopon
2
360
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
170
[JAWS-UG横浜 #80] うわっ…今年のServerless アップデート、少なすぎ…?
maroon1st
0
130
Azure AI Foundryのご紹介
qt_luigi
1
240
Оптимизируем производительность блока Казначейство
lamodatech
0
980
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.5k
Navigating Team Friction
lara
183
15k
Building Adaptive Systems
keathley
39
2.4k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
4 Signs Your Business is Dying
shpigford
182
22k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
360
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
11
890
It's Worth the Effort
3n
184
28k
A better future with KSS
kneath
238
17k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
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!