how to build a micro-services infrastructure in 7 days€¦ · micro-services infrastructure in 7...

147
How To Build A Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar

Upload: others

Post on 17-Oct-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

How To Build A

Micro-Services Infrastructure

in 7 Days

Gil Tayar, November 2017

@giltayar

Page 2: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Wix Internal

Hackathon -

December 2015

Page 3: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

About Me ● My developer experience goes all the way back to the ‘80s.

● Am, was, and always will be a developer● Currently evangelist and architect at

Applitools● Visual Testing

● Sometimes my arms bend back● But the gum I like is coming back in style

Page 4: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

A Movie Script in 6 Parts1. Prolog

2. The Plan

3. The Job

4. The Change of Plan

5. It All Comes Together

6. Epilog

Page 5: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

1. Prolog

Page 6: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Wix

Page 7: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Statistics

● 100 Million Users

● 2B HTTP Requests/Day

● Over 200 Micro-services

● 100 Deployments/Day

Page 8: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

And an Aging Micro-

Services Infra!

Page 9: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

What is a Micro-services infrastructure?

Service A

Service B

Service C

Service A

Service B

Service C

Service A

Service C

Service D

Service A

Service C

Service D

Service A

Service B

Service D

Deploying

Running

Keeping Healthy

Page 10: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Is It That Bad?

Page 11: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Slow Deployments…

Chef-based

Suboptimal Blue/Green Deployment

Slow Rollbacks

Page 12: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Static DefinitionsInstance of Service A

Instance of Service B

Instance of Service C

Instance of Service B

Instance of Service C

Instance of Service D

Instance of Service A

Instance of Service C

Instance of Service D

Foo

Bar

Baz

Page 13: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Different Staging Infra

Different E2E Testing Infra

Page 14: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Can we rebuild it?

In a week?

Page 15: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015
Page 16: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015
Page 17: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015
Page 18: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

