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

Cloud Native Applications for Cloud Foundry usi...

Cloud Native Applications for Cloud Foundry using Spring Cloud

Discover Spring Cloud for building Cloud Native Spring Boot applications with demonstrations for Cloud Foundry.

Corneil du Plessis

July 11, 2018
Tweet

More Decks by Corneil du Plessis

Other Decks in Programming

Transcript

  1. Agenda • Background • Cloud Foundry command-line • Your frst

    Cloud Foundry application • Connecting to database • Connecting to message queues • Scaling your application • Application Discovery
  2. Background • What is Cloud Foundry? • Application Runtime •

    Container Runtime • Who provides Cloud Foundry Application Runtime? • Atos • Cloud.gov • Fujitsu Cloud Service K5 • Huawei FusionStage • IBM Bluemix • Pivotal Cloud Foundry • SAP Cloud Platform • Suse Cloud Application Platform • Swisscom Application Cloud • Who uses Cloud Foundry? • Governments • Banks • Insurance • Telecomms • Airlines • Retail (Online) • Retail (Bricks and mortar) • Aerospace https://www.cloudfoundry.org/case-stud ies/
  3. Terminology • CAT • BOSCH • Deigo • Services •

    Application Manifest • Organisation • Space • Buildpack
  4. Cloud Foundry Buildpacks • Binary • Go • Java •

    .Net Core • Node.js • PHP • Python • Ruby • Staticfle • NGIX • HWC (Hosted Web Core) • Community • TomEE • WebSphere Liberty • Jetty • Erlang • Haskell • Swift
  5. The 12 Factors https://12factor.net 1. One Codebase in revision control

    2. Dependencies must be explicit 3. Confg in environment 4. Backing services as attached resources 5. Build, release, run as separate stages 6. One or more stateless processes 7. Export services via port binding 8. Concurrency in Process over threads 9. Disposable with quick startup and graceful shutdown. 10. Keep development/test/production in parity 11. Treat logs as event streams 12. Admin/management tasks as one-of processes
  6. Cloud Foundry command-line • cf login • cf push •

    cf marketplace • cf create-service • cf bind-service • cf scale • cf restart • Many Plugins • Authenticate Operator • Deploy Application • List services • Create / Provision a service • Bind service to application • Scale application • Restart the application
  7. Connecting to Database • Create Spring Data Repository. • Update

    EventServiceImpl to use the repository. • Add @Configuration extending AbstractCloudConfig to provide @Bean of type DataSource. • Add @Transactional to Controller to preserve the Stream
  8. Connecting to Message Queues • Create @Bean for RabbitMQ ConnectionFactory

    by extending AbstractCloudConfig. • Create @Bean for Queue. • Implement listener method with @RabbitListener that saves Event using repository. • Modify createEvent to send event to message queue using AmqpTemplate.
  9. Cloud Foundry Plugins • Maven Push https://github.com/ftzoh/maven-push-plugin • Java https://github.com/SAP/cf-cli-java-plugin

    • Spring Cloud Services https://github.com/pivotal-cf/spring-cloud-services-cli-plu gin • Spring Cloud Data Flow for PCF https://github.com/pivotal-cf/spring-cloud-datafow-for-pcf -cli-plugin • Zero downtime deployments https://github.com/bluemixgaragelondon/cf-blue-green-de
  10. Finally • Contact: @corneil • Code: https://github.com/corneil/cf-demo • Resources: •

    https://docs.cloudfoundry.org/buildpacks/java/getting-started-deploying-apps/gsg-spring.html • https://docs.cloudfoundry.org/buildpacks/java/confguring-service-connections/spring-service-bindings.html • https://docs.spring.io/spring-cloud/docs/current/api/org/springframework/cloud/confg/java/AbstractCloudCo nfg.html