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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
AWS Transform Customによる Spring Boot 2.xから4.xへのVerUp
satoshi256kbyte
2
130
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
0
210
Hono + Inertia + React で LP を構築した話
oukayuka
2
200
異なる設計思想のフレームワークを経験して得た学び
amekuhideki
2
1.4k
Press start. Python's next generation.
willingc
PRO
3
300
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
130
初めての模倣学習とVLA
natsutan
0
420
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
140
MySQLとPostgreSQLって何が違うの?
akagami
PRO
0
160
AIに既存システムを理解させる技術 ~レガシーを見捨てないハーネスエンジニアリング入門~
ochtum
0
200
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
0
130
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1.6k
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
3.9k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
440
Google's AI Overviews - The New Search
badams
0
1.6k
Making the Leap to Tech Lead
cromwellryan
135
10k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
320
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
250
Fireside Chat
paigeccino
42
4k
Building the Perfect Custom Keyboard
takai
2
860
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Bash Introduction
62gerente
615
220k
Paper Plane
katiecoart
PRO
2
53k
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は小さいプロダクトを素早く試すのに◎
いろいろ作ってみよう!
お疲れ様でした 何か質問があれば