full stack kotlin on google cloud
play

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


  1. KotlinConf, Amsterdam Oct 4, 2018 Full Stack Kotlin on Google Cloud Brent Shaffer, Google Cloud DPE bshaffe r

  2. Brent Shaffer

  3. No language makes you feel more like a cog in a machine than Java Google Employee who will remain anonymous 3

  4. Life's better with Kotlin™! ● Kotlin + Java interoperability Java++ ● ● Instant improvement of Java Libraries Creative syntax ● ● Frontend & backend harmony Exciting growing community ●

  5. If you are... A Kotlin Android dev A Java backend dev wanting to build apps thinking of switching to server-side Kotlin

  6. Java devs

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

  8. Android devs

  9. cloud.google.com/kotlin

  10. KotlinConf, Amsterdam Oct 4, 2018 Full Stack Kotlin on Google Cloud Brent Shaffer, Google Cloud DPE bshaffe r

  11. FULL STACK

  12. ● Demo 1: Extending Android apps with autoscaling backends ● Demo 2: Remotely configuring Android Things with IoT Core

  13. backends 01 Extending Android apps with autoscaling g.co/codelabs/emojify

  14. Kotlin on GCP fast deployment, infinite scalability! ● Compute Engine App Engine ● Kubernetes Engine ●

  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 ●

  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 ●

  17. App Engine Elasticity ● Pay per use ● Pay per use ● Consumes resources only when your code is running ●

  18. Configuring auto-scaling

  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) ●

  20. gVisor New App Engine Security Sandbox ● Lightweight & fast ● Run any Java code! ●

  21. The app: Emojify! ● Find faces Predict emotion ● ● Overlay emoji

  22. Cloud Client Libraries Cloud Vision (face detection, image annotation) Cloud Storage (stores source and emojified images)

  23. Frontend Android app architecture 2 Cloud Frontend workflow Storage 1 User opens App and snaps a picture 2 App uploads the image to Storage using the App Engine Firebase SDK Firebase SDK 3 Emojify 3 App makes an API call to the App Engine Backend backend and supplies the image URI 1 Frontend & Backend connected to same Google Cloud Project!

  24. Emojify: Architecture Backend app architecture Vision API 4 Backend workflow Cloud Vision Face Detection 4 Backend calls Vision API with the image URI. Face Annotation The Vision API then returns the location of faces App Engine and their sentiment analysis Emojify 5 Backend overlays suitable emoji Cloud Backend 6 Backend uploads emojified image to Storage Storage 6 7 Backend returns emojified image URI to the App 5 Overlay Emoji 7

  25. Live selfies?

  26. Uploading picture to Storage (Android)

  27. Calling Emojify Backend (Android)

  28. REST Controller

  29. Calling Vision (Backend)

  30. Drawing Emoji (Backend)

  31. Uploading result to Storage (Backend)

  32. Google Cloud + Emojify Firebase SDK on Android ● Cloud Storage and Cloud Vision client library on Backend ● All running on App Engine ●

  33. 02 Remotely configuring Android Things with IoT Core bit.ly/iot-core-codelab

  34. Significant growth in IoT (still) coming Billions 20 10 5 2010 2012 2014 2016 2018 2020 Source: “The internet of everything 2015”, Business Insider Intelligence modified with information from a later Gardner 2017 report

  35. Cloud IoT Core : Fully-managed service to securely connect and manage your global device network Protocol Bridge : Device Manager : Protocol (Https/MQTT) Configure individual ● ● endpoint devices Automatic load balancing Update and control ● ● devices Global data access with ● Cloud IoT Core Pub/Sub Role level access control ● Console and APIs for ● device deployment and monitoring

  36. Cloud IoT Core

  37. Cloud Pub/Sub Cloud IoT Core Cloud Pub/Sub

  38. Cloud Functions Bigtable Pub/Sub IoT Data Studio BigQuery Datalab Dataflow Machine Learning

  39. Cloud Functions Bigtable Pub/Sub IoT Data Studio BigQuery Datalab Dataflow Machine Learning

  40. Cloud Functions Bigtable Pub/Sub IoT Data Studio BigQuery Datalab Dataflow Machine Learning

  41. Cloud Functions Bigtable Pub/Sub IoT Data Studio BigQuery Datalab Dataflow Machine Learning

  42. Ingest Process Analyze Cloud Functions Bigtable Pub/Sub IoT Data Studio BigQuery Datalab Dataflow Machine Learning

  43. The app: Coffee Heater! ● Raspberry Pi controls the device Rainbow Hat indicates the temperature ● and the heater’s state

  44. 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

  45. IoT Device Demo Architecture {"temperature": 12} IoT Core workflow 1 IoT Core 1 Device publishes data on MQTT topic 5 2 Config and metadata is published to {"heater_on": false} Cloud Pub/Sub on device registry's topic 3 Server receives telemetry and metadata 2 from cloud Pub/Sub {"temperature": 12} 4 {"heater_on": false} 4 Server updates device config in Cloud IoT 5 Device receives new config on MQTT Server topic Cloud 3 Pub/Sub {"temperature": 12}

  46. Rainbow Time

  47. Create IoT client and set a listener (device)

  48. Publish telemetry data (device)

  49. Listen to telemetry events using PubSub (server)

  50. Modify the device config to change state (server)

  51. Update device when configuration changes (device)

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

  53. Thanks! Questions?

Recommend


More recommend