Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Cloud Functions for Firebase
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
k2wanko
June 23, 2017
Technology
350
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Cloud Functions for Firebase
https://nikkei.connpass.com/event/58121/
k2wanko
June 23, 2017
More Decks by k2wanko
See All by k2wanko
Sales AI Cloud "ailead" TSConfig Strictly Adopted / セールスAIクラウド「ailead」の TSConfig厳格化対応した話 /
k2wanko
4
2.1k
Google Analytics for Firebaseを 使うときに把握しておきたいこと / Keep in mind when using Google Analytics for Firebase
k2wanko
2
540
パスワードのない未来のための Firebaseで実装するFIDO2 / FIDO2 actualized by Firebase for the password-less future
k2wanko
5
2.6k
Firebase Auth& Performance Monitoring
k2wanko
0
390
What's New Firebase 2019 Q1 #FJUG #io19jp
k2wanko
5
2.7k
Firebase for Grow
k2wanko
5
1.1k
gosecを試してみた話 / try gosec
k2wanko
0
3.8k
最近のFirebase / Recent Firebase
k2wanko
4
1.7k
Firebase Japan User Group Introduction 2018 #FJUG
k2wanko
0
650
Other Decks in Technology
See All in Technology
Filter What the LLM Reads: RAG Governance with AgentCore Gateway
yakumo
0
110
AI駆動開発における開発環境のセキュリティの考え方
yamahiro
2
620
Obsidian Vault Architectures
x5gtrn
PRO
0
160
Claude Code on Bedrock で統制をかける小ネタ集/claude-code-bedrock-governance-tips
emiki
1
13k
野良MCPサーバーを排除せよ!MCPサーバーのガバナンス
yukiogawa
1
240
これだけは抑えておきたい!後悔しない re:Invent の過ごし方 / AWS re:Invent 2026 prestudy
kinunori
2
380
あなたのDartコードは丸見えかもしれない ~reFlutterで暴くFlutterアプリの中身と多層防御~
zozotech
PRO
0
160
AI時代の開発はウォーターフォールに回帰する? / development-with-ai-back-to-wf
okamototakuyasr2
0
120
契約で守るコンパウンドプロダクトのデザインシステム
yug1224
1
1.4k
AWS Continuum for Penetration Testing に Deep Dive してみる
asanoharuki
1
1.4k
AWSセキュリティで活用するAI機能
cmusudakeisuke
1
310
AIコーディングを実践してきた1年を振り返る / Looking Back on a Year of Practicing AI Coding
takedatakashi
1
140
Featured
See All Featured
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
560
How to train your dragon (web standard)
notwaldorf
96
6.9k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Why Our Code Smells
bkeepers
PRO
340
58k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
760
Mind Mapping
helmedeiros
1
410
4 Signs Your Business is Dying
shpigford
187
23k
Into the Great Unknown - MozCon
thekraken
41
2.8k
From π to Pie charts
rasagy
1
410
Practical Orchestrator
shlominoach
192
12k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Transcript
Cloud Functions on Firebase Hosting @k2wanko
Profile コキチーズ Twitter, GitHubはk2wanko Qiitaはkoki_cheese Firebase エンジョイ勢 お仕事はセキュリティエンジニア
Cloud Functions
Cloud Functions - Event駆動のPaaS - HTTP,PubSub,Cloud StorageのEventを受け取って実行される - Beta -
Node.jsをサポート - Goサポートも開発中(?) https://github.com/GoogleCloudPlatform/cloud-functions-go
Cloud Functions for Firebase
Cloud Functions for Firebase - Cloud Functions受け取れるEventにFirebaseのイベントも追加したもの - Realtime Database,
Analytics, Auth, Storage のイベントを受け取れる - Eventの追加をコードベースで追加できる どういうことができるのか? - RealtimeDBに書き込まれたイベントでメッセージの翻訳をすることができる - Storageに保存されたイベントで画像をwebpに変換する - HTTPトリガーでFirebase Custom Authのbackendにできる - ユーザが削除されたイベントで関連データを削除する - etc examples: https://github.com/firebase/functions-samples
Firebase Hosting
Firebase Hosting - 静的ファイルを配信できるサービス - 設定でSingle Page Application用のrewriteなどもできる - HTTP2対応
- Link headerを付けることでServer Pushも可能 - 高速なCDNがついてる - 独自ドメインを登録するだけで無料で証明書を発行してくれる <- 最高
Cloud Functions on Hosting
Cloud Functions on Hosting - Hostingで返すコンテンツを Cloud FunctionsのHTTPトリガーで動的に生成できる
つまりどういうことか?
HostingでServer Side Renderingができる!!
SSRの必要性 については次の記事を参考にしてください http://www.publickey1.jp/blog/17/server_side_renderingserver_side_rendering_ng- japan_2017.html 要約 - SEOのために - Performanceのために 課題
- 現状Node.jsでしかSSRできない - SSRの負荷はコストが高い - Node.jsなのでサーバ台数を増やさなければならない
過去の挑戦 - GAE/Goでやろうとした。 - 無料で抑えるには当時はGAE/Goが最適と判断 - GoでNode.jsのAPIを色々頑張らないといけないので辛すぎる - http://qiita.com/koki_cheese/items/13426921f0b5861725e5
Cloud Functions を使うと - 現状Node.jsでしかSSRできない - FunctionsはNode.jsが使える - SSRの負荷はコストが高い -
Vue.jsを使えばブロッキングしないので CPUを効率的に使える - Node.jsなのでサーバ台数を増やさなければならない - Functionsはスケールする(あなたの予算の限り...)
DEMO https://goo.gl/SiwKzo
Tips
リアルタイムデータベースの セキュリティルール辛い
Firebase Bolt使いましょう - セキュリティルールを記述するための言語 - TypeScriptで書かれている - コメントが書ける - コンパイルするとJSONを吐き出す
- https://github.com/firebase/bolt
CDNのコンテンツは いつ配信されるのか?
CDNについて キャッシュを返すかどうかは次の項目が一致するかどうかを見る - Hostname - Path - Query - Varyで指定されたHeaderの値
Varyの初期値はAccept-Encoding, Authorization, Cookieがセットされているので 一般的なユーザー識別の方法を取っていれば 別のユーザーにコンテンツをCDNが配信してしまうということは起きにくい
Enjoy Function!
Reference - https://github.com/k2wanko/vue-hackernews-2.0/tree/firebase-hosting - https://firebase.google.com/docs/ - https://firebase.google.com/docs/functions - https://firebase.google.com/docs/hosting/functions