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

Cloud Native Spring - Migrating Traditional Applications

Cloud Native Spring - Migrating Traditional Applications

The Spring ecosystem provides you with all you need to build cloud native applications, focusing on productivity, simplicity, and speed. If you decided that moving to the cloud will help your business, you’d need a strategy to migrate your existing applications. Luckily, Spring got you covered.

In this session, I’ll cover the main technical steps of migrating a traditional Spring application to be cloud native. You’ll learn best practices and common patterns to build self-contained apps by using embedded servers and packaging them as Docker images, use externalized configuration for immutable artifacts, and make the apps observable with logs, metrics, and traces. Drawing from real examples, you’ll have a roadmap to follow in your journey to the cloud with Spring Boot and Spring Cloud.

C20b9829daddbee16e359b0a750660a5?s=128

Thomas Vitale

November 07, 2020
Tweet

Transcript

  1. Thomas Vitale @vitalethomas thomasvitale.com Cloud Native Spring Migrating traditional applications

    Devoxx Ukraine 2020
  2. Thomas Vitale • Senior Software Engineer at Systematic, Denmark. •

    Spring, Cloud Native, DevOps, Application Security. • Author of “Cloud Native Spring in Action - With Spring Boot and Kubernetes” (Manning). About Me
  3. Agenda • 5 essential migration steps • Application server •

    Containerization • Configuration • Application lifecycle • Logging and monitoring #DevoxxUA @vitalethomas
  4. 1. Application Server #DevoxxUA @vitalethomas

  5. Application Server - Traditional WAR/EAR artifacts deployed to an application

    server #DevoxxUA @vitalethomas A lica i Se e (T ca , W d , J ) A 1 (WAR) A 2 (WAR) A 3 (WAR) A 4 (WAR)
  6. #DevoxxUA @vitalethomas Application Server - Cloud Native Embedded Server Blocking

    + Servlet API (Tomcat, Undertow, Jetty) Spring Web Embedded Server Non-Blocking + Project Reactor (Netty) Spring WebFlux Serverless Functions (AWS Lambda, Azure Functions, GCP Functions) Spring Cloud Functions
  7. Application Server - Cloud Native Executable JAR artifacts with embedded

    server #DevoxxUA @vitalethomas A 1 ( A ) A 2 ( A ) A 3 ( A ) A 4 ( A )
  8. Demo Embedded Server + JAR #DevoxxUA @vitalethomas https://github.com/ThomasVitale/devoxx-ua-2020

  9. 2. Containerization #DevoxxUA @vitalethomas

  10. Containerization Packaging Spring Boot apps as Docker images #DevoxxUA @vitalethomas

    Dockerfiles Cloud Native Buildpacks Jib
  11. Working with Docker Images Don’t use fat JARs Leverage layered

    JARs Security Don’t run as root or include secrets Performance Optimize build and runtime performance Maintenance Use up-to-date libraries #DevoxxUA @vitalethomas
  12. Demo Containerizing Spring Boot #DevoxxUA @vitalethomas https://github.com/ThomasVitale/devoxx-ua-2020

  13. 3. Configuration #DevoxxUA @vitalethomas

  14. Code and Configuration #DevoxxUA @vitalethomas Code Configuration Deploy

  15. Configuration - Traditional Configuration files and environment variables #DevoxxUA @vitalethomas

    Property files Environment variables XML files
  16. Configuration - Cloud Native #DevoxxUA @vitalethomas Spring Boot Properties Property

    files Command line arguments Environment variables Configuration Services Spring Cloud Config Server Spring Cloud Consul Config Spring Cloud Vault Spring Cloud Zookeeper Config Cloud Platform Services Spring Cloud Alibaba Spring Cloud AWS Spring Cloud Azure Spring Cloud GCP Kubernetes Platform ConfigMaps Secrets Environment Variables
  17. Server Configuration #DevoxxUA @vitalethomas Spring Boot Autoconfiguration Properties WebServerFactoryCustomizer

  18. Demo Configuration Strategies #DevoxxUA @vitalethomas https://github.com/ThomasVitale/devoxx-ua-2020

  19. 4. Application Lifecycle #DevoxxUA @vitalethomas

  20. Application Lifecycle - Traditional #DevoxxUA @vitalethomas Vertical scaling Extra care

    for each instance Slow startup time
  21. Application Lifecycle - Cloud Native Disposable and stateless applications #DevoxxUA

    @vitalethomas Horizontal scaling Disposable instances Fast startup time
  22. Demo Disposability and scalability #DevoxxUA @vitalethomas https://github.com/ThomasVitale/devoxx-ua-2020

  23. 5. Logging & Monitoring #DevoxxUA @vitalethomas

  24. Logs - Now and Then From log files to event

    streams #DevoxxUA @vitalethomas Log to files File naming File sizing File rotation Log to stdout Event stream External log collection External log aggregation
  25. Health Checks Liveness and readiness probes Application #DevoxxUA @vitalethomas ALIVE?

    READY? NO NO Restart might help Restart won’t help
  26. Metrics - Now and Then Towards observable applications #DevoxxUA @vitalethomas

    External agents Outside the application Internal agents The application exposes metrics
  27. Demo Logging and Monitoring #DevoxxUA @vitalethomas https://github.com/ThomasVitale/devoxx-ua-2020

  28. What’s next? #DevoxxUA @vitalethomas

  29. II. Dependency management I. One codebase, one application III. Configuration,

    credentials, and code V. Design, build, release, run IV. Backing services VI. Stateless processes VIII. Concurrency VII. Port binding IX. Disposability XI. Logs X. Environment parity XII. Administrative processes XIV. Telemetry XIII. API first XV. Authentication and authorization
  30. What’s next? #DevoxxUA @vitalethomas Resilience Resilience4J Spring Cloud Circuit Breaker

    Distributed systems Spring Cloud Gateway Spring Cloud Stream Spring Security OAuth Reactive Spring WebFlux R2DBC Project Reactor Kubernetes Spring Boot Spring Cloud Kubernetes Skaffold
  31. With Spring Boot and Kubernetes • 35% discount code, valid

    for all products in all format • ctwdevoxxukr20 • manning.com • 5 free e-book codes • join Q&A for the raffle Cloud Native Spring in Action
  32. Bonus Demo Spring Boot on Kubernetes #DevoxxUA @vitalethomas https://github.com/ThomasVitale/devoxx-ua-2020

  33. Thomas Vitale @vitalethomas thomasvitale.com Cloud Native Spring Migrating traditional applications

    Devoxx Ukraine 2020