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
Firebase Japan User Group - meetup #9
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
kappa0923
January 17, 2019
Programming
830
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Firebase Japan User Group - meetup #9
kappa0923
January 17, 2019
Other Decks in Programming
See All in Programming
カツオ、ご期待ください
suneo3476
0
180
Are APIs Still Relevant in the AI Era?
soyuka
0
460
mrbgem 三角測量 開発
ogom
0
240
残高管理から台帳サービスへの進化
artoy
1
200
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
360
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.6k
最近”作らせてる” ローカルAIアプリの話
akit37
0
460
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
150
パズルゲームの作り方 / how to make puzzle games
kaityo256
PRO
2
290
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
22
22k
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
410
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
Featured
See All Featured
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
320
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
The SEO identity crisis: Don't let AI make you average
varn
0
590
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
540
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
520
Believing is Seeing
oripsolob
1
240
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
350
Designing Experiences People Love
moore
143
24k
Into the Great Unknown - MozCon
thekraken
41
2.8k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
300
Transcript
Cloud FunctionsでURL短縮 サービスを作ろう! Firebase Meetup #9 Cloud Functions Day @Google
kappa0923
Agenda ▸ 自己紹介 ▸ Cloud Functionsで何を作るか? ▸ どうやって作るのか ▸ ついでにCIも考える
▸ まとめ 2
Self Introduction ▸ 渡辺 友康 ▹ kappa0923 ▸ 株式会社アイソルート クラウドソリューショングループ所属
▹ クラウド周りのアーキテクトやってます ▸ SNS ▹ GitHub : kappa0923 ▹ Twitter : @tom_kappa0923 ▸ Other ▹ GDG Tokyo オーガナイザー 3
今日のターゲット 4 経験者 初学者 この辺
Cloud Functionsで 何を作るか?
何を作るか? URL短縮サービスを作ります! ↓ https://nabe.ga/ 6
何を作るか? なんで? 7
何を作るか? GitHubにCloudFunctionsを利用した URL短縮のサンプルがあった https://github.com/firebase/functions-samples/t ree/Node-8/url-shortener けどBit.lyのAPIを使ってる。。。 8
何を作るか? これなら自分で作っても良いのでは
どうやって作るか
どうやって作るか 11 ▸ Cloud FunctionsでCloud Firestoreから リダイレクト先のURLを読み込み、 301リダイレクトのレスポンスをすればOK
どうやって作るか 12 ▸ リダイレクトの処理はFunctionsの 関数を呼び出すように、firebase.jsonに rewrite設定をしておく ▸ これで独自ドメインで関数が呼び出せる
どうやって作るか 13 ▸ Firestoreからの読み込みにはFunctionsで Firebase Admin SDKを使うので FirestoreのルールはロックモードでOK!
どうやって作るか 14 ▸ でもFunctionsの実行回数が心配。。。 ▸ なら、キャッシュさせてしまおう! cf. https://firebase.google.com/docs/hosting/functions?hl=ja#manage_cach e_behavior
ついでにCIも考える
ついでにCIも考える 16 ▸ せっかくなのでCIも実現しよう! cf. https://www.isoroot.jp/blog/1349/ ▸ GOOGLE_APPLICATION_CREDENTIALSを 使ってサービスアカウントでデプロイする cf.
https://github.com/firebase/firebase-tools/releases/tag/v6.1.0 ▸ 注意 : Firebase Hosting APIを有効にしておく必要あり
ついでにCIも考える 17 ▸ CircleCIだとこんな感じ
ついでにCIも考える 18 ▸ Hostingのデプロイは成功するのに Functionsのデプロイに失敗する。。。 ▸ どうやらバグらしい https://github.com/firebase/firebase-tools/issues/787 ▸
まとめ
まとめ 20 ▸ Cloud FunctionsとHostingのちょっと 変わった使い方を紹介しました ▸ 節約のためにCacheは上手く使いましょう ▸ Firebaseは小さいプロダクトを素早く試すのに◎
いろいろ作ってみよう!
お疲れ様でした 何か質問があれば