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
600
現実世界でのコンテナの運び方
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
php-conference-japan-2024
tasuku43
0
360
毎日13時間もかかるバッチ処理をたった3日で60%短縮するためにやったこと
sho_ssk_
1
360
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
330
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
2
410
Spatial Rendering for Apple Vision Pro
warrenm
0
150
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
530
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
970
フロントエンドのディレクトリ構成どうしてる? Feature-Sliced Design 導入体験談
osakatechlab
8
4.1k
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
130
GitHubで育つ コラボレーション文化 : ニフティでのインナーソース挑戦事例 - 2024-12-16 GitHub Universe 2024 Recap in ZOZO
niftycorp
PRO
0
120
MCP with Cloudflare Workers
yusukebe
2
230
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
290
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
4
180
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
450
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Agile that works and the tools we love
rasmusluckow
328
21k
Side Projects
sachag
452
42k
Testing 201, or: Great Expectations
jmmastey
41
7.1k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Typedesign – Prime Four
hannesfritz
40
2.4k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
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!