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
STNSとDocker
Search
Kazuhiko Yamashita
April 23, 2016
1
1.5k
STNSとDocker
Kazuhiko Yamashita
April 23, 2016
Tweet
Share
More Decks by Kazuhiko Yamashita
See All by Kazuhiko Yamashita
Tuning GraphQL on Rails
pyama86
2
780
ttlcacheのここがスゴい
pyama86
1
63
クラウドサービスの 利用コストを削減する技術 - 円安の真南風を感じて -
pyama86
3
450
実践ARMアーキテクチャ移行
pyama86
2
2.1k
リモートワーク時代の守護神 PHP開発者のためのセキュリティ強化術
pyama86
3
970
実践DevSecOps~クラウドネイティブとオンプレミスの間から~
pyama86
1
59
ペパボOpenTelemetry革命
pyama86
2
1.9k
Site Reliability Engineering for GMO
pyama86
10
1.2k
PHPアプリケーションのスケーラビリティと 信頼性を革新する nginx+ngx_mrubyとGoの融合
pyama86
2
450
Featured
See All Featured
Being A Developer After 40
akosma
86
590k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Code Review Best Practice
trishagee
64
17k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
Learning to Love Humans: Emotional Interface Design
aarron
272
40k
What's new in Ruby 2.0
geeforr
342
31k
Why Our Code Smells
bkeepers
PRO
334
57k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Teambox: Starting and Learning
jrom
132
8.7k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Transcript
य़ͷཅؾʹ༠ΘΕͯ STNSͱDocker
hi! GMO Pepabo, Inc. ϗεςΟϯάࣄۀ෦ ϜʔϜʔυϝΠϯάϧʔϓ γχΞΤϯδχΞ @pyama86
STNS ɾLinuxϢʔβʔɺάϧʔϓͷ໊લղܾ ɾSSHϩάΠϯ࣌ͷެ։伴ͷऔಘ ɾSudoύεϫʔυͷೝূ
STNS ɾTOMLܗࣜͷઃఆϑΝΠϧ ɹˠγϯϓϧͳཧ ɾrhel,debianͷϦϙδτϦఏڙ ɾx86_64,i386ͷαϙʔτ [users.example] id = 1001 group_id
= 1001 keys = ["ssh-rsa XXXXX…"] [groups.example] id = 1001 users = ["example"]
ෳڥΛαϙʔτ ↓ ӡ༻ෛՙ͕ߴ·Δ
LinuxϛυϧΣΞͷ߹ ɾෳͷOSɾΞʔΩςΫνϟͰͷಈ࡞Λอূ ɾෳͷܗࣜͷύοέʔδϯάʹରԠ(rpm,deb) ɾLinuxͷࠜװͷػೳͰ͋ΔͨΊαʔϏεஅ ڐ͞Εͳ͍
ϦϦʔεϑϩʔ 1.push 2.webhook 3.CI 4.test deploy 5.install test 6.integration test
7.producion deploy
Docker
ϦϦʔεϑϩʔ 1.push 2.webhook 3.CI 4.test deploy 5.install test 6.integration test
7.producion deploy Docker
ׂ͝ͱʹΠϝʔδΛ͚Δ rhel-x86-build rhel-x86-test rhel-x86-pkg rhel-i386-build rhel-i386-test rhel-i386-pkg debian-x86-build debian-x86-test debian-x86-pkg
debian-i386-build debian-i386-test debian-i386-pkg rhel-x86-chef rhel-i386-chef debian-x86-chef debian-i386-chef 16ύλʔϯ×2(server,client)
DRY
Base STEP1:ΠϝʔδཧΛೋஈ֊ʹ rhel-x86 rhel-i386 debian-i386 debian-x86 Πϯετʔϧ͢ΔϛυϧΣΞ ෦ઃఆΛἧ͑ɺΞʔΩςΫνϟ ʹґଘ͠ͳ͍ૢ࡞ΛՄೳͱ͢Δ concreate
rhel-x86-build rhel-x86-test rhel-x86-pkg rhel-i386-build rhel-i386-test rhel-i386-pkg debian-x86-build debian-x86-test debian-x86-pkg debian-i386-build debian-i386-test debian-i386-pkg ϕʔεΠϝʔδ͔Βׂ͝ͱʹ ΠϝʔδΛ࡞͢Δ
STEP2:ERBͰDockerfileͰग़དྷΔ͜ͱΛ૿͢ ɾdocker/centos-ci.erb DockerfileͷFROMʹมΛࢦఆͰ͖ͳ͍ͷͰ ERBͰςϯϓϨʔτԽ͢Δ
STEP3:RakeͰBuild͢Δ ɾRakefile Rake Ruby Ͱॻ͔ΕͨϏϧυπʔϧɻ ERBͱ߹ΘͤΔ͜ͱͰॏෳΛݮΒ͠ɺλεΫΛఆٛ͢Δ͜ͱ͕ग़དྷ·͢ɻ
Dockerfile rhel-x86-build rhel-x86-test rhel-x86-pkg rhel-i386-build rhel-i386-test rhel-i386-pkg debian-x86-build debian-x86-test debian-x86-pkg
debian-i386-build debian-i386-test debian-i386-pkg bin/rake build bin/rake test bin/rake pkg ׂ͝ͱʹ1ίϚϯυͰશͯͷOSɺ ΞʔΩςΫνϟͰ࣮ߦͰ͖ΔΑ͏ʹͳΔ
͞Βʹ
Travis CIͳΒDockerಈ͘ ɾύοέʔδ࡞ ɾΠϯετʔϧ ɾServerspecͰల։ޙͷঢ়ଶΛςετ ɹ →ෳͷOSɺෳͷΞʔΩςΫνϟΛCI
࠷ޙʹ ɾDockerΛར༻͢ΔͱෳͷڥΛखܰʹ४උ͢Δ ͜ͱ͕ग़དྷΔ͕ɺखܰ͞Ώ͑ʹDRYݪଇʹ͕ͪ͠ ɾRakeͱΈ߹Θͤɺಉ͡ఆٛΛߦΘͳ͍ ɾϕʔεΠϝʔδͱ۩Πϝʔδͷೋஈ֊ʹ͚Δ ͜ͱͰπʔϧͱΈ߹Θͤ͘͢ͳΔ ɾSTNSɺຊʹศར͔ͩΒͬͨ΄͏͕͍͍
͓ෲ͍ͨ͢ΆΑ