Transcript
Page 1: Deploying and Testing Microservices

TESTING & DEPLOYING MICROSERVICESSam Newman Flowcon, September 2014

1

Page 2: Deploying and Testing Microservices

@samnewman@flowconsf

Accounts

Returns

Invoicing

Shipping

Inventory

Customer Service

Page 3: Deploying and Testing Microservices

@samnewman@flowconsf

Accounts

Returns

Invoicing

Shipping

Inventory

Customer Service

Focused around a business domain

Page 4: Deploying and Testing Microservices

@samnewman@flowconsf

Accounts

Returns

Invoicing

Shipping

Inventory

Customer Service

Focused around a business domain

Technology Agnostic API

Page 5: Deploying and Testing Microservices

@samnewman@flowconsf

Accounts

Returns

Invoicing

Shipping

Inventory

Customer Service

Focused around a business domain

Technology Agnostic API

Small

Page 6: Deploying and Testing Microservices

@samnewman@flowconsf

Independently Releasable

Page 7: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

Deployment

Page 8: Deploying and Testing Microservices

@samnewman@flowconsf

Host

Service

Page 9: Deploying and Testing Microservices

@samnewman@flowconsf

Host

Service

Host

Service Service

Service Service

VS

Page 10: Deploying and Testing Microservices

@samnewman@flowconsf

Host

Service

Host

Service Service

Service Service

Much Easier To Reason About

VS

Page 11: Deploying and Testing Microservices

@samnewman@flowconsf

Host

Service

Host

Service Service

Service Service

Much Easier To Reason About

Easier To Provision

VS

Page 12: Deploying and Testing Microservices

@samnewman@flowconsf

Host

Service

Host

Service Service

Service Service

Much Easier To Reason About

Easier To Provision

Fewer Side-effects

VS

Page 13: Deploying and Testing Microservices

@samnewman@flowconsf

Host

Service

Host

Service Service

Service Service

Much Easier To Reason About

Easier To Provision

Fewer Side-effects

VS

Enforces Interdependence

Page 14: Deploying and Testing Microservices

@samnewman@flowconsf

Host

Service

Host

Service Service

Service Service

Much Easier To Reason About

Easier To Provision

Fewer Side-effectsLower host-management overhead

VS

Enforces Interdependence

Page 15: Deploying and Testing Microservices

@samnewman@flowconsf

Host

Service

Host

Service Service

Service Service

Much Easier To Reason About

Easier To Provision

Fewer Side-effectsCheaper!

Lower host-management overhead

VS

Enforces Interdependence

Page 16: Deploying and Testing Microservices

@samnewman@flowconsf

Reducing Host Management Overhead?

Page 17: Deploying and Testing Microservices

@samnewman@flowconsf

API-driven Host Provisioning

Page 18: Deploying and Testing Microservices

@samnewman@flowconsf

Virtualisation Platforms

Page 19: Deploying and Testing Microservices

@samnewman@flowconsf

VMWare

Virtualisation Platforms

Page 20: Deploying and Testing Microservices

@samnewman@flowconsf

VMWareAWS

Digital Ocean

Virtualisation Platforms

Page 21: Deploying and Testing Microservices

@samnewman@flowconsf

Step 0: Provision Host

Page 22: Deploying and Testing Microservices

@samnewman@flowconsf

Step 0: Provision Host

Step 1: Configure Host

Page 23: Deploying and Testing Microservices

@samnewman@flowconsf

Step 0: Provision Host

Step 2: Install Service

Step 1: Configure Host

Page 24: Deploying and Testing Microservices

@samnewman@flowconsf

Step 0: Provision Host

Step 2: Install Service

Step 1: Configure Host

Page 25: Deploying and Testing Microservices

@samnewman@flowconsf

Page 26: Deploying and Testing Microservices

@samnewman@flowconsf

Ansible

Puppet

Chef

Page 27: Deploying and Testing Microservices

@samnewman@flowconsf

Ansible

Puppet

Chef

Page 28: Deploying and Testing Microservices

@samnewman@flowconsf

Ansible

Puppet

Chef

AWS

Digital Ocean

OpenStack

VMWare

Page 29: Deploying and Testing Microservices

@samnewman@flowconsf

Ansible

Puppet

Chef

AWS

Digital Ocean

OpenStack

VMWare

Vagrant

Page 30: Deploying and Testing Microservices

@samnewman@flowconsf

Ansible

Puppet

Chef

AWS

Digital Ocean

OpenStack

VMWare

Vagrant

Immutable Servers

Page 31: Deploying and Testing Microservices

@samnewman@flowconsf

Ansible

Puppet

Chef

AWS

Digital Ocean

OpenStack

VMWare

Vagrant

Immutable Servers

Fast Spin-up

Page 32: Deploying and Testing Microservices

@samnewman@flowconsf

Ansible

Puppet

Chef

AWS

Digital Ocean

OpenStack

VMWare

Vagrant

