45
DEPLOYING MICROSERVICES TO 1

Deploying Microservices to Cloud Foundry

Embed Size (px)

Citation preview

Page 1: Deploying Microservices to Cloud Foundry

DEPLOYING MICROSERVICES TO

1

Page 2: Deploying Microservices to Cloud Foundry

MEMatt Stine @mstine

Principal Software EngineerPivotal

[email protected]

2

Page 3: Deploying Microservices to Cloud Foundry

I WROTE A LITTLE CLOUD BOOK...

FREE - Compliments of Pivotal

http://bit.ly/cloud-native-book

ATTACK THE PIVOTAL BOOTH TO GET A PRINT

COPY!3

Page 4: Deploying Microservices to Cloud Foundry

Now that you have Cloud Foundry, what are you going to do with it?

4

Page 5: Deploying Microservices to Cloud Foundry

IF YOU'RE SMART, START WITH A

MONOLITH.5

Page 6: Deploying Microservices to Cloud Foundry

MAKE IT 12 FACTOR6

Page 7: Deploying Microservices to Cloud Foundry

EVENTUALLY THINGS GET BIGGER...

7

Page 8: Deploying Microservices to Cloud Foundry

...AND IT BECOMES TIME TO DECOMPOSE.8

Page 9: Deploying Microservices to Cloud Foundry

MICROSERVICES?9

Page 10: Deploying Microservices to Cloud Foundry

Loosely coupled service oriented architecture with bounded contexts...

— Adrian Cockcroft

10

Page 11: Deploying Microservices to Cloud Foundry

YOU MUST BE THIS TALL TO USE MICROSERVICES

▸ RAPID PROVISIONING▸ BASIC MONITORING

▸ RAPID APPLICATION DEPLOYMENT▸ DEVOPS CULTURE

http://martinfowler.com/bliki/MicroservicePrerequisites.html

11

Page 12: Deploying Microservices to Cloud Foundry

A SYMBIOTIC RELATIONSHIP

12

Page 13: Deploying Microservices to Cloud Foundry

PLATFORM FEATURES▸ Environment Provisioning▸ On-Demand Scaling▸ Failover/Resilience▸ Routing/Load Balancing

▸ Data Service Operations (BOSH)13

Page 14: Deploying Microservices to Cloud Foundry

NO MICROSERVICEIS AN ISLAND

14

Page 15: Deploying Microservices to Cloud Foundry

SOME CHALLENGES OF DISTRIBUTED SYSTEMS▸ Configuration Management

▸ Service Registration & Discovery▸ Routing & Load Balancing▸ Fault Tolerance▸ Monitoring

15

Page 16: Deploying Microservices to Cloud Foundry

We need a representation of the composite system!

16

Page 17: Deploying Microservices to Cloud Foundry

THE BIG A APP17

Page 18: Deploying Microservices to Cloud Foundry

---memory: 512Minstances: 1no-route: trueservices: - cloudamqp-autoscaleapplications:- name: worker-process path: worker-process/build/libs/worker-process.jar- name: producer-process path: producer/build/libs/producer.jar- name: autoscaler-process path: autoscaler/build/libs/autoscaler.jar- name: autoscale-monitor no-route: false host: autoscale-monitor-${random-word} path: monitor/build/libs/monitor.jar

18

Page 19: Deploying Microservices to Cloud Foundry

STATICVS.

DYNAMIC19

Page 20: Deploying Microservices to Cloud Foundry

Like BOSH, but for microservices?

20

Page 21: Deploying Microservices to Cloud Foundry

DECENTRALIZEDAUTONOMOUSCAPABILITY

TEAMS / SERVICES21

Page 22: Deploying Microservices to Cloud Foundry

You write it, you run it!

22

Page 23: Deploying Microservices to Cloud Foundry

23

Page 24: Deploying Microservices to Cloud Foundry

SPRING CLOUDDISTRIBUTED SYSTEM PATTERNS FTW!

24

Page 25: Deploying Microservices to Cloud Foundry

APP/SERVICELEVEL

PATTERNS25

Page 26: Deploying Microservices to Cloud Foundry

DEPLOYING/RUNNING APPS

VS.COMPOSING FAULT TOLERANT SYSTEMS

26

Page 27: Deploying Microservices to Cloud Foundry

SPRING CLOUD + NETFLIX OSS▸ Config Server / Cloud Bus▸ Eureka (Service Registry)▸ Ribbon (Load Balancer)▸ Hystrix (Circuit Breakers)▸ Zuul (Intelligent Routing)

27

Page 28: Deploying Microservices to Cloud Foundry

WORKS ON LATTICE TOO!

https://lattice.cf28

Page 29: Deploying Microservices to Cloud Foundry

CONFIG SERVER

29

Page 30: Deploying Microservices to Cloud Foundry

CONFIG SERVER + CLOUD BUS

30

Page 31: Deploying Microservices to Cloud Foundry

DEMO31

Page 32: Deploying Microservices to Cloud Foundry

EUREKA (SERVICE REGISTRY)

32

Page 33: Deploying Microservices to Cloud Foundry

DEMO33

Page 34: Deploying Microservices to Cloud Foundry

BEFORE CF_RELEASE V204

34

Page 35: Deploying Microservices to Cloud Foundry

CF_RELEASE V195"CF_INSTANCE_INDEX"=>"0","CF_INSTANCE_IP"=>"1.2.3.4","CF_INSTANCE_PORT"=>"5678","CF_INSTANCE_ADDR"=>"1.2.3.4:5678","CF_INSTANCE_PORTS"=>[{external:80,internal:5678}]

35

Page 36: Deploying Microservices to Cloud Foundry

CF_RELEASE V204properties: dea_next: allow_host_access: true

36

Page 37: Deploying Microservices to Cloud Foundry

AFTER CF_RELEASE V204

37

Page 38: Deploying Microservices to Cloud Foundry

DEMO38

Page 39: Deploying Microservices to Cloud Foundry

HYSTRIX (CIRCUIT BREAKER)

39

Page 40: Deploying Microservices to Cloud Foundry

DEMO40

Page 41: Deploying Microservices to Cloud Foundry

ZUUL (INTELLIGENT ROUTING)

41

Page 42: Deploying Microservices to Cloud Foundry

DEMO42

Page 43: Deploying Microservices to Cloud Foundry

SPRING CLOUD FUTURES▸ Alternative Stacks (Consul, Zookeeper, etcd, JRugged, ...)▸ Distributed Request Tracing/Correlation (i.e. Dapper/Zipkin)▸ Stateful Patterns (Leader Election, Locks, State Machine)

▸ Developer Workflow Improvements▸ Switches (Canaries, Feature Toggles, Surgical Routing, ...)

43

Page 44: Deploying Microservices to Cloud Foundry

LEARN MOAR▸ http://cloud.spring.io

▸ http://spring.io/blog/2015/04/06/lattice-and-spring-cloud-resilient-sub-structure-for-your-cloud-native-spring-applications

▸ http://lattice.cf▸ http://netflix.github.io

44

Page 45: Deploying Microservices to Cloud Foundry

THANK YOU▸ THIS TALK: https://github.com/mstine/2015-cfsummit-deploying-

ms-to-cf▸ DEMOS: https://github.com/mstine/intro-spring-cloud-workshop/

tree/lattice

45