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
12k
Ruby JIT Hacking Guide / RubyKaigi 2023
k0kubun
2
9.4k
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
400
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
760
Ruby 3.0 JIT on Rails
k0kubun
9
9.1k
Other Decks in Programming
See All in Programming
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
RubyLSPのマルチバイト文字対応
notfounds
0
120
Jakarta EE meets AI
ivargrimstad
0
130
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
890
Quine, Polyglot, 良いコード
qnighy
4
640
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
Jakarta EE meets AI
ivargrimstad
0
590
CSC509 Lecture 09
javiergs
PRO
0
140
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
1.9k
CSC509 Lecture 11
javiergs
PRO
0
180
Featured
See All Featured
For a Future-Friendly Web
brad_frost
175
9.4k
Music & Morning Musume
bryan
46
6.2k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Teambox: Starting and Learning
jrom
133
8.8k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Navigating Team Friction
lara
183
14k
Designing for humans not robots
tammielis
250
25k
Happy Clients
brianwarren
98
6.7k
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