Immutable Servers

Fast Spin-up

Provider Agnostic

Page 33: Deploying and Testing Microservices

@samnewman@flowconsf

Ansible

Puppet

Chef

AWS

Digital Ocean

OpenStack

VMWare

Vagrant

Immutable Servers

Fast Spin-up

Provider Agnostic

Feedback Can Suffer

Page 34: Deploying and Testing Microservices

@samnewman@flowconsf

Ansible

Puppet

Chef

AWS

Digital Ocean

OpenStack

VMWare

Vagrant

Immutable Servers

Fast Spin-up

Provider Agnostic

Feedback Can Suffer

Cycle Time

Page 35: Deploying and Testing Microservices

@samnewman@flowconsf

Immutable Servers

Page 36: Deploying and Testing Microservices

@samnewman@flowconsf

Cost?

Page 37: Deploying and Testing Microservices

@samnewman@flowconsf

Machine

Base OS

Hypervisor

VM

OS

Apps

VM

OS

Apps

VM

OS

Apps

Page 38: Deploying and Testing Microservices

@samnewman@flowconsf

Machine

Base OS

Hypervisor

VM

OS

Apps

VM

OS

Apps

VM

OS

Apps

Expensive!

Page 39: Deploying and Testing Microservices

@samnewman@flowconsf

Page 40: Deploying and Testing Microservices

@samnewman@flowconsf

Page 41: Deploying and Testing Microservices

@samnewman@flowconsf

DOCKER

Page 42: Deploying and Testing Microservices

@samnewman@flowconsf

DOCKER

Machine

Page 43: Deploying and Testing Microservices

@samnewman@flowconsf

DOCKER

Machine

Base OS

Page 44: Deploying and Testing Microservices

@samnewman@flowconsf

DOCKER

Machine

Base OS

Docker

Page 45: Deploying and Testing Microservices

@samnewman@flowconsf

DOCKER

Machine

Base OS

Docker

Apps

Page 46: Deploying and Testing Microservices

@samnewman@flowconsf

DOCKER

Machine

Base OS

Docker

Apps Apps

Page 47: Deploying and Testing Microservices

@samnewman@flowconsf

DOCKER

Machine

Base OS

Docker

Apps Apps Apps

Page 48: Deploying and Testing Microservices

@samnewman@flowconsf

DOCKER

Machine

Base OS

Docker

Apps Apps Apps

Docker Image Registry

Page 49: Deploying and Testing Microservices

@samnewman@flowconsf

DOCKER

Machine

Base OS

Docker

Apps Apps Apps

Docker Image Registry

Page 50: Deploying and Testing Microservices

@samnewman@flowconsf

DOCKER

Machine

Base OS

Docker

Apps Apps Apps

Docker Image Registry

Page 51: Deploying and Testing Microservices

@samnewman@flowconsf

Page 52: Deploying and Testing Microservices

@samnewman@flowconsf

Page 53: Deploying and Testing Microservices

@samnewman@flowconsf

Semi-permanent Servers

Page 54: Deploying and Testing Microservices

@samnewman@flowconsf

Semi-permanent Servers

Image-based Deployments

Page 55: Deploying and Testing Microservices

@samnewman@flowconsf

Semi-permanent Servers

Image-based Deployments

Docker

Page 56: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

Page 57: Deploying and Testing Microservices

@samnewman@flowconsf

The Monolith

DB

Page 58: Deploying and Testing Microservices

@samnewman@flowconsf

The Monolith

DB

Page 59: Deploying and Testing Microservices

@samnewman@flowconsf

The Monolith

DB

Page 60: Deploying and Testing Microservices

@samnewman@flowconsf

The Monolith

DB

Page 61: Deploying and Testing Microservices

@samnewman@flowconsf

InventoryAccounts

Returns

Invoicing

Shipping

Customer Service

Page 62: Deploying and Testing Microservices

@samnewman@flowconsf

InventoryAccounts

Returns

Invoicing

Shipping

Customer Service

Inventory

Page 63: Deploying and Testing Microservices

@samnewman@flowconsf

InventoryAccounts

Returns

Invoicing

Shipping

Customer Service

Inventory

Page 64: Deploying and Testing Microservices

@samnewman@flowconsf

Inventory Accounts

Mountebank http://www.mbtest.org

Page 65: Deploying and Testing Microservices

@samnewman@flowconsf

InventoryAccounts!Stub

Mountebank http://www.mbtest.org

Page 66: Deploying and Testing Microservices

@samnewman@flowconsf

Shipping

InventoryAccounts

Returns

Invoicing

Customer Service

Page 67: Deploying and Testing Microservices

@samnewman@flowconsf

Shipping

InventoryAccounts

Returns

Invoicing

Customer Service

Page 68: Deploying and Testing Microservices

@samnewman@flowconsf

Shipping

InventoryAccounts

Returns

Invoicing

Customer Service

Page 69: Deploying and Testing Microservices

@samnewman@flowconsf

