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
PEPABO EC tech conference ngx_mruby 2020
Search
Teppei Yano
June 24, 2020
Technology
1
1k
PEPABO EC tech conference ngx_mruby 2020
https://pepabo.connpass.com/event/179445/
Teppei Yano
June 24, 2020
Tweet
Share
More Decks by Teppei Yano
See All by Teppei Yano
okara updates
yano3
0
72
create puppet module
yano3
0
52
let me introduce you
yano3
0
100
next stage infrastructure
yano3
1
13k
Dynamic image transformation server Okara BETA
yano3
1
5.6k
calamel-okara-beta
yano3
1
11k
Other Decks in Technology
See All in Technology
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
180
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
3.2k
スクラムチームを立ち上げる〜チーム開発で得られたもの・得られなかったもの〜
ohnoeight
2
350
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.7k
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
210
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
300
スクラム成熟度セルフチェックツールを作って得た学びとその活用法
coincheck_recruit
1
140
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
520
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
130
Introduction to Works of ML Engineer in LY Corporation
lycorp_recruit_jp
0
100
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
470
強いチームと開発生産性
onk
PRO
34
11k
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
A Modern Web Designer's Workflow
chriscoyier
693
190k
Become a Pro
speakerdeck
PRO
25
5k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
89
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
How to train your dragon (web standard)
notwaldorf
88
5.7k
How GitHub (no longer) Works
holman
310
140k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Automating Front-end Workflow
addyosmani
1366
200k
Transcript
1 Χϥʔϛʔγϣοϓͱ ngx_mruby 2020 2020-06-24 ϖύϘ EC ςοΫΧϯϑΝϨϯε ECࣄۀ෦ Χϥʔϛʔγϣοϓάϧʔϓ
αʔϏεج൫νʔϜ ฏ @yano3
2 2 ฏ Yano Teppei @yano3 ʢͷ͞Μʣ ECࣄۀ෦ Χϥʔϛʔγϣοϓάϧʔϓ
αʔϏεج൫νʔϜ • https://twitter.com/yano3 • https://github.com/yano3 ⛷ ઇࢁ͕͖ ❄ ❄ ❄
3 ngx_mruby Section 1 3
4 ngx_mruby ͱ A Fast and Memory-Efficient Nginx Extension Mechanism
Scripting with mruby. 4
5 ngx_mruby ͱ 5 • mruby ΈࠐΈ͚ͷܰྔͳ Ruby ࣮ •
Ruby εΫϦϓτͰ nginx Λ֦ுՄೳ • ྨࣅͷͷͱͯ͠ lua-nginx-module (OpenResty)
6 ࠓ·Ͱͷ ngx_mruby ར༻ࣄྫ Section 2 6
7 ࠓ·Ͱͷ ngx_mruby ར༻ࣄྫ ಠࣗυϝΠϯৗ࣌SSLͷಈతূ໌ॻಡΈࠐΈ ৗ࣌SSL https://shop-pro.jp/ssl/ ΞʔΩςΫνϟ https://speakerdeck.com/hfm/gmo-hoscon-2016 ʢ΄΅ಉ͡ΞʔΩςΫνϟΛհͨ͠ࢿྉʣ
7
8 ৽ͨͳ ngx_mruby ར༻ࣄྫ Section 3 8
9 ৽ͨͳ ngx_mruby ར༻ࣄྫ ͱɺͦͷલʹ... ngx_mruby Λ࣮ͬͨͷલఏͱͳͬͨ৽ػೳ ΧϥʔϛʔWPΦϓγϣϯ ʹ͍ͭͯ 9
10 ΧϥʔϛʔWPΦϓγϣϯ Section 4 10
11 ΧϥʔϛʔWPΦϓγϣϯ ΧϥʔϛʔΞϓϦετΞ͔ΒΠϯετʔϧ https://app.shop-pro.jp/apps/74 11 ΧϥʔϛʔWPΦϓγϣϯͱ
12 12 ΧϥʔϛʔWPΦϓγϣϯͱ γϣοϓͷυϝΠϯ https://shop.example.com ͷԼͷύεʹ WordPress Λදࣔ https://shop.example.com/apps/note/ কདྷผͷύεͰଞͷ
Web ΞϓϦͷఏڙ͢Δ͜ ͱߟྀͨ͠ઃܭ ΧϥʔϛʔWPΦϓγϣϯ
13 13 ΞʔΩςΫνϟ ΧϥʔϛʔWPΦϓγϣϯ
14 14 ΞʔΩςΫνϟ ௨ৗͷγϣοϓΛදࣔ ΧϥʔϛʔWPΦϓγϣϯ
15 15 ΞʔΩςΫνϟ • /apps ΛؚΉύε app-proxy ʹϓ ϩΩγ •
app-proxy ͞ΒʹύεʹΑͬͯ ΞοϓετϦʔϜͷ Web ΞϓϦέʔ γϣϯʹϓϩΩγʢ /note ͳΒϩϦ ϙοϓʂϚωʔδυΫϥυͷΤϯ υϙΠϯτ※ʣ ※ WordPress Λىಈ͢ΔόοΫΤϯυͱͯ͠ϩϦϙοϓʂ ϚωʔδυΫϥυΛར༻͍ͯ͠·͢ɻ https://note.com/mclolipopjp/n/ncd713843e4f2 ΧϥʔϛʔWPΦϓγϣϯ
16 16 ΞʔΩςΫνϟ • ϩϦϙοϓʂϚωʔδυΫϥυଆ Ͱ host ϔομʹΑΓͦΕͧΕͷ WordPress ʹϓϩΩγ
ΧϥʔϛʔWPΦϓγϣϯ
17 17 ngx_mruby ͕ొ͢Δ2ͭͷϙΠϯτ • ಈతϧʔςΟϯά • cookie ͷϑΟϧλϦϯά ΧϥʔϛʔWPΦϓγϣϯ
18 ಈతϧʔςΟϯά Section 5 18
19 ಈతϧʔςΟϯά 19 ͜ͷΜͷ͓ ઌఔͷਤͷ...
20 20 ՝ • γϣοϓʢͷυϝΠϯʣͱύεʹΑͬͯҟͳ ΔΞοϓετϦʔϜʹϓϩΩγ͢Δ • ΧϥʔϛʔWPΦϓγϣϯΛ͍ͬͯͳ͍ γϣοϓϓϩΩγ͠ͳ͍ʢ404ʣ ಈతϧʔςΟϯά
21 21 ΞϓϦετΞ API Λհͯ͠ΠϯετʔϧใΛ࡞ ಈతϧʔςΟϯά
22 22 WPΦϓγϣϯͷ Web ΞϓϦ API ͔ΒγϣοϓใΛऔಘ͠... ಈతϧʔςΟϯά
23 23 γϣοϓͷυϝΠϯͱඥ͍ͨ WordPress Λ࡞ ಈతϧʔςΟϯά
24 24 ngx_mruby ϙΠϯτ
25 25 app-proxy ্ͷ ngx_mruby υϝΠϯͱύε͔ΒϓϩΩγઌΛฦ͢ API ʹϦΫΤετ ಈతϧʔςΟϯά
26 26 ngx_mruby ʹΑΓϓϩΩγઌʹಈతʹΞοϓετϦʔϜΛઃఆ ಈతϧʔςΟϯά
27 27 ngx_mruby Ͱղܾʂ • ϦΫΤετͷॲཧதʹ http Ͱ API ʹϦΫΤε
τ • ϓϩΩγͷΞοϓετϦʔϜΛಈతʹมߋ ಈతϧʔςΟϯά
28 cookie ͷ ϑΟϧλϦϯά Section 6 28
29 cookie ͷϑΟϧλϦϯά 29 ͜ͷΜͷ͓ ઌఔͷਤͷ...
30 30 ՝ • ಉ͡υϝΠϯ্ʹγϣοϓͱ WordPress ͕ଘ ࡏ͢ΔͨΊɺγϣοϓͷ cookie Λ
WordPress ͔Βࢀরɺૢ࡞Ͱ͖ͯ͠·͏ • WordPress ͷͬऔΓѱҙͷ͋ΔϓϥάΠ ϯ͕ଘࡏ͢ΔͱʹͳΔ cookie ͷϑΟϧλϦϯά
31 31 ղܾͷΞϓϩʔν • Χϥʔϛʔγϣοϓͷ cookie ʹ໊લʹಛఆ ͷϓϨϑΟοΫΛ͚Δ • app-proxy
Ͱ্هʹ֘͢Δ໊લͷ cookie cookie ϔομ set-cookie ϔομͱʹϑΟ ϧλ͢Δ cookie ͷϑΟϧλϦϯά
32 32 ngx_mruby ϙΠϯτ
33 33 cookie ͷϑΟϧλϦϯά ΞʔΩςΫνϟ
34 34 • ΞϓϦέʔγϣϯαʔό ͷલ໘ʹஔͨ͠ ngx_mruby Ͱ cookie ໊ͷ ϓϨϑΟοΫεΛண
• Web ΞϓϦέʔγϣϯʹ खΛೖΕΔඞཁͳ͠ cookie ͷϑΟϧλϦϯά
35 35 • ϓϨϑΟοΫεͷ͍ͨ ໊લͷ cookie app- proxy ͰϑΟϧλ͠
WordPress ͞ͳ͍ • WordPress ͔Βҙਤతʹ ϓϨϑΟοΫεΛ͚ͭͨ ໊લͰ set-cookie ϔομ ͕ૹΒΕͯϒϩοΫ cookie ͷϑΟϧλϦϯά
36 36 ngx_mruby Ͱղܾʂ • cookie ϔομΛؚΉϦΫΤετɺϨεϙϯε ֤ϔομΛࢀরɺॻ͖ࠐΈͰ͖Δ αϯϓϧίʔυ •
https://github.com/yano3/kankara/tree/master/ngx_mruby/cookie_add_prefix • https://github.com/yano3/kankara/tree/master/ngx_mruby/cookie_filter_by_prefix cookie ͷϑΟϧλϦϯά
37 ·ͱΊ Section 7 37
38 38 ·ͱΊ 2020ͷ ngx_mruby on Χϥʔϛʔγϣοϓ • ৽ͨʹ2ͭͷར༻ࣄྫΛհ ◦
ಈతϧʔςΟϯά ◦ cookie ϑΟϧλϦϯά • ࠓޙదࡐదॴͰ׆༻͍͖ͯ͠·͢ ngx_mruby ศརʂ