Top Banner
Enabling Microservices @Orbitz Steve Hoffman Senior Principal Engineer @bacoboy Rick Fast Senior Principal Engineer @tortiepoint
137

Enabling Microservices @Orbitz - Velocity Conf 2015

Aug 10, 2015

Download

Technology

Steve Hoffman
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Enabling Microservices @Orbitz - Velocity Conf 2015

Enabling Microservices

@Orbitz

Steve HoffmanSenior Principal Engineer @bacoboy

Rick FastSenior Principal Engineer

@tortiepoint

Page 2: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Page 3: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Page 4: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Page 5: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Outline

• Brief Architecture Overview/History

• From Monolithic to Services to Microservices/Docker

• Automated Pipelines

• Questions

Page 6: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Page 7: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2000

Page 8: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2000

Yes, we are STILL hiring!

Page 9: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2000

Yes, we are STILL hiring!@OrbitzTalent

Page 10: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2000

Web Layer

Business Layer

Page 11: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2000

Page 12: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2000

Page 13: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2000

Business Layer

Page 14: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2000

Business Layer

Page 15: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Business Layer

2000

Page 16: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Business Layer

2003

Page 17: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Business Layer

2003

Page 18: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Business Layer

2003

Page 19: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2003

Page 20: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2004

Page 21: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2004

Page 22: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2004

Page 23: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2012

Page 24: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2012

Page 25: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2012• Multiple Brands

• Websites

• Webservices

• Multiple Backends

• 500+ apps / thousands of instances

• Deployments Daily (sometimes more)

Page 26: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

2015• Multiple Brands

• Websites

• Webservices

• Multiple Backends

• 500+ apps / thousands of instances

• Deployments Daily (sometimes more)

Page 27: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Process Overkill

Page 28: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Different Provisioning Tools

DEV OPS

Page 29: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Different Provisioning Tools

DEV OPS

Application Platform!=

Page 30: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

A New Experiment• Microservices?

• Decompose single “service” into the actual 40+ sub-services

• Any change to sub-service was a deployment of many

• Could it be a simple Spring Boot App in Docker (12 factor?)

• Backward compatible with existing service infrastructure.

• Code to Production w/o help from other Humans - Minutes not Days

Page 31: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

The Docker Slave aka “The Rickbot”

Page 32: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

The Docker Slave aka “The Rickbot”

App

App

App

Page 33: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 34: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 35: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App Register & Lookup

Page 36: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

10.10.10.1010.10.10.10:31002

App

App

App Register & Lookup

Page 37: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 38: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 39: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Page 40: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Page 41: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Page 42: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Page 43: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Page 44: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

http://consul.io

Page 45: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 46: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 47: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

10.10.10.10

App

App

App

Page 48: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

10.10.10.10

10.10.10.10:51515

App

App

App

Page 49: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 50: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 51: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 52: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

10.10.10.10

App

App

App

Page 53: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

10.10.10.1010.10.10.10:1337

App

App

App

Page 54: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Almost done…

App

App

App

Page 55: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 56: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 57: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 58: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

VIP

Page 59: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

VIP

Page 60: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

VIP

Page 61: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

VIP

https://github.com/QubitProducts/bamboo

Page 62: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 63: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

App

App

App

Page 64: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

AppApp

App

Page 65: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

AppApp

App

Page 66: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

A Little More Background

Page 67: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Page 68: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Module

Module

Module Module

Page 69: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Editorial ModuleA Continuously Deployed Microservice

www.orbitz.com (scroll down)

Page 70: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

OrbitzContent

Orchestration Service

Content (Solr)

Editorial Module

Search Module

Hotel Module

Page 71: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

OrbitzContent

Orchestration Service

Content (Solr)

Editorial Module

Search Module

Hotel Module

Hotel Team Search Team Content Team

Page 72: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

OrbitzContent

Orchestration Service

Content (Solr)

Editorial Module

Search Module

Hotel Module

Page 73: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

OrbitzContent

Orchestration Service

Content (Solr)

Editorial Module

Search Module

Hotel Module

Hotel Team

Search Team

Content Team

Page 74: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Pre-Continuous Delivery

1.2-­‐BETA-­‐20150401-­‐113002

Test Discard

Test Discard1.2-­‐BETA-­‐20150402-­‐093002

Build

Build

And so on…

Page 75: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Pre-Continuous Delivery

