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
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
760
Ruby 3.0 JIT on Rails
k0kubun
9
9.1k
Other Decks in Programming
See All in Programming
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.3k
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
610
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
290
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.5k
Jakarta EE meets AI
ivargrimstad
0
600
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
初めてDefinitelyTypedにPRを出した話
syumai
0
400
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
430
Featured
See All Featured
Bash Introduction
62gerente
608
210k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
How GitHub (no longer) Works
holman
310
140k
Scaling GitHub
holman
458
140k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
A Modern Web Designer's Workflow
chriscoyier
693
190k
Happy Clients
brianwarren
98
6.7k
It's Worth the Effort
3n
183
27k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
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