Slide 1

Slide 1 text

I/O 2019 Firebase and Cloud FJUG Osaka #3 #io19jp 19.05.26 @sakajunquality

Slide 2

Slide 2 text

Agenda - What’s new in Firebase - Firebase Serverless Computing

Slide 3

Slide 3 text

Who am I? - @sakajunquality - Google Developers Expert for Cloud - SRE at Ubie inc.

Slide 4

Slide 4 text

What’s new in Firebase

Slide 5

Slide 5 text

What's New in Firebase (Google I/O'19) https://www.youtube.com/watch?v=x8qTEMkZCPs

Slide 6

Slide 6 text

What’s new in Firebase? #io19 - ML Kit - Object Detection && Tracking API - Translation API - AutoML Vision Edge - Crashlytics - BigQuery - Firestore - Collection Group Query

Slide 7

Slide 7 text

What’s new in Firebase? #io19 - Cloud Functions - Schedule - Local Emulator - Performance Monitoring - Web - BigQuery - ...

Slide 8

Slide 8 text

https://firebase.googleblog.com/2019/05/whats-new- Google-IO-2019.html

Slide 9

Slide 9 text

Firebase Serverless Computing

Slide 10

Slide 10 text

GCP Serverless Computing - Cloud Functions - App Engine - Cloud Run Cloud Functions App Engine Cloud Run New

Slide 11

Slide 11 text

Firebase Serverless Computing - Cloud Functions - - Cloud Run Cloud Functions Cloud Run New

Slide 12

Slide 12 text

Cloud Functions - Deploy a function - Handle Request / Events - Request and Response HTTPS - Events from Cloud

Slide 13

Slide 13 text

Cloud Functions Example func Hello(ctx context.Context, m PubSubMessage) error { log.Println(string(m.Data)) // Your Logic Here... return nil }

Slide 14

Slide 14 text

Cloud Functions New - Scheduler - Local Emulator

Slide 15

Slide 15 text

Scheduler - Cloud Functions New - Schedule a function like cron - https://firebase.googleblog.com/2019/04/schedule-clo ud-functions-firebase-cron.html

Slide 16

Slide 16 text

Emulator - Cloud Functions New - Local Emulator - https://firebase.google.com/docs/functions/local-emul ator

Slide 17

Slide 17 text

Cloud Run - Deploy a container image - Listen $PORT - Request and Response HTTPS

Slide 18

Slide 18 text

Cloud Run - Managed Endpoint w/ SSL Termination - 5 min Timeout* Firebase - ~2GB RAM - 0 to 1000 instances scale - 1-80 concurrent requests - Pay for CPU and memory @100ms + Network Transfer

Slide 19

Slide 19 text

Cloud Run Example: app package main import ( "fmt" "log" "net/http" "os" ) func handler(w http.ResponseWriter, r *http.Request) { fmt. Fprintf(w, os.Getenv("HELLO_MESSAGE" )) } func main() { http. HandleFunc ("/", handler) log. Fatal(http.ListenAndServe (":8080", nil)) }

Slide 20

Slide 20 text

Cloud Run Example: Dockerfile FROM golang:1.12-alpine as build RUN apk add alpine-sdk WORKDIR $GOPATH/src/github.com/sakajunquality/hello COPY . . RUN go get -d -v ./... RUN go install -v ./... FROM alpine RUN apk add --no-cache ca-certificates COPY --from=build /go/bin/hello /usr/local/bin/hello

Slide 21

Slide 21 text

Differences? https://firebase.google.com/docs/hosting/serverless-overview

Slide 22

Slide 22 text

Where Should I Run My Code? Choosing From 5+ Compute Options (Cloud Next '19) https://www.youtube.com/watch?v=wzPmgWJ5fpU

Slide 23

Slide 23 text

Fastly Integration - All of them are covered with Fastly CDN - Cache can be control by HTTP headers

Slide 24

Slide 24 text

Thankyou