Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Serverspec at JTF2014
Search
Gosuke Miyashita
June 22, 2014
Technology
16
6.5k
Serverspec at JTF2014
Gosuke Miyashita
June 22, 2014
Tweet
Share
More Decks by Gosuke Miyashita
See All by Gosuke Miyashita
なぜインフラコードのモジュール化は難しいのか - アプリケーションコードとの本質的な違いから考える
mizzy
63
23k
Serverspec(をつくった自分)のそれまでとその後
mizzy
9
3.2k
A method for separating policy definition and behavior control by an intermediate language to achieve optimal server configuration management according to the situation
mizzy
3
280
Past and future of Infrastructure as Code
mizzy
0
310
Configuration Managementツールのポリシー定義用中間言語に関する考察/Considerations about an intermediate language of configuration management tools
mizzy
0
490
Infrastructure as Codeのこれまでとこれから/Infra Study Meetup #1
mizzy
28
13k
エンジニアかつ研究者としての今後のキャリアについて/My Career As An Engineer And A Researcher
mizzy
0
420
Compare OCI Runtimes
mizzy
2
1.6k
Serverspec and OSS at IEICE Society Conference 2018
mizzy
2
330
Other Decks in Technology
See All in Technology
Dify on AWS の選択肢
ysekiy
0
120
20251127 BigQueryリモート関数で作る、お手軽AIバッチ実行環境
daimatz
0
340
AI エージェント活用のベストプラクティスと今後の課題
asei
2
400
AS59105におけるFreeBSD EtherIPの運用と課題
x86taka
0
310
日経電子版の BCP への取り組みについて/mediajaws1121
nikkei_engineer_recruiting
0
110
IPv6-mostly field report from RubyKaigi 2026
sorah
0
230
Eight Engineering Unit 紹介資料
sansan33
PRO
0
5.6k
Digital omtanke på Internetdagarna 2025
axbom
PRO
0
140
AWS re:Invent 2025 で頻出の 生成 AI サービスをおさらい
komakichi
3
260
Bedrock のコスト監視設計
fohte
2
250
雲勉LT_Amazon Bedrock AgentCoreを知りAIエージェントに入門しよう!
ymae
2
230
Pandocでmd→pptx便利すぎワロタwww
meow_noisy
2
1k
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
72
12k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
Making Projects Easy
brettharned
120
6.5k
YesSQL, Process and Tooling at Scale
rocio
174
15k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Code Reviewing Like a Champion
maltzj
527
40k
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 ೭ऀෆ೭ऀ೭ऀෆᒜ೭ऀ