Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Extending the Platform with Spring Boot and Cloud Foundry

When developing cloud native applications that are deployed and operated using a cloud platform, such as Cloud Foundry, there becomes a need to provision middleware services using the platform. The result of building platform services are that developers using the platform are able to take advantage of service offerings as bindings for their application deployments.

  • Inicia sesión para ver los comentarios

Extending the Platform with Spring Boot and Cloud Foundry

  1. 1. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Extending the Platform Kenny Bastani @kennybastani
  2. 2. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 2 @kennybastani Spring Developer Advocate
  3. 3. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What makes an application legacy? 3
  4. 4. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What makes an application legacy? • How fast can you make changes to the application and deliver it into production? • How much work is it to upgrade the application framework? 4
  5. 5. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy is an architecture problem 5
  6. 6. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Monolith 6
  7. 7. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 7 Microservices…
  8. 8. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ If we're creating 10x the number of apps, we're creating 10x the technical debt 8
  9. 9. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What does your microservice architecture look like in 10 years? 9
  10. 10. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ If you have to implement the same thing in every application, it should be provided by the platform as a service 10
  11. 11. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Do this successfully, and the only thing is left is the valuable business logic 11
  12. 12. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The two road blocks of cloud native • Legacy applications • Legacy culture 12
  13. 13. Legacy culture looks like this
  14. 14. Legacy applications look like this
  15. 15. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ How do we do better? 15
  16. 16. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Platform Engineering 16
  17. 17. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Platform Engineering • Everything that sits around your applications is vital to supporting the health of your applications • Unfortunately, anything that is not business logic is going to make it harder to upgrade your application later • Platform engineering is the art of automating standards in an application architecture by reducing redundancy across applications 17
  18. 18. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Redundancy in code creates technical debt. In microservices, multiply that debt by the number of apps 18
  19. 19. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Boot + Cloud Foundry Service Brokers 19
  20. 20. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Backing services 20
  21. 21. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Online Store Example 21
  22. 22. Backing services Microservices
  23. 23. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Boot 24
  24. 24. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Platform engineers can take an opinionated view on how application developers will consume services 25
  25. 25. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Cloud Foundry Service Brokers • The Cloud Foundry marketplace is similar to the idea of starter projects in Spring Boot • Services can be offered on Cloud Foundry and bound to your application deployments • These marketplace services can be seen as backing services for your applications 26
  26. 26. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 27 Microservices…
  27. 27. Backing services Microservices
  28. 28. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Amazon S3 Service Broker • The demo for this presentation is going to create an Amazon S3 service broker • We’ll release the broker to PCF Dev • Extend Spring Boot to automatically consume service instances from the broker • Deploy Spring Boot S3 browser that uses a starter project to connect to Amazon S3 29
  29. 29. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Cloud Controller • The Cloud Controller is the contract that Cloud Foundry exposes over HTTP as a REST API • We can create service brokers that implement expectations from this contract to allow CF and other broker applications to talk to each other 30
  30. 30. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Boot Service Broker Template • The Spring team maintains an example project that provides the boiler plate for creating custom service brokers using Spring Boot • https://github.com/spring-cloud/spring-cloud-cloudfoundry-service-broker 33
  31. 31. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Implementing the service contracts • Service Catalog • Service Instances • Service Bindings 34
  32. 32. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Service Catalog 35
  33. 33. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Service Instances • Each method in the interface represents the implementation of a repository pattern • Controls the lifecycle of resources on AWS that provide exclusive access to a S3 bucket • The two resources that we will manage are: • S3 buckets • IAM users 38
  34. 34. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Service Bindings • The goal of the Amazon S3 Broker is to create S3 buckets that can be automatically bound to an application • Further, we want to make the service as easy to consume in a cloud native environment using Spring Boot starter projects to auto-configure the connection • The result of this is that a service binding will attach to a Cloud Foundry deployment and inject the environment variables into the application’s container • Our Spring Boot application will look for those environment variables at runtime and automatically configure an S3 connection 45
  35. 35. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Releasing the Service Broker • There are multiple options for releasing service brokers • Deploy as a CF app • Release with BOSH 48
  36. 36. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Why should we use BOSH to release a service broker instead of deploying the application with Cloud Foundry? 49
  37. 37. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ It depends on the virtualized compute resources you intend to manage with your custom broker 50
  38. 38. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ When to use BOSH • When you need to orchestrate resources with the IaaS provider that your CF deployment uses • Virtual machines • Network resources • BOSH provides a director API you can use to manage IaaS resources • Portable with different IaaS providers that have a BOSH CPI 51
  39. 39. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ When not to use BOSH • When you do not need to manage resources using the IaaS • Example: • Amazon S3 • Basically any AWS service that has an SDK • Sometimes we just want to wrap another cloud service in a service broker, and that is OK 52
  40. 40. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Releasing with Cloud Foundry • Let’s jump into code and release the S3 service broker as a CF deployment 53
  41. 41. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Release steps • Create MySQL database as a service binding for the S3 broker • Build and push the S3 broker app • Bind Amazon AWS credentials as environment variables • Restage the S3 broker • Create service broker using CF CLI • Enable marketplace access to S3 broker • Create new service instance named s3-service 54
  42. 42. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Extending Spring Boot • We can create a starter project that includes an Amazon S3 template for consuming S3 service instances • All we need to do is to include the Amazon S3 starter project as a dependency 55
  43. 43. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Custom Spring Boot starter projects • We need to create two project modules • Auto-configuration project with the client libraries to consume a service instance (Amazon S3 Template) • Basic starter dependency project that includes the auto-configuration project using Maven 56
  44. 44. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Conclusion 57
  45. 45. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Platforms are forever 58
  46. 46. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Build value into the platform and reduce redundancies early in microservice architectures 59
  47. 47. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Learn More. Stay Connected. Thanks! @kennybastani on Twitter @springcentral spring.io/blog @pivotal pivotal.io/blog @pivotalcf http://engineering.pivotal.io

×