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
20k
快適なサービス開発を支える技術/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.6k
YJIT: Dive into Ruby's JIT compiler written in Rust / Rust.Tokyo 2022
k0kubun
1
2.1k
Towards Ruby 4 JIT / RubyKaigi 2022
k0kubun
3
11k
Optimizing Production Performance with MRI JIT / RubyConf 2021
k0kubun
1
420
Why Ruby's JIT was slow / RubyKaigi Takeout 2021
k0kubun
3
1.9k
数時間かかる週一リリースを毎日何度も爆速でできるようにするまで / CI/CD Conference 2021
k0kubun
21
14k
Ruby 3 JIT's roadmap / RubyConf China 2020
k0kubun
0
790
Ruby 3.0 JIT on Rails
k0kubun
9
9.2k
Other Decks in Programming
See All in Programming
テストコード書いてみませんか?
onopon
2
360
AWS Lambda functions with C# 用の Dev Container Template を作ってみた件
mappie_kochi
0
210
[Fin-JAWS 第38回 ~re:Invent 2024 金融re:Cap~]FaultInjectionServiceアップデート@pre:Invent2024
shintaro_fukatsu
0
310
バックエンドのためのアプリ内課金入門 (サブスク編)
qnighy
1
190
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
3.4k
Flatt Security XSS Challenge 解答・解説
flatt_security
0
800
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
440
asdf-ecspresso作って 友達が増えた話 / Fujiwara Tech Conference 2025
koluku
0
1.6k
Spring gRPC について / About Spring gRPC
mackey0225
0
130
CloudNativePGがCNCF Sandboxプロジェクトになったぞ! 〜CloudNativePGの仕組みの紹介〜
nnaka2992
0
150
知られざるDMMデータエンジニアの生態 〜かつてツチノコと呼ばれし者〜
takaha4k
3
970
HTML/CSS超絶浅い説明
yuki0329
0
200
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
The World Runs on Bad Software
bkeepers
PRO
66
11k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
980
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.5k
We Have a Design System, Now What?
morganepeng
51
7.4k
Code Reviewing Like a Champion
maltzj
521
39k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.2k
Faster Mobile Websites
deanohume
305
30k
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