Más contenido relacionado
La actualidad más candente (20)
Similar a Pivotal spring boot-cloud workshop (20)
Pivotal spring boot-cloud workshop
- 1. 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. 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. 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. 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. 5© 2015 Pivotal Software, Inc. All rights reserved.5
Cloud Native
DevOps Continuous
Delivery
ContainersMicro services
- 6. 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. 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. 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
- 10. 10© 2015 Pivotal Software, Inc. All rights reserved.
10
Spring
Cloud
Spring
BootDev
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
- 12. 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;
@SpringBootApplication
public 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. 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;
@RestController
public class HelloController {
@RequestMapping("/")
public String index() {
return "Greetings from Spring Boot!";
}
}
Ready for SpringMVC
to handle Web requests
Maps ‘/’ to this method
- 17. 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. 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
Dynamic Router
OAuth 2.0 Server (UAA)
CELL
Garden
Build Packs
Login Server
CC & CC Bridge
Blob Store
BBS/etcd
Sys Log
Service Brokers
Collector App Log
ROUTING
AUTHENTICATION
APP LIFECYCLE
APP STORAGE
& EXECUTION
MESSAGING
METRICS & LOGGING
Pivotal CF OpsManager/BOSH
BBS Converger
VMware OpenStack AWS Azure Google
- 19. 19© Copyright 2013 Pivotal. All rights reserved.
Container Scheduling
Application Framework
ServicesPlatform Runtime
Routing DatabaseConfigurationService Discovery
Big Data
Object Storage
Mobile
Build CI
User ProvidedLogging & Metrics Messaging
Circuit Breakers12 Factor Apps
RESTful
Services
Microservices
.NETSpring Boot Node.jsRuby on Rails
Operations
Zero Downtime
Deployments
Failover &
Recovery
Scaling
Security
Patching
Platform
Upgrades
Infrastructure OpenStack AmazonVMware Azure
- 20. 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. 21© 2015 Pivotal Software, Inc. All rights reserved.
Stage an ApplicationRouter
Cloud Foundry
ElasQc RunQme
Blobstore DB
CELL
Detect Compile Upload
NoYes
System
Buildpacks
Cloud Controller
Service
credentialscreds
Cloud Controller
Bridge
Task
+ =
- 22. 22© 2015 Pivotal Software, Inc. All rights reserved.
Router
Cloud Controller
Cloud Controller
Bridge
Auctioneer BBS
CELL Rep
Executor
CELL Rep
Executor
CELL Rep
Executor
ACCESS
APP
Deploying an Application
- 23. 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
- 25. 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. 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
- 32. 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
- 34. 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. 35© 2015 Pivotal Software, Inc. All rights reserved.
Service Registration/Discovery
- 36. 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. 37© 2015 Pivotal Software, Inc. All rights reserved.
Fault Tolerance – Circuit Breakers
- 38. 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. 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. 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.)
CloudDesktop
Spring Boot
Spring IO
Pivotal Cloud Foundry
Spring Cloud
+ BOSH