Slide 1

Slide 1 text

Cloud Native Applications for Cloud Foundry using Spring Cloud Workshop Corneil du Plessis

Slide 2

Slide 2 text

Agenda • Background • Cloud Foundry command-line • Your frst Cloud Foundry application • Connecting to database • Connecting to message queues • Scaling your application • Application Discovery

Slide 3

Slide 3 text

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/

Slide 4

Slide 4 text

Cloud Foundry Application Runtime

Slide 5

Slide 5 text

Terminology • CAT • BOSCH • Deigo • Services • Application Manifest • Organisation • Space • Buildpack

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

Visit Workshop Page https://github.com/corneil/cf-demo

Slide 10

Slide 10 text

Your frst Application

Slide 11

Slide 11 text

View Logs and Invoke

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

Provision PostgreSQL and Deploy

Slide 14

Slide 14 text

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.

Slide 15

Slide 15 text

Provision RabbitMQ and Deploy

Slide 16

Slide 16 text

Scaling your application

Slide 17

Slide 17 text

Application Discovery • @EnableDiscoveryClient • Access resources: • https:/// • OpenFeign Client

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

No content