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
Serverspec at JTF2014
Search
Gosuke Miyashita
PRO
June 22, 2014
Technology
16
6.3k
Serverspec at JTF2014
Gosuke Miyashita
PRO
June 22, 2014
Tweet
Share
More Decks by Gosuke Miyashita
See All by Gosuke Miyashita
Serverspec(をつくった自分)のそれまでとその後
mizzy
PRO
8
3k
A method for separating policy definition and behavior control by an intermediate language to achieve optimal server configuration management according to the situation
mizzy
PRO
3
230
Past and future of Infrastructure as Code
mizzy
PRO
0
140
Configuration Managementツールのポリシー定義用中間言語に関する考察/Considerations about an intermediate language of configuration management tools
mizzy
PRO
0
430
Infrastructure as Codeのこれまでとこれから/Infra Study Meetup #1
mizzy
PRO
29
12k
エンジニアかつ研究者としての今後のキャリアについて/My Career As An Engineer And A Researcher
mizzy
PRO
0
380
Compare OCI Runtimes
mizzy
PRO
2
1.4k
Serverspec and OSS at IEICE Society Conference 2018
mizzy
PRO
2
270
House Meetup
mizzy
PRO
7
3.1k
Other Decks in Technology
See All in Technology
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
170
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
C++26 エラー性動作
faithandbrave
2
730
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
36
13k
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
PHPからGoへのマイグレーション for DMMアフィリエイト
yabakokobayashi
1
170
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
160
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
200
AI時代のデータセンターネットワーク
lycorptech_jp
PRO
1
290
.NET 9 のパフォーマンス改善
nenonaninu
0
900
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
190
宇宙ベンチャーにおける最近の情シス取り組みについて
axelmizu
0
110
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
95
5.2k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Agile that works and the tools we love
rasmusluckow
328
21k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Building Applications with DynamoDB
mza
91
6.1k
Scaling GitHub
holman
458
140k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Transcript
ServerspecʹݟΔ ٕज़τϨϯυΛ ੜΈग़͢ώϯτ
ࣗݾհ 4 ٶԼ ߶ี 4 http://mizzy.org/ 4 mizzy@github 4 gosukenator@twitter
4 ϑϦʔϥϯεΤϯδχΞ/Serverspec Operations
ΞδΣϯμ 4 ࠷ۙͷΠϯϑϥܥٕज़τϨϯυ 4 Serverspecͱ 4 Serverspec͕ੜ·Εͨഎܠ 4 Serverspecͷೝ 4
ServerspecͷޭཁҼ 4 ·ͱΊ
࠷ۙͷΠϯϑϥؔ࿈ٕज़ τϨϯυৼΓฦΓ
: OS͔ΒϛυϧΣΞ ͱ͍ͬͨιϑτΣΞϨΠϠʔΛ ࢦ͢ݴ༿ͱͯ͠ͷΠϯϑϥͰ͢
Πϯϑϥؔ࿈ٕज़τϨϯυ 4 αʔόߏཧπʔϧ 4 Chefਓؾ 4 ࠓʹͳͬͯ4݄,5݄ͱཱͯଓ͚ʹॻ੶ൃץ 4 USͰ2014ʹPuppetͷγΣΞΛ͑ͨΒ͍͠ 4
Ansible 4 ChefͷΧϯλʔ
Πϯϑϥؔ࿈ٕज़τϨϯυʢ͖ͭͮʣ 4 ԾԽؔ࿈πʔϧ 4 Vagrant 4 Docker 4 ςετۦಈΠϯϑϥͱΠϯϑϥCI 4
Test Kitchen 4 Serverspec
Πϯϑϥؔ࿈ٕज़τϨϯυʢ͖ͭͮʣ 4 Immutable Infrastructure 4 Trash Your Servers and Burn
Your Code: Immutable Infrastructure and Disposable Components 4 WEB+DB PRESS Vol.81
ςετۦಈΠϯϑϥ ΠϯϑϥCI
None
ςετۦಈΠϯϑϥ/ΠϯϑϥCI 4 ΞϓϦέʔγϣϯ։ൃͷख๏ΛΠϯϑϥߏஙʹԠ༻ 4 @riywo͘Μ͕2012ʹΠϯϑϥCIʹ͍ͭͯॻ͍ͯΔ 4 http://blog.riywo.com/2012/05/27/145310 4 ࣗࣗߏ2007͙Β͍͔Β͋ͬͨ 4
ʮςετۦಈαʔόߏஙʯͱ͍͏ݴ༿Λߟ͍͑ͯͨ 4 http://d.hatena.ne.jp/dayflower/ 20070405/1175782564#c
ςετۦಈΠϯϑϥ/ΠϯϑϥCI 4 Ҏલ͔Β֓೦͋ͬͨͱ͍͑ʮΠϯϑϥΛςετՄೳʹ ͢Δʯͱ͍͏ੈքΛ͛ͨͷServerspec 4 ୯ʹςετՄೳʹ͢Δ͚ͩͰͳ͘ɺGitHub FlowʹΑΓ ΠϯϑϥมߋΛϓϧϦΫΤετ͠ɺCIαʔόʹΑΓܧଓత ʹςετ͢Δɺͱ͍͏ੈքΛ։͍ͨ
None
Serverspec
Serverspecͱ 4 20133݄ʹϦϦʔε 4 RSpecͰαʔόͷঢ়ଶΛςετ 4 ຊ࣭αʔόͷঢ়ଶΛهड़ͨ͠ίʔυΛςετ 4 PuppetϚχϑΣετChefϨγϐͳͲ 4
Πϯϑϥίʔυͷ։ൃϦϑΝΫλϦϯάΛޮྑ͘ߦ͏ ͨΊͷπʔϧ
ServerspecʹΑΔςετίʔυ describe package('nginx') do it { should be installed }
end describe service('nginx') do it { should be_enabled } it { should be_running } end
Serverspecͷεϖϧ 4 ਖ਼ 4 Serverspec/serverspec/SERVERSPEC 4 ޡ 4 ServerSpec/Server Spec
Serverspecͳͥ ੜ·Εͨͷ͔ʁ
ςετπʔϧ։ൃͷ͖͔͚ͬ 4 2006ʹPuppetΛ͍࢝Ίͨ 4 αʔόߏஙPuppetʹΑͬͯࣗಈԽͰ͖ͨ 4 ͡Ό͋࣍ߏஙޙͷνΣοΫΛࣗಈԽ͍ͨ͠ 4 ExcelνΣοΫγʔτͰͷࢹ֬ೝΊ͍ͨ
Assurer 4 2007ʹͭͬͨ͘PerlαʔόςετϑϨʔϜϫʔΫ 4 ϓϥάΠϯͰ֦ுՄೳ 4 PlaggerͷӨڹ 4 Filter, Format,
Notify, Publish, Test 4 make testͰςετΛ࣮ߦ/TAPܗࣜͰ݁Ռग़ྗ 4 CPAN AuthorͳͷͰPerlͰͷςετͷΓํΛ౿ऻ
AssurerͷഊҼ 4 Serverspecͱҧ͍ৼΔ͍Λςετ 4 ঢ়ଶͷςετΑΓཁ͕݅ෳࡶ 4 ཉுͬͯ৭ʑ٧ΊࠐΈ͗ͯ͢ߋʹෳࡶʹͳͬͨ 4 ϑΣʔζ͚/ϓϥΨϒϧ/ࢄॲཧ/γΣϧ 4
ίϯηϓτ͕Serverspec΄Ͳ໌֬Ͱͳ͔ͬͨ 4 ։ൃऀͰ͋Δࣗ͢ΒΘͳ͍ͷʹͳͬͨ
AssurerҎޙ 4 ࣌ʑࢥ͍ฦ͢͜ͱ͚͋ͬͨͲੵۃతʹԿ͔͠Α͏ͱ͠ ͳ͔ͬͨ 4 ݱ͔ΒएׯڑΛஔ͍͍ͯͯɺPuppetͳͲͦΜͳʹ৮ Βͳ͘ͳͬͨ
·ͨPuppet͞ΘΓ͡Ίͨ 4 ͕͔ࣗͭͯॻ͍ͨPuppetϚχϑΣετ͕ϨΨγʔίʔυ ʹͳ͍ͬͯͨ 4 ϦϑΝΫλϦϯάͨ͘͠ͳͬͨ 4 ϦϑΝΫλϦϯά͢ΔͳΒવςετ͕ඞཁͩ͠CIΓ ͍ͨ
Πϯϑϥςετͷલ४උ 4 ΠϯϑϥCIΖ͏ͱࢥͬͯɺ·ͣCIΛ࣮ߦ͢ΔڥΛ ͑ͨ 4 LXCίϯςφͰςετ͢ΔͨΊʹɺίϯςφΛͬ͘͞ͱͭ ͘ΕΔPuppetϚχϑΣετॻ͍ͨ 4 ͪΐ͏Ͳಉ͡λΠϛϯάͰDocker͕ग़͖ͯͯແ༻ͷ ʹͳͬͨ
ςετπʔϧ୳͠ 4 ڥॲ͕͍ͭͨͷͰ࣍ςετπʔϧ 4 ·ͣطଘͷͷͰΑ͛͞ͳͷ͕ͳ͍͔୳ͨ͠ 4 rspec-puppet͙Β͍͔͠PuppetͰ͑Δͷͳ͞ ͦ͏ 4 Chefपลͷํ͕ॆ࣮
4 ChefSpec, Test Kitchen, Cucumber-Chef, minitest-chef-handler
ࣗલͰͭ͘Δ͜ͱʹͨ͠ 4 ͨͩ͠rspec-puppet͖ͪΜͱϞδϡʔϧԽ͞Ε͍ͯͳ ͍ͱ͑ͳ͍ 4 ࣗͷϚχϑΣετϞδϡʔϧԽ͞Εͯͳ͍ϨϕϧͷϨ Ψγʔ͞ 4 rspec-puppet࣮ࡍͷαʔόͷঢ়ଶΛςετ͢ΔΘ͚ ͡Όͳ͍
4 ͡Ό͋ࣗͰ࡞Δ͔ɺͬͯ͜ͱʹ
Serverspecੜ 4 ࣌ͷಉ྅(@hiboma)͕LXCͷίϯςφΛςετ͢Δίʔ υΛRSpecͰॻ͍͍ͯͨ 4 Α͠ɺͦΕύΫͬͯ൚༻తʹ͑ΔΑ͏͠Α͏ 4 ϓϩτλΠϓΛҰͰͭ͘Γɺཌʹrubygems.orgͰ ެ։
ॳظͷServerspec 4 ࠷ॳRedHatܥLinuxͷΈରԠɺSSHόοΫΤϯυͷΈɻ ExecόοΫΤϯυͳ͔ͬͨɻ 4 @tkmr͞Μ͕ෳOSରԠͱDebianରԠͯ͘͠Εͨ 4 @raphink͞Μ͕όοΫΤϯυΓସ͑ରԠͯ͘͠Εͨ 4 ͜Μͳײ͡Ͱ৭ΜͳਓΛר͖ࠐΜͩ
Serverspecͦͷޙ 4 Star: 738, Fork: 149, Contributors: 69 4 ରԠOS૿͑ͨΓɺαϙʔτ͢Δػೳ૿͑ͨΓ
4 ݱࡏv2.0ʹ͚ͨ࡞ۀத 4 ΑΓ֦ு͘͢͢͠ΔͨΊͷϦϑΝΫλϦϯά͕ϝΠϯ
ຊʹ͘ ΘΕͯΔͷʁ
Serverspecͷೝ 4 Black Duck Open Source Rookies of the Year
2013 4 Docker, InfluxDB, AppiumͱฒΜͰड 4 Thought Works Technology Radar 2014 4 Provisioning Testingͷ߲ʹServerspecͷจࣈ͕ग़ ͯ͘Δ 4 rubygems.orgͰͷμϯϩʔυ30ສ 4 Chef͕400ສ
None
ࡶࢽʹ͓͚Δݴٴ 4 WEB+DB PRESS Vol.75 4 WEB+DB PRESS Vol.76 4
WEB+DB PRESS Vol.80 4 WEB+DB PRESS Vol.81
None
ॻ੶ʹ͓͚Δݴٴ 4 Test-Driven Infrastructure with Chef, 2nd Edition 4 Chef׆༻ΨΠυ
4 νʔϜ։ൃ࣮ફೖ 4 Chef࣮ફೖ 4 ύʔϑΣΫτRuby on Rails
None
None
None
None
None
ւ֎ͰͷԠ
None
None
None
None
None
None
ͳͥServerspec ޭͨ͠ͷ͔ʁ
ೳಈతͳཁҼ
ผྖҬͰޭ͍ͯ͠ΔϓϥΫςΟε Λ࣋ͪࠐΉ 4 ιϑτΣΞ։ൃͷੈքͷϓϥΫςΟε 4 ςετۦಈ։ൃ 4 ܧଓతΠϯςάϨʔγϣϯ 4 ಉ͡༻ޠ͏ͱΠϝʔδ͍͢͠
4 ςετۦಈΠϯϑϥ/ΠϯϑϥCI
໊લॏཁ 4 Server + RSpecͱ͍͏ٿͳ໊લ 4 ໊લ͔ΒԿΛ͢Δͷͳͷ͔͕ྨਪ͍͢͠ 4 ͍֮͑͢
ӳޠυΩϡϝϯτ 4 ຊࠃ֎Ͱ͘ೝͯ͠Β͓͏ͱࢥͬͨΒɺ͜Εେ લఏ 4 READMEserverspec.orgͳͲ࠷ॳ͔ΒӳޠͰॻ͍ͨ
ϝδϟʔͳΩʔϫʔυ/ϓϩμΫτ ʹͷ͔ͬΔ 4 PuppetChefͱ͍ͬͨϫʔυΛࢄΓΊΔ 4 ࣮ࡍʹؔ࿈͢Δπʔϧͩ͠ 4 PuppetChefͷதͷਓʹरΘΕͯɺ൴Β͕πΠʔτ͢Δ ͜ͱͰ·ͬͨײ
υΩϡϝϯτͷΘ͔Γ͢͞ 4 ӳޠͰυΩϡϝϯτΛॻ͍ͯɺϝδϟʔͳϫʔυࢄΓΊ ͯϦʔνϟϏϦςΟߴΊΔ͚ͩͰ·ͩෆे 4 ͬ͟ͱࣼΊಡΈ͚ͨͩ͠ͰԿ͕Ͱ͖Δπʔϧͳͷ͔͙͢ʹ Θ͔ΔΑ͏ʹ͢Δͷ͕ॏཁ 4 ͙͢ʹΘ͔Βͳ͍ͱɺڵຯΛࣦͬͯ͞ΕɺೋͱΒ ͳ͍͔͠Εͳ͍
πʔϧࣗମͷγϯϓϧ͞ 4 υΩϡϝϯτΛΘ͔Γ͘͢͢ΔͨΊʹɺπʔϧͦͷ ͷ͕γϯϓϧͰΘ͔Γ͍͢ඞཁ͕͋Δ 4 ServerspecςετͷΈʹಛԽͨ͠ 4 ଞͷπʔϧʹ͋Δߏཧπʔϧͱͷ࿈ܞVMͷૢ࡞ ল͍ͨ 4
Ώ͑ʹγϯϓϧͰΘ͔Γ͍͢
γϯϓϧ͚ͩͲ֦ு͍͢͠ 4 جຊతͳػೳ͋·Γ૿͞ͳ͍ํ 4 ͨͩ͠ϓϩάϥϜΛॻ͍֦ͯுͯ͘͢͠͠Δ 4 ଞͷπʔϧͱΈ߹Θ͍ͤ͢ 4 UNIXֶ 4
Keep It Simple, Stupid
ଞπʔϧͱͷΈ߹Θͤ 4 busser-serverspec 4 beaker-rspec 4 vagrant-serverspec 4 sensu-community-plugins/plugins/serverspec
ΤʔδΣϯτϨε 4 ͍͘ΒศརͰɺαʔόʹ৭ʑೖΕΔͷݏͰ͢ΑͶʁ 4 ServerspecςετΛ࣮ߦ͢ΔϚγϯʹRuby͕͋ΕOK 4 ςετରͷϚγϯʹSSHͰΞΫηεͰ͖ΕOK 4 Ruby͢Βඞཁͳ͍
͏·ͰͷෑډΛԼ͛Δ 4 ServerspecRuby 1.8.7Ҏ߱Λαϙʔτ 4 RedHat 6ܥͷύοέʔδΠϯετʔϧͰೖΔRubyʹରԠ 4 ผ్RubyΛμϯϩʔυͯ͠ίϯύΠϧɺͳͲ͢Δඞ ཁ͕ͳ͍
4 serverspec-initίϚϯυ 4 ίϚϯυҰൃͰͻͳܗΛੜ͙ͯ͢͠ʹࢼͤΔ
ࣗҰਓͰΓ͗͢ͳ͍ 4 ͕ࣗ͏ػೳ͔͠جຊతʹ࣮͠ͳ͍ 4 γϯϓϧʹอͭ͏͑Ͱେࣄ 4 ཉ͍͠ػೳ͕͋ΕࣗͰ࣮ͯ͘͠Εɺͱ͍͏ελϯε 4 OSSͳͷͰ 4
݁Ռͱͯ͠ଟ͘ͷਓΛר͖ࠐΊͨ
ೳಈతཁҼ·ͱΊ 4 ଞྖҬͷϓϥΫςΟεΛ࣋ͪࠐΉ 4 ໊લυΩϡϝϯτॏཁ 4 ϝδϟʔͳϓϩμΫτʹ͔ͬΔ 4 γϯϓϧ͔֦ͭுՄೳ 4
͏ෑډΛԼ͛Δ 4 ଞऀΛר͖ࠐΉ
ٕज़τϨϯυཁҼ
αʔόߏཧπʔϧͷख़ 4 Puppetొ͔Β9 4 Chefొ͔Β5 4 ΈΜͳ͕ͦͷ࣍Λݟਾ͑ͩͨ͠
Vagrantͷීٴ 4 ςετΛ࣮ߦ͢ΔͨΊʹखݩͰVMΛಈ͔ͤΔํ͕ḿΔ 4 VagrantʹΑΓखݩͰςετίʔυΛॻ͍࣮ͯߦ͢Δڥ ͕ͭ͘Γ͘͢ͳͬͨ
Chefք۾ͰͷςετͷΓ্͕Γ 4 ݩʑChefք۾ͷਓͨͪςετʹର͢Δҙ͕ࣝߴ͔ͬͨ 4 ChefSpec, Test Kitchen, Cucumber-Chef, minitest- chef-handlerͳͲςετܥπʔϧChefք۾͕ॆ࣮
JenkinsCI as a Serviceͷීٴ 4 Jenkins͕։ൃͷੈքͰͨΓલͷΑ͏ʹΘΕ͍ͯΔ 4 CI as a
Serviceͷීٴ 4 Travis, CircleCI, Drone, WerckerͳͲ
GitHubͷීٴ 4 GitHubͰΠϯϑϥίʔυΛཧ 4 ϓϧϦΫΤετϕʔεͰมߋ 4 CI as a Serviceͱͷ࿈ܞ
4 ςετۦಈΠϯϑϥ/CIͱ૬ੑ͕ྑ͍
ٕज़τϨϯυཁҼ·ͱΊ 4 ߏཧ+ԾԽ+ςετ+CIͱ͍͏τϨϯυ 4 GitHub͕͜ͷτϨϯυΛߋʹޙԡ͠ 4 ԾԽɺߏཧɺCIʹ͍ͭͯఆ൪͕Ͱ͖ͯͨ 4 ςετπʔϧܾఆ൛͕ͳ͔ͬͨ 4
ͦ͜ʹServerspec͕·ͬͨ 4 ͦΕʹΑΓ͜ͷτϨϯυΛߋʹՃͤ͞Δ͜ͱʹͳͬͨ
·ͱΊ
ServerspecͷޭཁҼ 4 ଞྖҬͰޭ͍ͯ͠ΔϓϥΫςΟεΛ࣋ͪࠐΉ 4 ςετۦಈ։ൃ/ܧଓతΠϯςάϨʔγϣϯ 4 ࠷ॳ͔ΒීٴΛҙࣝͨ͠׆ಈ 4 ໊લɺυΩϡϝϯτɺϝδϟʔϓϩμΫτʹͷ͔ͬΔ 4
γϯϓϧ͔֦ͭுՄೳʹ 4 UNIXֶ/Keep It Simple, Stupid
ServerspecͷޭཁҼ 4 ͑ͯ伱Λͭͬͯ͘ਓΛר͖ࠐΉ 4 τϨϯυʹͷ͔ͬΔ 4 ߏཧ+ԾԽ+ςετ+CI 4 ςετπʔϧҎ֎ͷఆ൪طʹ͋ͬͨ 4
伱ؒΛຒΊͨͷ͕Serverspec
ServerspecͷޭཁҼ 4 Өڹྗͷ͋ΔਓʹϦʔν͢Δ 4 ࠃͰҏ౻ࢯͷϒϩάΤϯτϦࡶࢽهࣄͷӨڹ ͕େ͖ͦ͏
ServerspecͷޭཁҼ 4 ٕज़τϨϯυΛੜΉͱ͔ߟ͑ͳ͍ 4 ੜ͏ͱࢥͬͯੜΊΔͷͰͳ͍ 4 ͕ࣗཉ͍͠ͷɺ͓͠Ζ͍ͱࢥ͏ͷΛࣗͷͨΊʹ ͭ͘Δ 4 ਓྨͷٕज़ൃలͨΊͷແঈ։ൃɺͱ͍͏ελϯεͰ͍
͍ͷͰ͖ͳ͍
·ͱΊ 4 ٕज़τϨϯυΛੜΈग़ۙ͢ಓͳ͍ 4 গͳ͘ͱࣗΒͳ͍ 4 ͕ͨͩࣗཉ͍͠ͷɺ͓͠Ζ͍ͱ͓͏ͷΛͭ͘Δ/ ެ։͢Δ 4 ͦͷੵΈॏͶ͕ૉΒ͍͠ͷΛੜΉ͜ͱʹͭͳ͕Δ
4 ͕ࣗͭͬͯ͘ެ։ͨ͠ͷɺখ͞ͳͷؚΊͯ100 Ҏ্͋Δ
Shut the fuck up and write some code Openness is
our driver for excellence ೭ऀෆ೭ऀ೭ऀෆᒜ೭ऀ