Full Stack Kotlin on Google Cloud Brent Shaffer, Google Cloud DPE - - PowerPoint PPT Presentation

full stack kotlin on google cloud
SMART_READER_LITE
LIVE PREVIEW

Full Stack Kotlin on Google Cloud Brent Shaffer, Google Cloud DPE - - PowerPoint PPT Presentation

KotlinConf, Amsterdam Oct 4, 2018 Full Stack Kotlin on Google Cloud Brent Shaffer, Google Cloud DPE bshaffe r Brent Shaffer No language makes you feel more like a cog in a machine than Java Google Employee who will remain anonymous 3


slide-1
SLIDE 1 bshaffe r KotlinConf, Amsterdam Oct 4, 2018

Full Stack Kotlin on Google Cloud

Brent Shaffer, Google Cloud DPE
slide-2
SLIDE 2

Brent Shaffer

slide-3
SLIDE 3 3

No language makes you feel more like a cog in a machine than Java

Google Employee who will remain anonymous
slide-4
SLIDE 4

Life's better with Kotlin™!

  • Kotlin + Java interoperability
  • Java++
  • Instant improvement of Java Libraries
  • Creative syntax
  • Frontend & backend harmony
  • Exciting growing community
slide-5
SLIDE 5

A Java backend dev thinking of switching to Kotlin

If you are...

A Kotlin Android dev wanting to build apps server-side

slide-6
SLIDE 6

Java devs

slide-7
SLIDE 7

The Google Cloud Java client library in Kotlin A Kotlin-specific client library (using DSLs)

slide-8
SLIDE 8

Android devs

slide-9
SLIDE 9

cloud.google.com/kotlin

slide-10
SLIDE 10 bshaffe r KotlinConf, Amsterdam Oct 4, 2018

Full Stack Kotlin on Google Cloud

Brent Shaffer, Google Cloud DPE
slide-11
SLIDE 11

FULL STACK

slide-12
SLIDE 12
  • Demo 1: Extending

Android apps with autoscaling backends

  • Demo 2: Remotely

configuring Android Things with IoT Core

slide-13
SLIDE 13 g.co/codelabs/emojify

Extending Android apps with autoscaling backends 01

slide-14
SLIDE 14

fast deployment, infinite scalability!

Kotlin on GCP

  • Compute Engine
  • App Engine
  • Kubernetes Engine
slide-15
SLIDE 15

Spring Boot

  • One of most popular Java frameworks for backend apps
  • Convention over Configuration
  • Kotlin support
  • Get started right away with start.spring.io
  • Runs great on App Engine
  • Framework features like Dependency Injection, REST annotations, etc
slide-16
SLIDE 16

Google App Engine

  • One of the first if not THE first serverless offerings
  • Developer provides code
  • Google runs it at scale (0 to millions QPS)
  • Now supports 7 languages
slide-17
SLIDE 17

App Engine Elasticity

  • Pay per use
  • Pay per use
  • Consumes resources only when your code is running
slide-18
SLIDE 18

Configuring auto-scaling

slide-19
SLIDE 19

Java 8 App Engine Standard Runtime

  • Without previous versions security limitations
  • Launched GA since last year
  • Backward compatibility for millions of apps
  • Open JDK 8 and Jetty 9 (Servlet 3.1 based)
slide-20
SLIDE 20

gVisor

  • New App Engine Security Sandbox
  • Lightweight & fast
  • Run any Java code!
slide-21
SLIDE 21

The app: Emojify!

  • Find faces
  • Predict emotion
  • Overlay emoji
slide-22
SLIDE 22
slide-23
SLIDE 23

Cloud Client Libraries

Cloud Vision (face detection, image annotation) Cloud Storage (stores source and emojified images)
slide-24
SLIDE 24 App Engine Android app architecture Frontend workflow 1 User opens App and snaps a picture 2 App uploads the image to Storage using the Firebase SDK 3 App makes an API call to the App Engine backend and supplies the image URI Frontend 1 2 3 Cloud Storage Emojify Backend Firebase SDK Frontend & Backend connected to same Google Cloud Project!
slide-25
SLIDE 25 Backend app architecture Backend workflow 4 Backend calls Vision API with the image URI. The Vision API then returns the location of faces and their sentiment analysis 5 Backend overlays suitable emoji 6 Backend uploads emojified image to Storage 7 Backend returns emojified image URI to the App Emojify: Architecture 4 Cloud Storage Vision API Cloud Vision Face Detection Face Annotation Overlay Emoji 5 6 7 Emojify Backend App Engine
slide-26
SLIDE 26