1.2-­‐BETA-­‐20150401-­‐113002

Test Discard

Test Discard1.2-­‐BETA-­‐20150402-­‐093002

Build

Build

Test Deploy1.2

Build

Page 76: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Continuous Delivery with Jenkins, Docker, and Ansible

(And then Marathon)

Page 77: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

rfast-mbp:git rfast$ yo microservice

_-----_ | | .--------------------------. |--(o)--| | Welcome to the kickass | `---------´ | Microservice | ( _´U`_ ) | generator! | /___A___\ '--------------------------' | ~ | __'.___.'__ ´ ` |° ´ Y `

? Enter the name of your service. (E.G. "my-service")

Yo

Page 78: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Committer

Pull Request

Page 79: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Committer

Reviewer

Pull Request

Page 80: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Committer

Reviewer

Pull Request

Page 81: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Committer

Reviewer

Pull Request

Page 82: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Jenkins Pipeline

Page 83: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

if(…) { x ++; }

Merge

Page 84: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

build unit test publish

deploy dev

acceptance tests

deploy qa

deploy staging open RFC deploy

prod close RFC

Pipeline (Simplified)

Page 85: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

if(…) { x ++; }

1.2

MergeBuild

Page 86: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

if(…) { x ++; }

1.2

Merge

1.2.

editorial-module.jar

./gradlew build

{BUILD_NUMBER}

Build

Page 87: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2

Merge

editorial-module.jar

if(…) { x ++; }

171.2.

Build

Page 88: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2

Merge

editorial-module.jar

FROM orbitz/java-8 ADD build/editorial-module.jar /opt/orbitz CWD /opt/orbitz CMD java -jar editorial-module.jar

if(…) { x ++; }

171.2.

Build

Page 89: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2

Merge

editorial-module.jar orbitz/editorial-module:1.2.17

if(…) { x ++; }

171.2.

Build

Page 90: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

orbitz/editorial-module:1.2.17

Build

Page 91: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- hosts: dev - tasks: - name: find previous images docker_facts: image=orbitz/{{application}} register: previous - name: deploy new image docker: image=orbitz/{{application}}:{{version}} … - name: wait for service wait_for: port={{port}} … - name: check health endpoint uri: url="http://{{fqdn}}:{{port}}/health" … - name: kill old image docker: {{previous}}

git pull

playbook.yml (abridged)

Deploy

Page 92: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

host-001 host-002 host-003 host-004 host-005

- hosts: devDeploy

Page 93: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

host-001

1.2.16

Deploy

Page 94: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2.16 1.2.17

host-001

Deploy

Page 95: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2.16 1.2.17

host-001

Deploy

DATABASE_URL=jdbc://whatever/db/stuff CONSUL_HOST={{ansible_fqdn}} LOGSTASH_HOST={{ansible_fqdn}} GRAPHITE_HOST={{ansible_fqdn}}

Page 96: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2.16 1.2.17

/health

host-001

Deploy

Page 97: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2.16 1.2.17

/health 200 OK

host-001

Deploy

Page 98: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2.16 1.2.17

host-001

Deploy

Page 99: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2.17

host-001

Deploy

Page 100: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

host-002

1.2.16

And so on…host-001

1.2.17

Deploy

Page 101: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

What’s next?

Page 102: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

How to handle failure?

Page 103: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

What happens when a VM is moved?

Page 104: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

What if I need to add capacity?

Page 105: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- hosts: dev - tasks: - name: find previous images docker_facts: image=orbitz/{{application}} register: previous - name: deploy new image docker: image=orbitz/{{application}}:{{version}} … - name: wait for service wait_for: port={{port}} … - name: check health endpoint uri: url="http://{{fqdn}}:{{port}}/health" … - name: kill old image docker: {{previous}}

git pull

playbook.yml (abridged)

Deploy

Page 106: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- hosts: dev - tasks: - name: find previous images docker_facts: image=orbitz/{{application}} register: previous - name: deploy new image docker: image=orbitz/{{application}}:{{version}} … - name: wait for service wait_for: port={{port}} … - name: check health endpoint uri: url="http://{{fqdn}}:{{port}}/health" … - name: kill old image

git pull

playbook.yml (abridged)

- hosts: localhost - tasks: - name: marathon deploy marathon: image=orbitz/{{application}}:{{version}} instances=3

Deploy

Page 107: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

