#Serverless #Toronto community members Matt Welke (https://www.linkedin.com/in/matt-welke/) and Kudz Murefu (https://www.linkedin.com/in/kudzanai-murefu-7b128886/) introduced Google Cloud Functions and #Firebase to the community at our August meetup. It was the true "by the people, for the people" event!
More info https://www.meetup.com/Serverless-Toronto/events/259718715/
Monday, Aug 12, 2019
1. Intro & Activity Update
2. Community Open Mic
3. Matt Welke: “A look at Google
4. Kudz Murefu: “Firebase Crash
ServerlessToronto.org Meetup Agenda
Why we do what we do?
Serverless is New Agile
Serverless Dev (gluing
other people’s APIs
and managed services)
helping Startups (and
MVPs & products)
We build bridges
Community (“Dev leg”),
and Front-end & Voice-
First folks (“UX leg”),
and empower UX
Achieve agility NOT by
“sprinting” faster (like in
Scrum), but by working
smarter (by using
bigger building blocks
and less Ops)
Upcoming Serverless Toronto Meetups
1. September 12, 2019: Serverless Design Patterns and
Best Practices – Mike Apted, Startup SA at AWS
2. October, 2019: Serverless CI/CD pipelines with AWS
CodePipeline and CodeBuild, vs CircleCI, vs Travis, vs
Seed – Frank Wang & Jay V
3. November or December: Serverless Heroes (authors
of “Serverless Applications with Node.js”) Slobodan
Stojanović & Aleksandar Simović will be here!
4. December or January, 2020: re:Invent recap –
Jonathan Dion, Senior Technical Evangelist at AWS
Intro to Google Cloud
Using gcloud to deploy a Node.js function with CORS support.
Google Cloud Functions
- HTTP trigger - Respond to HTTP request
- PubSub trigger - React (asynchronously) to message
- Storage - React to object added to bucket etc
- Firebase event triggers
- Runs on temporary container with no persistent disk.
- Cannot run background tasks after response sent
Google Cloud Functions
- Stays at 0 running containers when not triggered
- Scales up infinitely* as requests/messages come in
- Charged per 100ms of code running per backing
Interacting with Google Cloud
- See which cloud resources you have
- Explore marketplace
- CLI tool that can list, create, and destroy
- Can be used to automate
Demo - CORS
Demo - CORS (OPTIONS preflight)
OPTIONS preflight request
AWS Lambda Comparison
- Scale down to zero containers when not in use
- Charge per 100ms
- Only allow one request per container at a time
- Be careful with SQL connections!
- Be careful of expensive long running functions
- Support HTTP APIs and reacting to cloud events
➔ Nosql Cloud-hosted database.
➔ Clients share one database instance.
➔ Connected clients receive updates on data changes.
➔ Scale to 100,000 concurrent connections.
➔ Easily deploy static/dynamic web apps to a global CDN
➔ SSL built into Firebase Hosting
➔ Can pair with cloud functions to build microservices.
➔ Provides full versioning and release management with
Deploy Single page apps
Support for production grade dynamic single page apps
➔ Object storage service built for Google Cloud Storage.
➔ Robust uploads & downloads, restart where they stopped, saving your
users time and bandwidth.
➔ Built on same infrastructure powering Spotify and Google Photos.
➔ Storage scales automatically, so no need to migrate to any other provider
Firebase Cloud Functions
➔ Run backend code in response to events triggered by Firebase features and HTTPS requests.
➔ Automatically scales up computing resources to match the usage patterns of your users.
➔ As load ﬂuctuates(+/-), Google responds by rapidly scaling the number of virtual server instances
needed to run your function.
Pairing Cloud Functions with
Realtime Database triggers
➔ A change occurs in the database and an
event is triggered.
➔ Function is invoked when the event occurs
and performs its tasks.
➔ Function receives a data object that
contains a snapshot of the data stored in the
onWrite() On data create, update, or delete.
onCreate() On new data is creation.
onUpdate() On data is updated.
onDelete() On data is deleted.
Listen for specific events on the Realtime Database:
Cloud Storage triggers
➔ Upload object to storage bucket.
➔ Manipulate the object & its metadata in the function.
➔ Write object location to Realtime database.
➔ Re-upload updated object back to storage.