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
快適なサービス開発を支える技術/Cookpad TechConf 2017
Search
Takashi Kokubun
January 21, 2017
Programming
19
19k
快適なサービス開発を支える技術/Cookpad TechConf 2017
Cookpad TechConf 2017
https://techconf.cookpad.com/2017/
Takashi Kokubun
January 21, 2017
Tweet
Share
More Decks by Takashi Kokubun
See All by Takashi Kokubun
YJIT Makes Rails 1.7x faster / RubyKaigi 2024
k0kubun
7
13k
Ruby JIT Hacking Guide / RubyKaigi 2023
k0kubun
2
9.5k
YJIT: Dive into Ruby's JIT compiler written in Rust / Rust.Tokyo 2022
k0kubun
1
2k
Towards Ruby 4 JIT / RubyKaigi 2022
k0kubun
3
11k
Optimizing Production Performance with MRI JIT / RubyConf 2021
k0kubun
1
410
Why Ruby's JIT was slow / RubyKaigi Takeout 2021
k0kubun
3
1.8k
数時間かかる週一リリースを毎日何度も爆速でできるようにするまで / CI/CD Conference 2021
k0kubun
21
14k
Ruby 3 JIT's roadmap / RubyConf China 2020
k0kubun
0
770
Ruby 3.0 JIT on Rails
k0kubun
9
9.1k
Other Decks in Programming
See All in Programming
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
170
命名をリントする
chiroruxx
1
400
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
情報漏洩させないための設計
kubotak
0
120
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
130
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
270
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
250
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
110
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
1
650
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
540
HTTP compression in PHP and Symfony apps
dunglas
2
1.7k
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Unsuck your backbone
ammeep
669
57k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Building Adaptive Systems
keathley
38
2.3k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Transcript
շదͳαʔϏε։ൃΛࢧ͑Δٕज़ Cookpad TechConf 2017 Takashi Kokubun
ࣗݾհ ▸ ࠃ ਸࢤ / Takashi Kokubun ▸ ٕज़෦ ։ൃج൫άϧʔϓ
▸ GitHub, Twitter: @k0kubun @k0kubun
ΫοΫύου ։ൃޮ্ͷͨΊʹ ԿΛ͍ͯ͠Δͷ͔
ࠓ͢͜ͱ ΫοΫύου͕ՁΛಧ͚ΔαΠΫϧ 2. ։ൃ 3. ςετ 4. σϓϩΠ 5. ࢹ
1. ։ൃڥͷ ηοτΞοϓ
ࠓ͢͜ͱ ΫοΫύου͕ՁΛಧ͚ΔαΠΫϧ 2. ։ൃ 3. ςετ 4. σϓϩΠ 5. ࢹ
1. ։ൃڥͷ ηοτΞοϓ ▸ ͜ͷதͰͲͷΑ͏ͳΛ ߦ͍ͬͯΔ͔հ͠·͢ (WebΞϓϦͷΛத৺ʹ͠·͢)
։ൃڥΛ͑Δ্Ͱେʹ͍ͯ͠Δ͜ͱ ࠓ͢͜ͱ ▸ αʔϏε։ൃऀͷੜ࢈ੑΛୈҰʹߟ͑ͯ։ൃڥΛ ͍͑ͯΔ ▸ ͨͩ͠ɺతϢʔβʔʹ͘͢ՁΛಧ͚Δ͜ͱͰ͋Δ ͜ͱΛΕͳ͍
1. BOOTSTRAP EFFORTS TO IMPROVE PRODUCTIVITY IN
1. ։ൃڥͷηοτΞοϓʹ͓͚Δ ▸ curl https://ͻΈͭ/setup.sh | bash ▸ ͜ͷίϚϯυҰൃͰ Rails,
iOS(macOSͷΈ), Android, ػցֶश ͷ։ൃڥ͕͏ ▸ ͦͷޙͷߋ৽ద༻ίϚϯυҰൃ ։ൃڥͷηοτΞοϓํ๏
setup.sh macOS, Linux ͷͲͪΒͰಈ࡞ ▸ ΫοΫύουͷ։ൃऀجຊmacOSΛར༻ ▸ LinuxΛ͍͍ͨਓ͚ʹLinuxαϙʔτ 1.
։ൃڥͷηοτΞοϓʹ͓͚Δ
setup.sh ͰԿΛ͍ͯ͠Δͷ͔ ▸ ߏཧεΫϦϓτͷμϯϩʔυ ▸ Chef෩ͷRuby DSLͰهड़͞Ε͍ͯΔ ▸ DSLʹΑͬͯOSͳͲͷڥͷࠩҟΛٵऩ͍͢͠ ▸
ߏཧπʔϧͷ࣮ߦ ▸ mrubyͰ࡞ΒΕͨMItamaeͱ͍͏πʔϧΛར༻͍ͯ͠Δ 1. ։ൃڥͷηοτΞοϓʹ͓͚Δ
setup.sh ͰԿΛ͍ͯ͠Δͷ͔ ▸ Chef෩ͷRuby DSL (Itamae DSL) 1. ։ൃڥͷηοτΞοϓʹ͓͚Δ package
'memcached' package 'postgresql'
setup.sh ͰԿΛ͍ͯ͠Δͷ͔ ▸ Chef෩ͷRuby DSL (Itamae DSL) 1. ։ൃڥͷηοτΞοϓʹ͓͚Δ package
'memcached' package 'postgresql' brew install memcached brew install postgresql macOS
setup.sh ͰԿΛ͍ͯ͠Δͷ͔ ▸ Chef෩ͷRuby DSL (Itamae DSL) 1. ։ൃڥͷηοτΞοϓʹ͓͚Δ package
'memcached' package 'postgresql' apt-get install -y memcached apt-get install -y postgresql brew install memcached brew install postgresql Ubuntu macOS
mrubyͰ࡞ΒΕͨߏཧπʔϧ: MItamae ▸ https://github.com/k0kubun/mitamae ▸ ChefϥΠΫͰܰྔͳߏཧπʔϧItamaeͷmruby࣮ ▸ ϩʔΧϧڥͷద༻ʹಛԽ͓ͯ͠ΓɺItamaeΑΓߴ ▸ γϯάϧόΠφϦͰϦϦʔε
▸ mrubyͰ࡞͍ͬͯΔͨΊɺRubyͷॲཧܥ͕ͳͯ͘ ࣮ߦՄೳ 1. ։ൃڥͷηοτΞοϓʹ͓͚Δ
ͳͥmrubyͰ࡞ΒΕͨπʔϧΛ͍ͬͯΔͷ͔ ▸ Rubyͩͱ࠷ͰItamae gemΛ͏ඞཁ͕͋Γɺ࣮ߦ࣌ͷ ґଘ͕ଟ͘ͳΔ ▸ ։ൃऀͷRubyͷڥΛ࣮ͬͯߦ͢Δͱɺ։ൃऀͷRubyͷ ڥ͕յΕͨ࣌ʹ࠶ηοτΞοϓͰ͖ͳ͘ͳΔ ▸ ͦͷmrubyͩͱόΠφϦ͑͋͞Εಈ͘
▸ Ruby͕ೖͬͯͳ͍LinuxσΟετϦϏϡʔγϣϯͰɺ εΫϦϓτ࣮ߦલʹRubyΛ͍Ε͓ͯ͘ඞཁ͕ͳ͍ 1. ։ൃڥͷηοτΞοϓʹ͓͚Δ
ڥηοτΞοϓʹ͓͚Δ ·ͱΊ ▸ ίϚϯυΛҰൃୟ͚ͩ͘Ͱ։ൃ͕࢝ΊΒΕΔ ▸ mrubyΛͬͯηοτΞοϓπʔϧͷґଘΛݮΒ͠ɺ յΕʹͨ͘͘͠ 1. ։ൃڥͷηοτΞοϓʹ͓͚Δ
2. DEVELOPMENT EFFORTS TO IMPROVE PRODUCTIVITY IN
ڞ༻ͷ։ൃ༻σʔλϕʔε ▸ ։ൃڥͷWebΞϓϦڞ༻ͷ։ൃ༻σʔλϕʔεʹଓ ͞Ε͍ͯΔ ▸ ͜ͷσʔλϕʔεຊ൪͔Βσʔλ͕ϨϓϦ͞Εͯ͘Δ ▸ cookpad.com͚ͩͰͳ͘ଟ͘ͷΞϓϦͰ։ൃڥ͚ʹ ϨϓϦΛઃఆ͍ͯ͠Δ 2.
։ൃʹ͓͚Δ
։ൃ༻σʔλϕʔεͷ ▸ ςʔϒϧ໊ΧϥϜ໊ʹsecure_ΛؚΉ߹ϨϓϦ͠ͳ͍ ▸ ΧϥϜΛ૿ͯ͠ϨϓϦ͕ࢭ·Βͳ͘͢Δ ▸ ϨϓϦ͞Εͯ͘Δσʔλͱ։ൃڥͰೖΕͨσʔλͱ ίϯϑϦΫτͤ͞ͳ͍ ▸ ݖݶΛదʹཧ͠ɺ҆қʹσʔλϕʔεΛDROPͤ͞ͳ͍
2. ։ൃʹ͓͚Δ
։ൃ༻σʔλϕʔεͷ ▸ ςετσʔλΛߘ͢Δ࣌Ͱɺຊ൪ڥʹߘ͢Δ ͭΓͰಈ࡞֬ೝΛߦ͏ ▸ มͳσʔλΛ͍ΕΔͱຊ൪Ͱͷମݧͱ։ൃ࣌ͷମݧ͕ ҟͳͬͯ͠·͏ ▸ ৗʹϢʔβʔͷମݧΛҙࣝͯ͠։ൃ͢Δ 2.
։ൃʹ͓͚Δ
ϚΠΫϩαʔϏεԽ ▸ ҎલશͯͷνʔϜͰҰͭͷWebΞϓϦΛ։ൃ͍͕ͯͨ͠ɺ ։ൃ͕େมͩͬͨ ▸ ςετ͕૿͑ɺCIʹ͔͔Δ͕࣌ؒංେԽ ▸ ΫΤϦґଘ͢ΔϞδϡʔϧ͕ଟ͘ɺ։ൃڥ͕ॏ͍ ▸ मਖ਼͕ٴ΅͢Өڹൣғ୲ػೳͷڥք͕Θ͔Βͳ͘ͳΔ
▸ ෦ॺνʔϜ୯ҐͰαʔϏεΛΓग़͢͜ͱͰ ։ൃͨ͘͢͠͠ 2. ։ൃʹ͓͚Δ
ϚΠΫϩαʔϏεԽΛαϙʔτ͢Δπʔϧ ▸ Garage: API༻ͷϑϨʔϜϫʔΫΛ༻͍ͯ ΠϯλʔϑΣʔεΛ౷Ұ ▸ Pact: αʔϏεؒ௨৴ʹ͓͚ΔഁյతมߋΛCI Ͱݕग़ ▸
Expeditor: αʔϏεڥքͰͷฒྻԽͱোͷϋϯυϦϯά 2. ։ൃʹ͓͚Δ
։ൃʹ͓͚Δ ·ͱΊ ▸ ຊ൪͔ΒϨϓϦ͞ΕΔσʔλϕʔεΛ͍ɺ Ͱ͖Δ͚ͩຊ൪ʹ͍ۙϢʔβʔମݧΛ࠶ݱ ▸ ։ൃ͢͠͞Λ୲อ͠ͳ͕Βదͳ୯ҐͰ ΞϓϦέʔγϣϯΛׂ͍ͯ͠Δ 2. ։ൃʹ͓͚Δ
3. TESTING EFFORTS TO IMPROVE PRODUCTIVITY IN
JenkinsΛͬͨࣗಈςετ ▸ JenkinsΛͬͯmasterͷίϛοτPR୯ҐͰςετΛ ࣮ߦ͠ɺૉૣ͘ʹؾ͚ΔΑ͏ʹ͍ͯ͠Δ ▸ JenkinsδϣϒͰςετ͕௨ͬͨϦϏδϣϯ͚͕ͩσϓϩΠ ͞ΕΔΑ͏ʹ͍ͯ͠Δ ▸ Ϣʔβʔʹ໎͕͔͔Βͳ͍Α͏ʹ͢ΔͨΊ 3.
ςετʹ͓͚Δ
ςετΛࣦഊͤͨ͞ϢʔβʔʹSlackͰϝϯγϣϯ ▸ ςετ͕མͪͨίϛοτΛͨ͠ਓʹSlackͰϝϯγϣϯ͢Δ ಠࣗJenkinsϓϥάΠϯ ▸ 2016ʹHipChat→SlackʹҠߦ ▸ GHESlackͳͲͷΞΧϯτใΛ·ͱΊΔࣾ γεςϜͱ࿈ܞ 3.
ςετʹ͓͚Δ
ςετΛࣦഊͤͨ͞ϢʔβʔʹSlackͰϝϯγϣϯ 3. ςετʹ͓͚Δ
ςετ༻ΞϓϦέʔγϣϯͷࣗಈσϓϩΠ ▸ खಈͰಈ࡞֬ೝ͢ΔͨΊͷڥʹΞϓϦ͕ࣗಈͰσϓϩΠ ͞ΕΔ ▸ ΄΅ຊ൪ʹ͍ۙڥΛ࠶ݱ ▸ ಈ࡞֬ೝΛΈԽ͢Δ͜ͱͰ࣭Λ୲อ 3. ςετʹ͓͚Δ
ߴͳςετ࣮ߦ: RRRSpec ▸ ςετ͕ଟ͍ΞϓϦέʔγϣϯͰߴʹςετ͕ ऴΘΔΑ͏ࢄ࣮ߦ ▸ εϙοτΠϯελϯεΛ׆༻ͯ҆͠Ձʹ࣮ݱ 3. ςετʹ͓͚Δ
ςετʹ͓͚Δ ·ͱΊ ▸ ࣗಈͰߴʹςετ͠ɺૉૣ͘ʹؾ͚ΔΑ͏ʹ ͍ͯ͠Δ ▸ ಈ࡞֬ೝΛָʹ͢ΔΈΛ࡞ΓɺͳΔ͘Ϣʔβʔʹ ໎͕͔͔Βͳ͍Α͏ʹ͍ͯ͠Δ 3. ςετʹ͓͚Δ
4. DEPLOYMENT EFFORTS TO IMPROVE PRODUCTIVITY IN
Chat bot, RundeckΛͬͨσϓϩΠ ▸ SlackͰ ruboty deploy cookpad ͱൃݴͯ͠σϓϩΠ ▸
ruboty: RubyͷChat bot ▸ σϓϩΠRundeck্ͰߦΘΕɺଞͷਓϩάΛ ݟΔ͜ͱ͕Ͱ͖Δ ▸ ݖݶཧ͞Ε͓ͯΓɺ։ൃऀ͔͠σϓϩΠͰ͖ͣɺ audit logΔ 4. σϓϩΠʹ͓͚Δ
Amazon ECSΛͬͨαʔϏεͷσϓϩΠ ▸ Amazon ECSͷσϓϩΠʹͷσϓϩΠπʔϧʮHakoʯΛར༻ ▸ https://github.com/eagletmt/hako ▸ AWSͷαʔϏεڥม͕YAMLͰཧ͞Ε͓ͯΓɺ αʔϏε։ൃऀ͕
pull request ϕʔεͰมߋͰ͖Δ ▸ RundeckͷίϯιʔϧͰ hako deploy ͕࣮ߦ͞ΕɺAmazon ECS্ʹ Dockerίϯςφ͕σϓϩΠ͞ΕΔ ▸ DockerͷͨΊɺϝΠϯͰ͍ͬͯΔRubyҎ֎ͷݴޠͰσϓϩΠ͕ ༰қ 4. σϓϩΠʹ͓͚Δ
σϓϩΠՄೳ࣌ؒ ▸ ݄ʙ༵ͷ 9:30-17:00 or ༵ۚͷ 9:30-15:00 ͔͠ σϓϩΠͰ͖ͳ͍ ▸
Ϣʔβʔʹ໎͕͔͔Βͳ͍Α͏ɺΠϯϑϥ͕ࢹ Ͱ͖ͳ͍ٳͷલσϓϩΠ͠ͳ͍ ▸ ruboty͔ΒσϓϩΠ͠Α͏ͱ͢ΔͱνΣοΫ͞ΕΔ 4. σϓϩΠʹ͓͚Δ
σϓϩΠՄೳ࣌ؒ 4. σϓϩΠʹ͓͚Δ
σϓϩΠϩοΫ ▸ ͙͢ʹσϓϩΠ͞ΕΔͱࠔΔΑ͏ͳมߋΛͨ࣌͠ͷͨΊͷ ҆શஔ ▸ RundeckͷδϣϒΛdisable͢ΔAPIΛୟ͍ͯϩοΫ ▸ ΫοΫύουͷΑ͏ʹ Docker ΛΘͣී௨ͷ
EC2 ΠϯελϯεʹσϓϩΠ͞Ε͍ͯΔҰ෦ͷαʔϏεͰɺ Φʔτεέʔϧ͍ͯ͠Δ࣌ࣗಈͰϩοΫ͞ΕΔ 4. σϓϩΠʹ͓͚Δ
σϓϩΠϩοΫ 4. σϓϩΠʹ͓͚Δ
σϓϩΠϩοΫ 4. σϓϩΠʹ͓͚Δ
σϓϩΠϩοΫ 4. σϓϩΠʹ͓͚Δ
HakoΛͬͨδϣϒͷ࣮ߦ ▸ HakoαʔϏεͷσϓϩΠ͚ͩͰͳ͘ɺAmazon ECS্Ͱ ίϚϯυΛ࣮ߦ͢Δͷʹ͑Δ (hako oneshotίϚϯυ) ▸ ΦϑϥΠϯδϣϒ hako
oneshot ΛͬͯECS্Ͱ࣮ߦ͞ΕΔ ▸ δϣϒεέδϡʔϥ(Kuroko2)δϣϒΩϡʔ(Barbeque)͕ HakoΛαϙʔτ͍ͯ͠ΔͨΊ ▸ ςετΛ௨͍ͬͯΔ࠷৽ͷϦϏδϣϯΛ͏Α͏ʹͳ͓ͬͯΓɺ σϓϩΠ͕ෆཁ (ඞཁͳ߹Slack͔ΒϩοΫՄೳ) 4. σϓϩΠʹ͓͚Δ
σϓϩΠʹ͓͚Δ ·ͱΊ ▸ Ruboty, Rundeck, Hako, ECSΛར༻ͨ͠σϓϩΠڥ ▸ σϓϩΠʹΑͬͯϢʔβʔʹ໎͕͔͔Γʹ͍͘Έʹ͠ ͍ͯΔ
4. σϓϩΠʹ͓͚Δ
5. MONITORING EFFORTS TO IMPROVE PRODUCTIVITY IN
Sentry, SlackΛͬͯΤϥʔΛࢹ ▸ ΤϥʔϩάfluentdΛ௨ͯ͡Sentryʹૹ৴͞ΕΔ ▸ σϓϩΠޙSentryΛࢹ͠ɺԿ͔Τϥʔ͕ى͖ͨΒରԠ ͢Δ ▸ Sentry͔ΒSlackʹ௨͞ΕΔ 5.
ࢹʹ͓͚Δ
δϣϒ͕ࣦഊͨ͠ΒSlackϝʔϧͰ௨ ▸ ΦϑϥΠϯδϣϒ͕ࣦഊͨ͠߹SlackͰ௨Ͱ͖Δ ▸ Kuroko2Barbeque͕Slackͷ௨Λαϙʔτ ▸ BarbequeͰ࣮ߦ͍ͯ͠ΔδϣϒɺҰ෦ͷΤϥʔࣗಈͰ ϦτϥΠΛઃఆ͍ͯ͠Δ 5. ࢹʹ͓͚Δ
ECSͷϩάʹෆ৹ͳϩά͕ͳ͍͔֬ೝ ▸ HakoͰσϓϩΠͨ͠αʔϏεͷϩάࣾγεςϜͰ ϩάΛҰཡͰ͖Δ ▸ αʔόʔʹsshͯ͠lesstail -fΛ͢ΔΑΓख͕ؒগͳ͍ 5. ࢹʹ͓͚Δ
αʔϏεͷোZabbixͰࢹ ▸ αʔϏεͷোZabbixͰࢹ ▸ ࣗಈͰSlackʹ௨ ▸ waker (https://github.com/ryotarai/waker) ͱ࿈ܞͯ͠ TwilioͰి͕͔͔Δ
▸ ओʹΠϯϑϥ͕൪੍Ͱ24࣌ؒରԠ 5. ࢹʹ͓͚Δ
ࢹʹ͓͚Δ ·ͱΊ ▸ Կ͔ى͖ͨΒ͙͢ʹؾ͚ΔΑ͏ͳΈʹ͍ͯ͠Δ ▸ Τϥʔͳ͘ՁΛಧ͚Δͱ͜Ζ·Ͱ͕αʔϏε։ൃ 5. ࢹʹ͓͚Δ
։ൃڥΛ͑Δ্Ͱେʹ͍ͯ͠Δ͜ͱ ;Γ͔͑Γ ▸ αʔϏε։ൃऀͷੜ࢈ੑΛୈҰʹߟ͑ͯ։ൃڥΛ ͍͑ͯΔ ▸ ͨͩ͠ɺతϢʔβʔʹ͘͢ՁΛಧ͚Δ͜ͱͰ͋Δ ͜ͱΛΕͳ͍
ิεϥΠυ ▸ ӈ্ͷΞΠίϯͦͷࢪࡦʹؔΘͬͨਓͷGitHubΞΠίϯ Λද͓ͯ͠ΓɺؔΘΓ͕େ͖͍ਓॱʹࠨ͔ΒฒΜͰ͍·͢ adorechic amutake draftcode eagletmt eisuke EugeneKato
k0kubun makimoto miyagawa ryotarai sorah taiki45 takai