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
Firebase Japan User Group - meetup #9
Search
kappa0923
January 17, 2019
Programming
820
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
メールのエイリアス機能を履き違えない
isshinfunada
0
240
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
470
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
500
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
530
これって Effect でできたのでは? / TSKaigi Mashup Kansai #2
susisu
0
240
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
190
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
240
yield再入門 #phpcon
o0h
PRO
0
1.1k
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
940
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
410
torikago - Ruby::Boxで照らすモジュラモノリスの実行境界
se4weed
1
380
the container ship “Apple Silicon”@WWDC26 Recap -Japan-\(region).swift
shingangan
0
130
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Navigating Weather and Climate Data
rabernat
0
480
Agile that works and the tools we love
rasmusluckow
331
22k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.4k
Test your architecture with Archunit
thirion
1
2.3k
Exploring anti-patterns in Rails
aemeredith
3
460
WCS-LA-2024
lcolladotor
0
800
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
290
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
200
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
350
Discover your Explorer Soul
emna__ayadi
2
1.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
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は小さいプロダクトを素早く試すのに◎
いろいろ作ってみよう!
お疲れ様でした 何か質問があれば