introduction to spring cloud oss - denver cloud foundry meetup
TRANSCRIPT
![Page 1: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/1.jpg)
TECHNOLOGY SOLUTIONS DELIVERED
Intro to Spring Cloud OSSDenver Cloud Foundry Meetup
August 26, 2016Josh Ghiloni (@joshghiloni)
![Page 2: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/2.jpg)
Agenda•Spring Cloud Origins•Why Spring Cloud?•External Configuration with Spring Cloud Config Server•Runtime Service Discovery with Eureka•Using Hystrix to Fail Gracefully•Demo!
![Page 3: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/3.jpg)
Spring Cloud Origins
![Page 4: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/4.jpg)
Why Spring Cloud?
Microservice architectures are complex!• They need to have their config stored in the environment, not in code• Microservices are loosely coupled – They need to discover and be discoverable• They are not necessarily colocated – Inter-service communication needs to be
fault-tolerant
Netflix is a microservice architecture … they (probably) didn't build all this just because they were bored
![Page 5: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/5.jpg)
External Configuration with Spring Cloud Config Server
• Follow 12 Factor app development!
• Configuration stored in source control
• Extensible (store your config in a DB or LDAP or on punch cards)
• Securable (secure with whatever scheme you choose)
• Data can be stored encrypted at rest and decrypted on the fly (requires Unlimited JCE policy in Java buildpack)
@SpringBootApplication@EnableDiscoveryClient@EnableConfigServerpublic class ConfigServerApplication { public static void main(String[] args) { SpringApplication.run( ConfigServerApplication.class, args ); }}
![Page 6: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/6.jpg)
Runtime Service Discovery with Eureka•Register and discover services at runtime
•Registrations stored in memory
•Simple dashboard available•Spring Boot autoconfiguration for self-registration
•Can be used to look up external config servers automatically
@SpringBootApplication@EnableEurekaServerpublic class EurekaServerApplication { public static void main(String[] args) { SpringApplication.run( EurekaServerApplication.class, args ); }}
![Page 7: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/7.jpg)
High Availability with Eureka
eureka-0 eureka-1 eureka-2 eureka-n
Route eureka
![Page 8: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/8.jpg)
Using Hystrix to Fail Gracefully
source: http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html
![Page 9: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/9.jpg)
Using Hystrix to Fail Gracefully
source: http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html
![Page 10: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/10.jpg)
Including Spring Cloud in your Application@SpringBootApplication@EnableCircuitBreaker // for Hystrix@EnableDiscoveryClient // for Eureka@RestControllerpublic class MySpringCloudApplication { public static void main(String[] args) { SpringApplication.run(MySpringCloudApplication.class, args); } @RequestMapping("/") public String helloWorld() { return "Hello, World!"; }}
or…
![Page 11: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/11.jpg)
Including Spring Cloud in your Application
@SpringCloudApplication@RestControllerpublic class MySpringCloudApplication { public static void main(String[] args) { SpringApplication.run(MySpringCloudApplication.class, args); } @RequestMapping("/") public String helloWorld() { return "Hello, World!"; }}
![Page 12: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/12.jpg)
More Spring Cloud Integrations•Ribbon (Netflix) – Client Side Load Balancing•Zuul (Netflix) – Dynamic Routing•Feign (Netflix) – Declarative REST Client•Archaius (Netflix) – Client side configuration•Security – Single Sign on via OAuth2•Consul – Service Discovery•Zookeeper – Service Discovery
![Page 13: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/13.jpg)
Demo!
![Page 14: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/14.jpg)
Questions?
![Page 15: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/15.jpg)
ReferencesTwelve Factor Apps: http://12factor.netMicroservice Prereqs: http://martinfowler.com/bliki/MicroservicePrerequisites.html Spring Boot: http://projects.spring.io/spring-boot/Spring Cloud: http://projects.spring.io/spring-cloud/ Netflix OSS: http://netflix.github.io/ Java Buildpack with Unlimited JCE: https://github.com/jghiloni/java-buildpack Source for this Demo: https://github.com/ECSTeam/spring-cloud-demo
![Page 16: Introduction to Spring Cloud OSS - Denver Cloud Foundry Meetup](https://reader037.vdocuments.us/reader037/viewer/2022091121/58abc8ca1a28ab68068b551b/html5/thumbnails/16.jpg)
Thank You!