Shipping

InventoryAccounts

Returns

Invoicing

Customer Service

Page 70: Deploying and Testing Microservices

@samnewman@flowconsf

Shipping

InventoryAccounts

Returns

Invoicing

Customer Service

Page 71: Deploying and Testing Microservices

@samnewman@flowconsf

Page 72: Deploying and Testing Microservices

@samnewman@flowconsf

Browsers

Page 73: Deploying and Testing Microservices

@samnewman@flowconsf

Timing

Browsers

Page 74: Deploying and Testing Microservices

@samnewman@flowconsf

Provisioning of Environments

Timing

Browsers

Page 75: Deploying and Testing Microservices

@samnewman@flowconsf

Provisioning of Environments

Networks

Timing

Browsers

Page 76: Deploying and Testing Microservices

@samnewman@flowconsf

Deployment

Provisioning of Environments

Networks

Timing

Browsers

Page 77: Deploying and Testing Microservices

@samnewman@flowconsf

Deployment

Provisioning of Environments

Networks

Timing

Browsers Diagnosis

Page 78: Deploying and Testing Microservices

@samnewman@flowconsf

Shipping Inventory

CONSUMER-DRIVEN CONTRACTS

Page 79: Deploying and Testing Microservices

@samnewman@flowconsf

Expectations

Shipping Inventory

CONSUMER-DRIVEN CONTRACTS

Page 80: Deploying and Testing Microservices

@samnewman@flowconsf

Expectations

Shipping Inventory

CONSUMER-DRIVEN CONTRACTS

Page 81: Deploying and Testing Microservices

@samnewman@flowconsf

Expectations

Prod

Shipping Inventory

CONSUMER-DRIVEN CONTRACTS

Page 82: Deploying and Testing Microservices

@samnewman@flowconsf

Expectations

Prod

Shipping Inventory

CONSUMER-DRIVEN CONTRACTS

Page 83: Deploying and Testing Microservices

@samnewman@flowconsf

Page 84: Deploying and Testing Microservices

@samnewman@flowconsf

https://github.com/realestate-com-au/pact

Page 85: Deploying and Testing Microservices

@samnewman@flowconsf

No Integration Tests?

Page 86: Deploying and Testing Microservices

@samnewman@flowconsf

Journeys

Page 87: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

Page 88: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

S/M TestsBuild Large Tests

Page 89: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

S/M TestsBuild Large Tests

Page 90: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

S/M TestsBuild Large Tests Production

Page 91: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

S/M TestsBuild Large Tests Production

Monitoring & Alerting

Page 92: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

S/M TestsBuild Large Tests Production

Monitoring & Alerting

Testers

Page 93: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

S/M TestsBuild Large Tests Production

Monitoring & Alerting

Testers Operations

Page 94: Deploying and Testing Microservices

@samnewman@flowconsf

Monitoring & AlertingTesting

Page 95: Deploying and Testing Microservices

@samnewman@flowconsf

Prod

Prod

Prod

Prod

Page 96: Deploying and Testing Microservices

@samnewman@flowconsf

Prod

Prod

Prod

Prod

QA

Page 97: Deploying and Testing Microservices

@samnewman@flowconsf

Monitoring & Alerting

Testing

Page 98: Deploying and Testing Microservices

@samnewman@flowconsf

Monitoring & Alerting

Testing

Page 99: Deploying and Testing Microservices

@samnewman@flowconsf

Monitoring & Alerting

Testing

Page 100: Deploying and Testing Microservices

@samnewman@flowconsf

Monitoring & Alerting

Testing

Page 101: Deploying and Testing Microservices

@samnewman@flowconsf

Page 102: Deploying and Testing Microservices

@samnewman@flowconsf

Page 103: Deploying and Testing Microservices

@samnewman@flowconsf

SEMANTIC MONITORING

Page 104: Deploying and Testing Microservices

@samnewman@flowconsfhttps://www.flickr.com/photos/robdray/3138644233

Page 105: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

Deployment

Page 106: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

Deployment

One-server per host

Page 107: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

Deployment

One-server per host

Image/docker based artefacts

Page 108: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

Deployment

One-server per host Immutable ServersImage/docker

based artefacts

Page 109: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

Pre-Release Validation

Consumer-driven Contracts

Single-server Tests

Journey Tests

Deployment

One-server per host Immutable ServersImage/docker

based artefacts

Page 110: Deploying and Testing Microservices

@samnewman@flowconsf

Testing

Post-Release Validation

Semantic Monitoring

Pre-Release Validation

Consumer-driven Contracts

Single-server Tests

Journey Tests

Deployment

One-server per host Immutable ServersImage/docker

based artefacts

Page 111: Deploying and Testing Microservices

37

Sam Newman

Building MicroservicesDESIGNING FINE-GRAINED SYSTEMS

Page 112: Deploying and Testing Microservices

Any questions: @samnewman

[email protected]

THANKS!


Top Related