2. The Plan`

Page 19: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

December 15, 2015

Page 20: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

The Scope

Page 21: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

The Scope (I)

sample-web-servicesample-web-serviceweb-service

sample-web-servicesample-web-servicerpc-service

Page 22: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

The Scope (II)

$ npm install -g apollo

$ apollo artifact-deploy web-service:1.5.0 -n 20

$ curl web-service.demo-domain.com/....

$ apollo artifact-deploy web-service:1.6.0 -n 30

Page 23: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

The Scope (II)

$ npm install -g apollo

$ apollo artifact-deploy web-service:1.5.0 -n 20

$ curl web-service.demo-domain.com/....

$ apollo artifact-deploy web-service:1.6.0 -n 30

Page 24: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

The Scope (II)

$ npm install -g apollo

$ apollo artifact-deploy web-service:1.5.0 -n 20

$ curl web-service.demo-domain.com/....

$ apollo artifact-deploy web-service:1.6.0 -n 30

Page 25: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

The Scope (II)

$ npm install -g apollo

$ apollo artifact-deploy web-service:1.5.0 -n 20

$ curl web-service.demo-domain.com/....

$ apollo artifact-deploy web-service:1.6.0 -n 30

Page 26: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

The Scope (II)

$ npm install -g apollo

$ apollo artifact-deploy web-service:1.5.0 -n 20

$ curl web-service.demo-domain.com/....

$ apollo artifact-deploy web-service:1.6.0 -n 30

Page 27: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

And we should have

some marketing!

Page 28: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Apollo: Tomorrow’sInfrastructure Today

Deploy Like a Boss‘Cause it’s Built on Mesos

Page 29: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

The Scheduler

Page 30: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

This is a Server Farm

Page 31: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

These are Micro-Service Instances

A

B

C

D

E

EE

E

E

E

E

E

D D

D

D

D

D

C

C

C

C

C

CB BB

B

B

B

B

BB

B

B

B

B

C

C

C

C

C

C

CC

C

C

A

AA

AA

A

A

A

A

A

A

A

A

E

E

E

EE

D

D

D

D

Page 32: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

We Need To Put These Into These

A

B

C

D

E

EE

E

E

E

E

E

D D

D

D

D

D

C

C

C

C

C

CB BB

B

B

B

B

BB

B

B

B

B

C

C

C

C

C

C

CC

C

C

A

AA

AA

A

A

A

A

A

A

A

A

E

E

E

EE

D

D

D

D

Page 33: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

And This is What a Scheduler Does

C

D E

E

E

C

B

B

B

E

C

C

C A

A

D

C

C

A

A

A

E

C

B

A

A

E

ED

D

C

BB

B

E

E

A

E

D C

C

B

B

B

B

C

A

D

B

DB

C

C

A

A A

D

E

D BC

C C

A A

E

E

D D

I need 20 A’s,

10 B’s, 15 C’s...

Page 34: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Which Scheduler?

Mesos/Marathon

Mesos/Aurora

Kubernetes

Nomad

Page 35: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

This Scheduler!

Mesos/Marathon

Page 36: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Why?

Mesos/Marathon

Page 37: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Because!

Why?

Mesos/Marathon

Page 38: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Service Discovery

Page 39: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Three Kinds

sample-web-servicesample-web-serviceweb-service

sample-web-servicesample-web-servicerpc-servicemysql1

Page 40: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Web Service Discovery

sample-web-servicesample-web-serviceweb-service

sample-web-servicesample-web-servicerpc-servicemysql1

wix.com/w/...

Page 41: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

RPC Service Discovery

sample-web-servicesample-web-serviceweb-service

sample-web-servicesample-web-servicerpc-servicemysql1

service.doSomething("a", 4)

Page 42: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

3rd Party

Service Discovery

sample-web-servicesample-web-serviceweb-service

sample-web-servicesample-web-servicerpc-servicemysql1

Select * from ...

Page 43: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

3rd Party

Service Discovery

sample-web-servicesample-web-serviceweb-service

sample-web-servicesample-web-servicerpc-servicemysql1

Select * from ...

Page 44: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

How To Implement

Web Service

Discovery

Page 45: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Web Service Discovery

sample-web-servicesample-web-serviceWeb-service Asample-web-servicesample-web-serviceWeb-service B

Gateway

wix.com/z/...rules

wix.com/w/...

/w ⇒ A/z ⇒ B

Page 46: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Which Proxy?

sample-web-servicesample-web-serviceAsample-web-servicesample-web-serviceB

Gateway

wix.com/z/...rules

HAProxyNginx

wix.com/w/...

/w ⇒ A/z ⇒ B

Page 47: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Why?

sample-web-servicesample-web-serviceAsample-web-servicesample-web-serviceB

Gateway

wix.com/z/...srules

Nginx

wix.com/w/...

/w ⇒ A/z ⇒ B

Page 48: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Why?

sample-web-servicesample-web-serviceAsample-web-servicesample-web-serviceB

Gateway

wix.com/z/...rules

NginxBecause!

wix.com/w/...

/w ⇒ A/z ⇒ B

Page 49: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Where are the rules?

sample-web-servicesample-web-serviceAsample-web-servicesample-web-serviceB

Gateway

wix.com/w/...

wix.com/z/...rules

/w ⇒ A/z ⇒ B

Page 50: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Where are the rules?

sample-web-servicesample-web-serviceAsample-web-servicesample-web-serviceB

Gateway

wix.com/z/...rules

Source Control!

wix.com/w/...

/w ⇒ A/z ⇒ B

Page 51: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

And how does it know

where the instance are?

AA

A

B

B

B

Gateway

rules

?Host1 Host2

/w ⇒ A/z ⇒ B

Page 52: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

The Scheduler Knows

sample-web-servicesample-web-serviceAsample-web-servicesample-web-serviceB

Gateway

web-service.demo.com/w/...

web-service.demo.com/z/...rules

Mesos/

Marathon

Page 53: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

How To Implement

RPC Service

Discovery

Page 54: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

RPC Service Discovery sample-web-servicesample-web-serviceservice

sample-web-servicesample-web-servicerpc-service A

serviceA.doSomething("a", 4)

sample-web-servicesample-web-servicerpc-service B

Gateway

serviceB.doSomethingElse(4, 2)

Page 55: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

See the Resemblance?

Page 56: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Same Difference sample-web-servicesample-web-serviceservice

sample-web-servicesample-web-servicerpc-service Asample-web-servicesample-web-servicerpc-service B

Gateway

Nginx

Page 57: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Where are the rules? sample-web-servicesample-web-serviceservice

sample-web-servicesample-web-servicerpc-service Asample-web-servicesample-web-servicerpc-service B

Gateway

serviceB.doSomethingElse(4, 2)serviceA.doSomething("a", 4)

Page 58: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

No Rules! Conventions sample-web-servicesample-web-serviceservice

sample-web-servicesample-web-servicerpc-service Asample-web-servicesample-web-servicerpc-service B

Gateway

serviceB.doSomethingElse(4, 2)

via http://rpc.int/serviceB/...

serviceA.doSomething("a", 4)

via http://rpc.int/serviceA/...

Page 59: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

sample-web-servicesample-web-serviceservice

sample-web-servicesample-web-servicerpc-service Asample-web-servicesample-web-servicerpc-service B

Gateway

And Where Are

The Instances?

AA

A

B

B

B

?Host1 Host2

Page 60: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

sample-web-servicesample-web-serviceservice

sample-web-servicesample-web-servicerpc-service Asample-web-servicesample-web-servicerpc-service B

Gateway

Same Difference!

Mesos/

Marathon

serviceB.doSomethingElse(4, 2)

via http://rpc.int/serviceB/...serviceA.doSomething("a", 4)

via http://rpc.int/serviceA/...

Page 61: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Let’s Recap

Page 62: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2

apollo deploy B -n 2

Page 63: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 Marathon

apollo deploy B -n 2

● Please create service A

● I need two instances of this service available

at all times

● This is the docker image you need to deploy

Page 64: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 Marathon

apollo deploy B -n 2

A A

B B

Page 65: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 Marathon

apollo deploy B -n 2

A A

B B

Web Gateway

C D

wix.com/a-path

Page 66: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 Marathon

apollo deploy B -n 2

A A

B B

Web Gateway

C D

Path rules:

a-path ⇒ A

wix.com/a-path

Page 67: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 Marathon

apollo deploy B -n 2

A A

B B

RPC Gateway

Web Gateway

C D

E

b.foo()

Page 68: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 Marathon

apollo deploy B -n 2

A A

B B

RPC Gateway

Web Gateway

C D

E

http://rpc.int/B/foo

Page 69: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 Marathon

apollo deploy B -n 2

A A

B B

RPC Gateway

Web Gateway

C D

E

http://rpc.int/B/foo

Page 70: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 Marathon

apollo deploy B -n 2

A A

B B

RPC Gateway

Web Gateway

C D

E

Path rules:

a-path ⇒ A

Page 71: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 Marathon

apollo deploy B -n 2

A A

B B

RPC Gateway

Web Gateway

C D

E

Path rules:

a-path ⇒ A

Page 72: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

3. The Job

Page 73: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

We Split the Job

Page 74: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

1. System (Vagrant and Amazon)

2. Sample Web Service and RPC Service

3. Deployment via CLI

4. RPC Service Discovery

5. Web Service Discovery

Splitting the Work

Page 75: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

1. System (Vagrant and Amazon)

2. Sample Web Service and RPC Service

3. Deployment via CLI

4. RPC Service Discovery

5. Web Service Discovery

Page 76: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

System

(Vagrant and Amazon)

Page 77: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Ansible

Scripts

VirtualBox

Vagrant VM

Mesos

Marathon

Zookeeper

...

Host1

Mesos Master

Marathon

Host2

Zookeeper

Host3

Mesos Slave

Host4

Mesos Slave

Page 78: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

1. System (Vagrant and Amazon)

2. Sample Web Service and RPC Service

3. Deployment via CLI

4. RPC Service Discovery

5. Web Service Discovery

Page 79: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Example RPC Call

val helloServiceRpcClient = rpcClientFactory

.rpcProxyFactory.builderFor(classOf[HelloService])

.withStaticURL(new Url(s"http://${sys.env("RPC_INT")}")

.withPart("rpc-service")

.build()

helloServiceRpcClient.sayHello()

POST http://rpc.int/rpc-service/sayHello

Page 80: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

1. System (Vagrant and Amazon)

2. Sample Web Service and RPC Service

3. Deployment via CLI

4. RPC Service Discovery

5. Web Service Discovery

Splitting the Work

Page 81: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Remember?

$ npm install -g apollo

$ apollo artifact-deploy web-service:1.5.0 -n 20

$ curl web-service.demo-domain.com/....

$ apollo artifact-deploy web-service:1.6.0 -n 30

Page 82: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Deploying Instances To Marathon

const appId =

`/production/backend/${serviceName}`;

const appDeployResponse =marathon.client('PUT',

`/apps${appId}`, appConfig);

const appConfig = {id: appId,container: {

type: 'DOCKER',docker: {

image: `${serviceName)}:${version}`,}

},env: {RPC_INT: 'localhost:9090'},labels: {

microService: true,serviceName: serviceName

},healthChecks: [{

"path": '/health/is_alive'}]"cpus": 0.2,"mem": 200,"instances": parseInt(numberOfInstances)

};

Page 83: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon...

● Sees how many instances needs to be deployed

● Uses Mesos to deploy the correct number of them on the

hosts using Docker

● Waits for them to be alive using the health check

● The configuration is not a one-off

○ Marathon will always strive for it

○ If something dies (a host or an instance),

Marathon will regenerate

Page 84: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon...

● Sees how many instances needs to be deployed

● Uses Mesos to deploy the correct number of them on the

hosts using Docker

● Waits for them to be alive using the health check

● The configuration is not a one-off

○ Marathon will always strive for it

○ If something dies (a host or an instance),

Marathon will regenerate

Page 85: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon...

● Sees how many instances needs to be deployed

● Uses Mesos to deploy the correct number of them on the

hosts using Docker

● Waits for them to be alive using the health check

● The configuration is not a one-off

○ Marathon will always strive for it

○ If something dies (a host or an instance),

Marathon will regenerate

Page 86: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon...

● Sees how many instances needs to be deployed

● Uses Mesos to deploy the correct number of them on the

hosts using Docker

● Waits for them to be alive using the health check

● The configuration is not a one-off

○ Marathon will always strive for it

○ If something dies (a host or an instance),

Marathon will regenerate

Page 87: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

What About Upgrading?

$ npm install -g apollo

$ apollo artifact-deploy web-service:1.5.0 -n 20

$ curl web-service.demo-domain.com/....

$ apollo artifact-deploy web-service:1.6.0 -n 30

Page 88: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Upgrading Instances

const appId =

`/production/backend/${serviceName}`;

const appDeployResponse =marathon.client('PUT',

`/apps${appId}`, appConfig);

const appConfig = {id: appId,container: {

type: 'DOCKER',docker: {

image: `${serviceName)}:${version}`,}

},env: {RPC_INT: 'localhost:9090'},labels: {

microService: true,serviceName: serviceName

},healthChecks: [{

"path": '/health/is_alive'}]"cpus": 0.2,"mem": 200,"instances": parseInt(numberOfInstances)

};

Page 89: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon...

● Notices the configuration changed

● Strives for it to be true

● Uses Blue/Green Deployment to ensure constant uptime

Page 90: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon...

● Notices the configuration changed

● Strives for it to be true

● Uses Blue/Green Deployment to ensure constant uptime

Page 91: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon...

● Notices the configuration changed

● Strives for it to be true

● Uses Blue/Green Deployment to ensure constant uptime

Page 92: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

1. System (Vagrant and Amazon)

2. Sample Web Service and RPC Service

3. Deployment via CLI

4. RPC Service Discovery

5. Web Service Discovery

The First Three Tasks

Page 93: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

1. System (Vagrant and Amazon)

2. Sample Web Service and RPC Service

3. Deployment via CLI

4. RPC Service Discovery

5. Web Service Discovery

The First Three Tasks

Page 94: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

1. System (Vagrant and Amazon)

2. Sample Web Service and RPC Service

3. Deployment via CLI

4. RPC Service Discovery

5. Web Service Discovery

And What About The Rest?

Page 95: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

4. The Change of Plan

Page 96: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

3rd Party Service

Discovery!

Page 97: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

So What Else?

Page 98: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Staging!

Page 99: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Production is just

another environment

Page 100: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Environments

C

D E

E

E

C

B

B

B

E

C

C

C A

A

D

C

C

A

A

A

E

C

B

A

A

E

ED

D

C

BB

B

E

E

A

E

D C

C

B

B

B

B

C

A

D

B

DB

C

C

A

A A

D

E

D BC

C C

A A

E

E

D D

Page 101: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

How does this look inside the CLI?

$ npm install -g apollo

$ apollo artifact-deploy web-service:1.5.0

-e stage1 -n 20

$ apollo artifact-deploy web-service:1.6.0 -n 1

--testbed

$ apollo artifact-deploy web-service:1.6.0 -n 30

Page 102: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

And from the browser?

sample-web-servicesample-web-serviceweb-service

sample-web-servicesample-web-servicerpc-servicemysql1

stage1.wix.com/w/...

Page 103: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Web Service Discovery

sample-web-servicesample-web-serviceWeb-service A

(stage1) sample-web-servicesample-web-serviceWeb-service A

(production)

Proxy/Load

Balancer

stage1.wix.com/w/...

wix.com/w/...rules

Page 104: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

And RPC Services?

sample-web-servicesample-web-serviceweb-service

sample-web-servicesample-web-servicerpc-service Amysql1

serviceA.doSomething("a", 4)

Page 105: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

RPC Service Discovery sample-web-servicesample-web-serviceservice

sample-web-servicesample-web-servicerpc-service Asample-web-servicesample-web-servicerpc-service A

Proxy/Load

Balancer

serviceA.doSomething("a", 4)

via http://rpc.int/serviceA/...

serviceA.doSomething("a", 4)

via http://stage1.rpc.int/serviceA/...

Page 106: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Example RPC Call

val helloServiceRpcClient = rpcClientFactory

.rpcProxyFactory.builderFor(classOf[HelloService])

.withStaticURL(

new Url(s"http://${sys.env("RPC_INT")}")

.withPart("rpc-service")

.build()

helloServiceRpcClient.sayHello()

Page 107: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

And 3rd Party

Services?

sample-web-servicesample-web-serviceweb-service

sample-web-servicesample-web-servicerpc-servicemysql1

Select * from ...

Page 108: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

5. It All Comes Together

Page 109: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Same Difference

Page 110: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

nginx.conf

nginx

manager

Marathon

Page 111: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

nginx.conf

nginx

manager

Marathon

Page 112: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Remember?

const appId =

`/production/backend/${serviceName}`;

const appDeployResponse =marathon.client('PUT',

`/apps${appId}`, appConfig);

const appConfig = {id: appId,container: {

type: 'DOCKER',docker: {

image: ${serviceName)}:${version}`,}

},env: {RPC_INT: ‘localhost:9090’, ...},labels: {

microService: true,serviceName: serviceName

},healthChecks: [{

"path": '/health/is_alive'}]"cpus": 0.2,"mem": 200,"instances": parseInt(numberOfInstances)

};

