Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ServerlessTO - with Spring Boot and GCP

5e0c801ac1a5d0512bb9774ab158d06d?s=47 Ray Tsang
January 13, 2021

ServerlessTO - with Spring Boot and GCP

5e0c801ac1a5d0512bb9774ab158d06d?s=128

Ray Tsang

January 13, 2021
Tweet

Transcript

  1. Serverless End-to-End with Spring Boot on GCP

  2. 2 @saturnism @gcpcloud Ray Tsang Developer Advocate Google Cloud Platform

    Java Champion Spring Cloud GCP cloud.spring.io/spring-cloud-gcp/ @saturnism saturnism.me
  3. 3 @saturnism @gcpcloud Order UI PostgreSQL Order Service CRUD

  4. 4 @saturnism @gcpcloud Order UI PostgreSQL Order Service CRUD Where

    do you run this?
  5. 5 @saturnism @gcpcloud Order UI PostgreSQL Order Service CRUD Zipkin

    RabbitMQ Trace Data Vault
  6. 6 @saturnism @gcpcloud Order UI PostgreSQL Order Service CRUD Zipkin

    RabbitMQ Publish Event Vault
  7. 7 @saturnism @gcpcloud Order UI PostgreSQL Order Service CRUD Zipkin

    RabbitMQ Secrets Vault
  8. 8 @saturnism @gcpcloud Order UI MySQL Order Service CRUD Zipkin

    RabbitMQ Zipkin Zipkin RabbitMQ RabbitMQ Publish Event Trace Data PostgreSQL Vault Vault Vault Secrets
  9. 9 @saturnism @gcpcloud Order UI Cloud SQL Order Service CRUD

    Cloud Trace Pub/Sub Publish Event Trace Data Secret Manager Secrets
  10. 10 @saturnism @gcpcloud Serverless?

  11. 11 @saturnism @gcpcloud Service Monitoring Metrics SLO/SLA/QPS Alerting Tracing Logging

    Debugging Profiling Service / Library Source Repository Tests Build Serving Environment Ingress / HTTPs Custom Domain URL Mapping Traffic Splitting Internal / External Services Min / Max Instances Autoscaling Environment Serving Environments Databases / Resources Secret Store Artifact Repository Docker Images Maven Artifacts Vulnerability Scanning Binary Authorization … 1 1 1 * Database Secret Messaging Storage ... * 1 Infrastructure Monitoring Availability Capacity
  12. 12 @saturnism @gcpcloud Service Monitoring Metrics SLO/SLA/QPS Alerting Tracing Logging

    Debugging Profiling Service / Library Source Repository Tests Build Serving Environment Ingress / HTTPs Custom Domain URL Mapping Traffic Splitting Internal / External Services Min / Max Instances Autoscaling Environment Serving Environments Databases / Resources Secret Store Artifact Repository Docker Images Maven Artifacts Vulnerability Scanning Binary Authorization … 1 1 1 * Database Secret Messaging Storage ... * 1 Infrastructure Monitoring Availability Capacity CI CD
  13. 13 @saturnism @gcpcloud Service Monitoring Cloud Ops Metrics SLO/SLA/QPS Alerting

    Tracing Logging Debugging Profiling Service / Library GitHub Source Repository Tests Build Serving Environment Cloud Run / App Engine Ingress / HTTPs Custom Domain URL Mapping Traffic Splitting Internal / External Services Min / Max Instances Autoscaling Environment Google Cloud Project Serving Environments Databases / Resources Secret Store Artifact Repository Artifact Registry Docker Images Maven Artifacts Vulnerability Scanning Binary Authorization … 1 1 1 * Database Secret Messaging Storage ... * 1 Infrastructure Monitoring Cloud Ops Availability Capacity CI Cloud Build CD Cloud Build
  14. 14 @saturnism @gcpcloud Serverless End-to-End • Source Repository • CI/CD

    • Runtime • Databases, Secret Management, Messaging, ... • Monitoring / Operations • ... Focus on delivering value!
  15. 15 @saturnism @gcpcloud Just search for "Spring Boot GCP" https://github.com/spring-cloud/spring-cloud-gcp

    https://spring.io/projects/spring-cloud-gcp Collaboration between GCP and Spring engineers Idiomatic integrations with Spring Boot for 10+ GCP services +
  16. 16 @saturnism @gcpcloud Feature GCP Service Spring Framework Configuration Cloud

    Secret Manager Spring Cloud Config Messaging Cloud Pub/Sub Spring Integration Spring Cloud Stream Spring Dataflow Database Cloud SQL Cloud Spanner Cloud Firestore Cloud Datastore Spring Data JPA Spring Data Spanner, r2dbc driver, Hibernate Spring Data Reactive Firestore Spring Data Datastore Data Warehouse Cloud BigQuery Spring Integration Storage Cloud Storage Spring Resource Logging Stackdriver Logging Logback Trace Stackdriver Trace Spring Cloud Sleuth Metrics Stackdriver Monitoring Use Micrometer Security Cloud Identity-Aware Proxy Spring Security Vision Vision API Vision Starter
  17. 17 @saturnism @gcpcloud @SpringBootApplication class ExampleApplication { @Bean fun restTemplate()

    = RestTemplate() } fun main(args: Array<String>) { runApplication<DemoGcpApplication>(*args) } @RepositoryRestResource interface PersonRepositiory : PagingAndSortingRepository<Person, String> @Table data class Person( @PrimaryKey var id: String? = null, var name: String? = null )
  18. 18 @saturnism @gcpcloud 18 Databases

  19. 19 @saturnism @gcpcloud Bring your own Fully Managed Serverless What?

    Install your own MySQL Anything you want Cloud SQL (MySQL, PostgreSQL) Cloud spanner Firestore (NoSQL) Datastore (NoSQL) Where? Compute Engine VM Kubernetes Container We host it for you We host it for you Billing? Compute resource Compute resource Usage (Reads/Writes/Storage)
  20. 20 @saturnism @gcpcloud Cloud SQL MySQL, PostgreSQL, MS SQL Multi-zone

    replication Automatic Failover Vertical Scaling Up to 416 GB of RAM and 30 TB
  21. 21 @saturnism @gcpcloud SELECT * FROM Order WHERE done =

    FALSE AND priority >= 4 ORDER BY priority DESC Each field is individually indexed Manual composite index =, >, >=, <, <= No "Like" queries
  22. 22 @saturnism @gcpcloud Datastore Spring Data Integration POJO + Annotation

    Spring Data Repository Declarative Transaction
  23. 23 @saturnism @gcpcloud Spring Data ORM Mapping for Spanner, Datastore,

    Firestore No boilerplate code
  24. 24 @saturnism @gcpcloud Spring Data CRUD operations, Pagination, Sorting out

    of the box Automatic Query generation, and custom queries No boilerplate code
  25. 25 @saturnism @gcpcloud 25 Secret Manager

  26. 26 @saturnism @gcpcloud Secret Manager Secret Store Multi-version Fine-grained IAM

    Audit Logging
  27. 27 @saturnism @gcpcloud Spring Cloud Config with Secret Manager Store

    credentials, configurations in Cloud Secret Manager Reference values in properties or SpEL No code
  28. 28 @saturnism @gcpcloud

  29. 29 @saturnism @gcpcloud 29 Messaging

  30. 30 @saturnism @gcpcloud Publish/Subscribe One-to-Many Globally distributed Push & Pull

    At-least once delivery Ordering, Filtering (Beta) Pub/Sub
  31. 31 @saturnism @gcpcloud Producer Orders Topic Fulfillment Subscription Inventory Subscription

    ... Subscription Consumer Consumer Consumer Consumer Consumer Consumer Consumer Consumer Consumer msg
  32. 32 @saturnism @gcpcloud Producer Orders Topic Fulfillment Subscription Inventory Subscription

    ... Subscription Consumer Consumer Consumer Consumer Consumer Consumer Consumer Consumer Consumer msg msg msg
  33. 33 @saturnism @gcpcloud Producer Orders Topic Fulfillment Subscription Inventory Subscription

    ... Subscription Consumer Consumer Consumer Consumer Consumer Consumer Consumer Consumer Consumer msg msg msg
  34. 34 @saturnism @gcpcloud Spring Integration With Pub/Sub, BigQuery, Cloud Storage

    and more
  35. 35 @saturnism @gcpcloud 35 Storage

  36. 36 @saturnism @gcpcloud Object store No more "disk out of

    space" Multi-regional, global availability Tiered storage options Encryption at rest Cloud Storage
  37. 37 @saturnism @gcpcloud 37 Serverless Runtimes

  38. 38 @saturnism @gcpcloud App Engine Cloud Run Deploys Your application

    A JAR! Your application A Container Image Billing Instance Hours Billable time Scaling 0 to N 0 to N CPU Available when instance is up Available when request is being processed
  39. 39 @saturnism @gcpcloud 39 Thanks! cloud.google.com/java spring.io/projects/spring-cloud-gcp saturnism.me/spring