git pull

playbook.yml (abridged)

- hosts: localhost - tasks: - name: marathon deploy marathon: image=orbitz/{{application}}:{{version}} instances=3

Deploy

Page 108: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

New host setup

Deploy

Page 109: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Mesos Agent

New host setup

1.2.16

Deploy

Page 110: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- tasks: marathon: …

playbook.yml1.2.16

1.2.16

1.2.16

Deploy

Page 111: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- tasks: marathon: …

1.2.16

1.2.16

1.2.16

Deploy

Page 112: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- tasks: marathon: …

1.2.16

1.2.16

1.2.16

Deploy

Page 113: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- tasks: marathon: …

PUT /apps/editorial-module { “image”: “orbitz/editorial-module:1.2.17” … }

1.2.16

1.2.16

1.2.16

Deploy

Page 114: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Deploy

PUT /apps/editorial-module { “image”: “orbitz/editorial-module:1.2.17” … }

- tasks: marathon: …

1.2.16

1.2.16

1.2.16

app = GET /v2/apps/editorial-module

if not app then deploy_id = POST /v2/apps { “image”: “orbitz/editorial-module:1.2.17”, “id”: “editorial-module” } else deploy_id = PUT /v2/apps/editorial-module { “image”: “orbitz/editorial-module:1.2.17” } end if

while GET /v2/deployments contains deploy_id // still deploying end

// deploy complete

Page 115: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- tasks: marathon: …

PUT /apps/editorial-module { “image”: “orbitz/editorial-module:1.2.17” … }

1.2.16

1.2.16

1.2.16

Deploy

Page 116: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- tasks: marathon: …

1.2.16

1.2.16

1.2.16

Deploy

Page 117: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- tasks: marathon: …

1.2.16

1.2.16

1.2.16

1.2.17

1.2.17

1.2.17

Deploy

Page 118: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- tasks: marathon: …

/health

1.2.16

1.2.16

1.2.16

1.2.17

1.2.17

1.2.17

Deploy

Page 119: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- tasks: marathon: …

/health

200 OK

200 OK

200 OK

1.2.16

1.2.16

1.2.16

1.2.17

1.2.17

1.2.17

Deploy

Page 120: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

- tasks: marathon: …

1.2.17

1.2.17

1.2.17

Deploy

Page 121: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

And off to the next environment…

1.2.17

1.2.17

1.2.17

Deploy

Page 122: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2.17

1.2.17

1.2.17

What if?

Page 123: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2.17

1.2.17

Page 124: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2.17

1.2.17

Page 125: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2.17 1.2.17

1.2.17

Page 126: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

/health

200 OK

1.2.17 1.2.17

1.2.17

Page 127: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

1.2.17 1.2.17

1.2.17

Page 128: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Smoke/Acceptance Testing

1.2.17

1.2.17

1.2.17

Page 129: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Paper Trail

create

tickets

commit(s)

Page 130: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Paper Trail

fail!

close/fail

Page 131: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Paper Trail

ok

close

Page 132: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Build Unit Test

Deploy Dev

Deploy Prod

Deploy Staging

Acceptance TestCode

Review & Push

Production

Pre-Production

Open RFC

Close RFC

Page 133: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

What’s inside the containers?• Spring Boot

• Dropwizard Metrics (formerly Coda Hale, Yammer)

• Consul Registration/Discovery OrbitzWorldwide/consul-client

• Logstash + Logback

• Swagger

• Hystrix

• Retrofit + Consul

Page 134: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

“Why didn’t you use {{.x}} ?”

Page 135: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Keeping an eye on…

Kubernetes Amazon Elastic Container

Service

Docker Swarm

Page 136: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconfMay 2015

Summary• Create a platform for docker deployments using shared and app-specific “localhost” helpers

— this was ours, yours SHOULD look different — adapt to change, don’t fight it.

• People don’t scale, use automation

• Docker - repeatable applications (environment portable apps)

• Chef - repeatable infrastructure (environment aware services)

• Jenkins - repeatable releases (pipelines)

• Delineate configuration concerns:

• Known at Compile time — Bake into Docker image

• Known at Boot time — Bake into Playbook/Launcher - parameter to Docker run

• Changes Anytime — Externalize (consul K/V, etcd, zookeeper)

Page 137: Enabling Microservices @Orbitz - Velocity Conf 2015

#velocityconf2015

Questions?