Page 113: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

nginx.conf

nginx

manager

Marathon

Page 114: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

nginx.conf

nginx

manager

Marathon

Page 115: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

nginx.conf

nginx

manager

Marathon

Page 116: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Language?

Page 117: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Bash is easier

Page 118: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Generating nginx.conf from information in Marathon

request_url="http://$marathon_host/v2/apps?embed=app.tasks"

json=$(curl --fail --silent $request_url)

environments=$(echo $json | \

jq -r '[.apps[] | .labels.environment] | unique)

for environment in $environments; doexport environmentapps=$(echo $json | jq -r '.apps[] | \

select(.labels.environment == env.environment)')app_ids=$(echo $apps | jq -r '.id' | \

sed 's/-testbed//g' | sort | uniq)

for app_id in $app_ids; do....

donedone

app=$(echo $apps | jq -r 'select(.id == env.app_id), select(.id == env.app_id + "-testbed")')

artifactId=$(echo $app | jq -r '.labels.artifactId' | uniq) servers=$(echo $app | jq -r '.tasks[] |select(.healthCheckResults[0].alive == true) | .host + ":" + (.ports[0] | tostring)')

# Generate the part of the nginx.conf for each server where this app is in

Page 119: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

1. System (Vagrant and Amazon)

2. Sample Web Service and RPC Service

3. Deployment via CLI

4. RPC Service Discovery

5. Web Service Discovery

The First Three Tasks

Page 120: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Let’s Recap

Page 121: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 -e s

apollo deploy B -n 2 -e s

Page 122: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 -e s Marathon

apollo deploy B -n 2 -e s

● # of instances

● RPC_INT pointing to s.rpc.int.

● Env variables for each 3rd party service

● Docker image to use

POST json

configuration

Page 123: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 Marathon

apollo deploy B -n 2

A A

B B

Page 124: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon

A A

B B

RPC Gateway

Web Gateway Path rules:

a-path ⇒ A

nginx.conf

nginx.conf

Page 125: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon

A A

B B

Web Gateway

Nginx

C D

s.wix.com/a-pathnginx.conf

Page 126: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon

A A

B B

C D

s.wix.com/a-pathnginx.conf

Web Gateway

Nginx

Page 127: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon

A A

B B

RPC Gateway

Nginx

C D

E

b.foo()

Web Gateway

Nginx

nginx.conf

Page 128: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon

A A

B B

Web Gateway

C D

E

RPC Gateway

Nginxnginx.conf

http://s.rpc.int/B/foo

Page 129: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Marathon

A A

B B

Web Gateway

C D

E

RPC Gateway

Nginxnginx.conf

Page 130: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

apollo deploy A -n 2 Marathon

apollo deploy B -n 2

A A

B B

RPC Gateway

Web Gateway

C D

E

Path rules:

a-path ⇒ A

nginx.conf

nginx.conf

Page 131: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

6. Epilog

Page 132: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

We won!

Page 133: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

End Result

● Micro-services Infra, supporting…

● Red-green deployment

● 3rd Party Services

● Staging environments

● Built in 6 days

Page 134: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

And on the 7th Day?

Page 135: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

We Rested

Page 136: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

We’re Jewish, Aren’t We?

Page 137: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

7. Box Office Results

Page 138: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

I’ve Got Some Good News and Some Bad News

● Bad news: it never got released at Wix

● Good news: I got it working at my new company: Applitools

● And it took me 3 days!○ Including tests

● How?

Page 139: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

1. System (Vagrant and Amazon)

2. Sample Web Service and RPC Service

3. Deployment via CLI

4. RPC Service Discovery

5. Web Service Discovery

Remember the Work?

Page 140: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

1. System (Vagrant and Amazon)

2. Sample Web Service and RPC Service

3. Deployment via CLI

4. RPC Service Discovery

5. Web Service Discovery

Remember the Work?

Page 141: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

How? Kubernetes!

Page 142: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

● Instead of Vagrant, minikube

● In Google Cloud and Azure - Managed

Kubernetes

● Amazon coming soon?

System (Vagrant and Amazon)

Page 143: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

● I don’t need a sample - I already wrote my

own!

Sample Web Service and RPC Service

Page 144: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

● Instead of:

○ apollo web-service:1.2.0 -n 2 -e stage

● I do:

○ kdeploy web-service:1.2.0 -n 2 -e stage

Deployment via CLI

Page 145: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

● RPC Service Discovery

○ Built into Kubernetes

● Web Service Discovery

○ Built into Kubernetes

Service Discovery

Page 146: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

1. System (Vagrant and Amazon)

2. Sample Web Service and RPC Service

3. Deployment via CLI

4. RPC Service Discovery

5. Web Service Discovery

So Kubernetes Saves a Lot of Time!

Page 147: How To Build A Micro-Services Infrastructure in 7 Days€¦ · Micro-Services Infrastructure in 7 Days Gil Tayar, November 2017 @giltayar. Wix Internal Hackathon - December 2015

Thank You

@giltayar