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
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
77
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.7k
calamel-okara-beta
yano3
1
11k
Other Decks in Technology
See All in Technology
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
なぜCodeceptJSを選んだか
goataka
0
160
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
レンジャーシステムズ | 会社紹介(採用ピッチ)
rssytems
0
150
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
4
280
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
160
LINEスキマニにおけるフロントエンド開発
lycorptech_jp
PRO
0
330
サイボウズフロントエンドエキスパートチームについて / FrontendExpert Team
cybozuinsideout
PRO
5
38k
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
0
430
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
130
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
240
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
A better future with KSS
kneath
238
17k
A Tale of Four Properties
chriscoyier
157
23k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
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 ศརʂ