Live selfies?

slide-27
SLIDE 27

Uploading picture to Storage (Android)

slide-28
SLIDE 28

Calling Emojify Backend (Android)

slide-29
SLIDE 29

REST Controller

slide-30
SLIDE 30

Calling Vision (Backend)

slide-31
SLIDE 31

Drawing Emoji (Backend)

slide-32
SLIDE 32

Uploading result to Storage (Backend)

slide-33
SLIDE 33

Google Cloud + Emojify

  • Firebase SDK on Android
  • Cloud Storage and Cloud Vision client library on Backend
  • All running on App Engine
slide-34
SLIDE 34

02

Remotely configuring Android Things with IoT Core

bit.ly/iot-core-codelab
slide-35
SLIDE 35
slide-36
SLIDE 36

Significant growth in IoT (still) coming

20 10 5 Billions 2010 2020 2012 2014 2016 2018 Source: “The internet of everything 2015”, Business Insider Intelligence modified with information from a later Gardner 2017 report
slide-37
SLIDE 37

Cloud IoT Core: Fully-managed service to securely connect and manage your global device network

Cloud IoT Core Device Manager :
  • Configure individual
devices
  • Update and control
devices
  • Role level access control
  • Console and APIs for
device deployment and monitoring Protocol Bridge :
  • Protocol (Https/MQTT)
endpoint
  • Automatic load balancing
  • Global data access with
Pub/Sub
slide-38
SLIDE 38 Cloud IoT Core
slide-39
SLIDE 39 Cloud Pub/Sub Cloud Pub/Sub Cloud IoT Core
slide-40
SLIDE 40 IoT Dataflow Pub/Sub Cloud Functions Bigtable BigQuery Data Studio Datalab Machine Learning
slide-41
SLIDE 41 IoT Dataflow Pub/Sub Cloud Functions Bigtable BigQuery Data Studio Datalab Machine Learning
slide-42
SLIDE 42 IoT Dataflow Pub/Sub Cloud Functions Bigtable BigQuery Data Studio Datalab Machine Learning
slide-43
SLIDE 43 IoT Dataflow Pub/Sub Cloud Functions Bigtable BigQuery Data Studio Datalab Machine Learning
slide-44
SLIDE 44 IoT Dataflow Pub/Sub Cloud Functions Bigtable BigQuery Data Studio Datalab Machine Learning Ingest Process Analyze
slide-45
SLIDE 45

The app: Coffee Heater!

  • Raspberry Pi controls the device
  • Rainbow Hat indicates the temperature
and the heater’s state
slide-46
SLIDE 46

The app: Coffee Heater!

  • Raspberry Pi controls the device
  • Rainbow Hat indicates the temperature
and the heater’s state
  • Kotlin server listens to Cloud Pub/Sub
for the temperature of the coffee and modifies the device configuration to toggle the heater
slide-47
SLIDE 47 Server IoT Core IoT Device Demo Architecture IoT Core workflow 1 Device publishes data on MQTT topic 2 Config and metadata is published to Cloud Pub/Sub on device registry's topic 3 Server receives telemetry and metadata from cloud Pub/Sub 4 Server updates device config in Cloud IoT 5 Device receives new config on MQTT topic Cloud Pub/Sub {"temperature": 12} {"temperature": 12} {"heater_on": false} 1 5 {"heater_on": false} 2 3 {"temperature": 12} 4
slide-48
SLIDE 48

Rainbow Time

slide-49
SLIDE 49

Create IoT client and set a listener (device)

slide-50
SLIDE 50

Publish telemetry data (device)

slide-51
SLIDE 51

Listen to telemetry events using PubSub (server)

slide-52
SLIDE 52

Modify the device config to change state (server)

slide-53
SLIDE 53

Update device when configuration changes (device)

slide-54
SLIDE 54 Launch with MQTT HTTP Support Stackdriver logging for registries Multiple PubSub topics Xively joins Google AndroidThings Plugin Google Cloud IoT Core Alpha Google Cloud IoT Core Beta Google Cloud IoT Core GA 2017 2019 MAY SEPT JAN MAY 2018 IoT Edge
slide-55
SLIDE 55

Thanks! Questions?