Pivotal spring boot-cloud workshop
-
Upload
sufyaan-kazi -
Category
Technology
-
view
233 -
download
5
Transcript of Pivotal spring boot-cloud workshop
1 © 2015 Pivotal Software, Inc. All rights reserved. 1 © 2015 Pivotal Software, Inc. All rights reserved.
Spring Boot and Spring Cloud Dev101 - Workshop
Sufyaan Kazi (@sufyaan_kazi) & Sara Mitchell Manager, Field Engineering UK & I
2 © 2015 Pivotal Software, Inc. All rights reserved.
Powering Digital Transformation Pivotal enables enterprises to provide
modern software-driven experiences for their customers and workforces.
3 © 2015 Pivotal Software, Inc. All rights reserved.
Modern Approach for Digital Business
AGILE PRODUCT DEVELOPMENT
Agile practices and collaboration for product and culture transformation
• World class application development services
• Proven transformational methodology
BIG DATA Modern, open, highly parallelized platform
• Hadoop, in-memory, and database software
• Industries most complete big data analytics offering
CLOUD NATIVE PLATFORM Modern, open, highly
automated cloud platform
• Platform-as-a-Service (PaaS) software with multi-cloud support
• Record-breaking sales growth and adoption
4 © 2015 Pivotal Software, Inc. All rights reserved.
How We Deliver Transformation
Build product with us in our office
Undergo leadership training
Take back what you’ve learned
5 © 2015 Pivotal Software, Inc. All rights reserved. 5
Cloud Native
DevOps Continuous Delivery
Containers Micro services
6 © 2015 Pivotal Software, Inc. All rights reserved.
Microservices are key for CLOUD NATIVE JAVA
Application Framework
Infrastructure Automation
Platform Runtime
Language framework for microservice-based architectures including components for service discovery, metrics and circuit breakers.
Application container runtime with attachable backing services, automated CI/CD, routing, health management and logging.
A single deployment API for provisioning for bit-for-bit, consistent, self-healing deployments across any private or public cloud.
Dev
Dev Ops
Ops
Spring Cloud
Spring Boot
BOSH
Contract: 12 Factor Application
Contract: BOSH Release
7 © 2015 Pivotal Software, Inc. All rights reserved. 7
Spring Boot
Dynamic language productivity with maturity of enterprise Java Cloud Native: Direct support for Microservices, NetflixOSS++ Fully automated app server configuration and deployment Production ready Ops metrics out of the box, with a switch
8 © 2015 Pivotal Software, Inc. All rights reserved.
Spring Boot Capabilities
8
• Quick start project generation • Automatic project dependency mapping • Configuration drift prevention • Conditional configuration with profiles • Developer productivity tooling • Auto configuration • Monitoring and management endpoints • Micro-services friendly
9 © 2015 Pivotal Software, Inc. All rights reserved.
10 © 2015 Pivotal Software, Inc. All rights reserved. 10
Spring Cloud
Spring Boot Dev
Spring Boot From 0 to app in < 5 min
Enterprise Java with dynamic
language productivity
Spring Cloud Designed for fragile infrastructure in
partnership with Netflix
Java Microservice Framework 100% Spring Boot enabled
Application Framework
11 © 2015 Pivotal Software, Inc. All rights reserved.
DEMO!
12 © 2015 Pivotal Software, Inc. All rights reserved.
Enhanced Application with Spring Boot package hello;import java.util.Arrays;
import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.context.ApplicationContext;
@SpringBootApplicationpublic class Application {
public static void main(String[] args) { SpringApplication.run(HelloSpringBootApplication.class, args); }
}
MAGIC!!
• Tags the class as a source for Spring Beans
• Asks Boot to automatically add beans based on classpath
• Tell Spring to look for other components, configs etc. in the same package
13 © 2015 Pivotal Software, Inc. All rights reserved.
Simple Spring MVC with Annotations package hello;
import org.springframework.web.bind.annotation.RestController;import org.springframework.web.bind.annotation.RequestMapping;
@RestControllerpublic class HelloController {
@RequestMapping("/") public String index() { return "Greetings from Spring Boot!"; }
}
Ready for SpringMVC to handle Web requests
Maps ‘/’ to this method
14 © 2015 Pivotal Software, Inc. All rights reserved.
TO THE LABS!!
15 © 2015 Pivotal Software, Inc. All rights reserved.
http://bit.ly/1SryunD
16 © 2015 Pivotal Software, Inc. All rights reserved.
SKIP STRAIGHT TO LAB 3
17 © 2015 Pivotal Software, Inc. All rights reserved.
Spring Boot Actuator Actuator, production ready features exposed as endpoints. There are many built-in endpoints but this can be extended.
18 © Copyright 2013 Pivotal. All rights reserved.
Elastic Runtime High Level Architecture
• Turnkey, fully automated Platform-as-a-Service
• Scalable runtime environment, extensible to most modern frameworks and languages running on Linux
• Instant expansion or upgrade with no downtime
• Deploy, scale and manage applications with bindable services using simplified semantics and APIs
Pivotal CF Elastic Runtime
DynamicRouter
OAuth2.0Server(UAA)
CELL
Garden
BuildPacks
LoginServer
CC&CCBridge
BlobStore
BBS/etcd
SysLog
ServiceBrokers
Collector AppLog
ROUTING
AUTHENTICATION
APPLIFECYCLE
APPSTORAGE&EXECUTION
MESSAGING
METRICS&LOGGING
Pivotal CF OpsManager/BOSH
BBS Converger
VMware OpenStack AWS Azure Google
19 © Copyright 2013 Pivotal. All rights reserved.
Container Scheduling
Application Framework
Services Platform Runtime
Routing Database Configuration Service Discovery
Big Data
Object Storage
Mobile
Build CI
User Provided Logging & Metrics Messaging
Circuit Breakers 12 Factor Apps RESTful Services Microservices
.NET Spring Boot Node.js Ruby on Rails
Operations Zero Downtime Deployments
Failover & Recovery Scaling Security
Patching Platform
Upgrades
Infrastructure OpenStack Amazon VMware Azure
20 © 2015 Pivotal Software, Inc. All rights reserved.
1. Upload app bits and metadata
push app
Router
2. Create and bind services
3. Stage application
4. Deploy application
5. Manage application health
Blobstore DB
Service Broker Node(s) Cloud Controller
DEA DEA
DEA CELL
+ app MD
Service credentials
Cloud Controller Bridge
Auctioneer
BBS
Overview: Deploying App to Cloud Foundry Runtime
+ =
21 © 2015 Pivotal Software, Inc. All rights reserved.
Stage an Application Ro
uter
CloudFoundryElasQcRunQme
Blobstore DB
CELL Detect Compile Upload No Yes
System Buildpacks
Cloud Controller
Service credentials creds
Cloud Controller Bridge
Task
+ =
22 © 2015 Pivotal Software, Inc. All rights reserved.
Rou
ter
Cloud Controller Cloud Controller Bridge
Auctioneer BBS
CELL Rep
Executor
CELL Rep
Executor
CELL Rep
Executor
ACCESS APP
Deploying an Application
23 © 2015 Pivotal Software, Inc. All rights reserved.
Containers Pre-date the Docker Hype
Google started Linux container effort “Control
Groups”
Added to the Linux Kernel in
2007
Cloud Foundry uses Linux container
technology - “Warden
containers” early 2012
Docker is like github for container images
Docker joins Cloud Foundry
Foundation
Google, MSFT, IBM working on orchestration of multiple Docker
containers
2006 2014
Cloud Foundry has been using container technology pre-Docker
2012
24 © 2015 Pivotal Software, Inc. All rights reserved.
BUILD PACKS
25 © 2015 Pivotal Software, Inc. All rights reserved.
Platform provides standard Buildpack for runtime*
Platform provides fixed OS container image
Developer brings app
Developer brings runtime Docker image
Developer brings Docker OS image
Developer brings app
Buildpacks Docker
* Devs may also provide their own buildpacks
Platform provides fixed host OS Kernel
Platform provides fixed host OS Kernel
Application Container
Standardization or Customization is Your Choice
AND
26 © 2015 Pivotal Software, Inc. All rights reserved.
What does it mean to have a “Platform” ? The minimum features needed…
PaaS
Routing
Load Balancing
Service Brokers
Infrastructure automation
Log aggregation
Health monitoring &
recovery
Immutable artifact
repository
27 © 2015 Pivotal Software, Inc. All rights reserved.
AND RELAX …
28 © 2015 Pivotal Software, Inc. All rights reserved.
GIVE ME MORE…
LocalProfile
@RepositoryRestResource @EnQty
CityMicroservice-@SpringBootApplicaQon
CloudProfile
SpringBoot&CloudMagic!
In-MemoryDB
SpringBootMagic!
31 © 2015 Pivotal Software, Inc. All rights reserved.
NETFLIX…
32 © 2015 Pivotal Software, Inc. All rights reserved.
Spring Cloud Services for Pivotal Cloud Foundry
• Install
• Config
• Manage
• Secure Spring Cloud Services
Config Server
Service Registry
Circuit Breaker Dashboard
33 © 2015 Pivotal Software, Inc. All rights reserved.
Config Server
34 © 2015 Pivotal Software, Inc. All rights reserved.
Service Registration/Discovery @SpringBootApplication @EnableCircuitBreaker @EnableDiscoveryClient public class CustomerApp extends RepositoryRestMvcConfiguration {
@Override protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration
config) { config.exposeIdsFor(Customer.class); }
public static void main(String[] args) { SpringApplication.run(CustomerApp.class, args); }
}
35 © 2015 Pivotal Software, Inc. All rights reserved.
Service Registration/Discovery
36 © 2015 Pivotal Software, Inc. All rights reserved.
Service Registration/Discovery @SpringBootApplication @EnableCircuitBreaker @EnableDiscoveryClient public class CustomerApp extends RepositoryRestMvcConfiguration {
@Override protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration
config) { config.exposeIdsFor(Customer.class); }
public static void main(String[] args) { SpringApplication.run(CustomerApp.class, args); }
}
37 © 2015 Pivotal Software, Inc. All rights reserved.
Fault Tolerance – Circuit Breakers
38 © 2015 Pivotal Software, Inc. All rights reserved.
Fault Tolerance – Circuit Breakers @SpringBootApplication @EnableCircuitBreaker @EnableDiscoveryClient public class CustomerApp extends RepositoryRestMvcConfiguration {
@Override protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration
config) { config.exposeIdsFor(Customer.class); }
public static void main(String[] args) { SpringApplication.run(CustomerApp.class, args); }
}
39 © 2015 Pivotal Software, Inc. All rights reserved.
@HystrixCommand(fallbackMethod = "defaultLink") public Link getStoresByLocationLink(Map<String, Object> parameters) { URI storesUri = URI.create(uri); try {
ServiceInstance instance = loadBalancer.choose("stores"); storesUri = URI.create(String.format("http://%s:%s",
instance.getHost(), instance.getPort())); } catch (RuntimeException e) { // Eureka not available }
Traverson traverson = new Traverson(storesUri, MediaTypes.HAL_JSON); Link link = traverson.follow("stores", "search", "by-location") .withTemplateParameters(parameters).asLink();
return link; }
Enabling a Circuit Breaker
Client-Side Load Balancing
40 © 2015 Pivotal Software, Inc. All rights reserved.
Anatomy of a cloud native framework
Application coordination boilerplate patterns
Application configuration boilerplate patterns
Enterprise application boilerplate patterns
Runtime Platform, Infrastructure Automation boilerplate patterns (provision, deploy, secure, log, data services, etc.)
Clo
ud
Des
ktop
Spring Boot
Spring IO
Pivotal Cloud Foundry
Spring Cloud
+ BOSH