Slide 1

Slide 1 text

Mesos+Consul= Developer Happiness

Slide 2

Slide 2 text

Brian Hicks @brianhicks

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

OXY HAPROXY client SERVER

Slide 6

Slide 6 text

marathon-consul haproxy-Consul

Slide 7

Slide 7 text

Service discovery and configuration made easy. Distributed, highly available, and datacenter-aware. consul.io

Slide 8

Slide 8 text

(and DNS) SERVICES

Slide 9

Slide 9 text

[{ "Address": "10.0.113.214", "Node": "batman-control-01", "ServiceAddress": "", "ServiceID": "marathon", "ServiceName": "marathon", "ServicePort": 18080, "ServiceTags": ["marathon"] }] curl localhost:8500/v1/catalog/service/marathon Query a Service over HTTP

Slide 10

Slide 10 text

216.58.216.206 dig +short www.google.com DNS

Slide 11

Slide 11 text

10.0.113.214 10.0.220.54 10.0.131.25 1 1 18080 batman-control-02.node.batman.consul. 1 1 18080 batman-control-03.node.batman.consul. 1 1 18080 batman-control-01.node.batman.consul. dig +short marathon.service.consul dig +short marathon.service.consul SRV SRV Records

Slide 12

Slide 12 text

{ "name": "marathon", "tags": [ "marathon", "dc-denver" ], "port": 18080, "check": { "script": "curl http://127.0.0.1:18080/ping", "interval": "10s" } } Service Definition

Slide 13

Slide 13 text

{ "name": "marathon", "tags": [ "marathon", "dc-denver" ], "port": 18080, "check": { "script": "curl http://127.0.0.1:18080/ping", "interval": "10s" } } Service Definition

Slide 14

Slide 14 text

{ "name": "marathon", "tags": [ "marathon", "dc-denver" ], "port": 18080, "check": { "script": "curl http://127.0.0.1:18080/ping", "interval": "10s" } } Service Definition

Slide 15

Slide 15 text

{ "name": "marathon", "tags": [ "marathon", "dc-denver" ], "port": 18080, "check": { "script": "curl http://127.0.0.1:18080/ping", "interval": "10s" } } Service Definition

Slide 16

Slide 16 text

curl http://localhost:8500/v1/agent/service/register \ -d @marathon.json REgistering the Service

Slide 17

Slide 17 text

& Q A

Slide 18

Slide 18 text

and Values) (and Values) Keys

Slide 19

Slide 19 text

true [{ "CreateIndex": 223, "Flags": 0, "Key": "hello", "LockIndex": 0, "ModifyIndex": 223, "Value": "d29ybGQ=" }] curl -X PUT -d world http://localhost:8500/v1/kv/hello curl -X GET http://localhost:8500/v1/kv/hello Setting and Retrieving

Slide 20

Slide 20 text

true false curl -X PUT -d denver http://localhost:8500/v1/kv/hello?cas=223 curl -X PUT -d world http://localhost:8500/v1/kv/hello?cas=1 Check and Set

Slide 21

Slide 21 text

WAtches HTTP/1.1 200 OK Content-Type: application/json X-Consul-Index: 226 X-Consul-Knownleader: true X-Consul-Lastcontact: 0 Date: Mon, 29 Jun 2015 16:25:45 GMT Content-Length: 96 curl http://localhost:8500/v1/kv/hello?index=226

Slide 22

Slide 22 text

consul-template This project provides a convenient way to populate values from Consul into the filesystem using the consul-template daemon. github.com/hashicorp/consul-template

Slide 23

Slide 23 text

Haproxy Template global maxconn {{or (key "service/haproxy/maxconn") 256}} debug defaults mode http timeout connect {{or (key "service/haproxy/timeouts/connect") "5000ms"}} timeout client {{or (key "service/haproxy/timeouts/client") "50000ms"}} timeout server {{or (key "service/haproxy/timeouts/server") "50000ms"}} {{range services}} frontend {{.Name}} bind *:{{key (printf "ports/%s" .Name)}} {{range service .Name}} server {{.Node}} {{.Address}}:{{.Port}}{{end}} {{end}}

Slide 24

Slide 24 text

Haproxy Template global maxconn {{or (key "service/haproxy/maxconn") 256}} debug defaults mode http timeout connect {{or (key "service/haproxy/timeouts/connect") "5000ms"}} timeout client {{or (key "service/haproxy/timeouts/client") "50000ms"}} timeout server {{or (key "service/haproxy/timeouts/server") "50000ms"}} {{range services}} frontend {{.Name}} bind *:{{key (printf "ports/%s" .Name)}} {{range service .Name}} server {{.Node}} {{.Address}}:{{.Port}}{{end}} {{end}}

Slide 25

Slide 25 text

Haproxy Template global maxconn {{or (key "service/haproxy/maxconn") 256}} debug defaults mode http timeout connect {{or (key "service/haproxy/timeouts/connect") "5000ms"}} timeout client {{or (key "service/haproxy/timeouts/client") "50000ms"}} timeout server {{or (key "service/haproxy/timeouts/server") "50000ms"}} {{range services}} frontend {{.Name}} bind *:{{key (printf "ports/%s" .Name)}} {{range service .Name}} server {{.Node}} {{.Address}}:{{.Port}}{{end}} {{end}}

Slide 26

Slide 26 text

Haproxy Template global maxconn {{or (key "service/haproxy/maxconn") 256}} debug defaults mode http timeout connect {{or (key "service/haproxy/timeouts/connect") "5000ms"}} timeout client {{or (key "service/haproxy/timeouts/client") "50000ms"}} timeout server {{or (key "service/haproxy/timeouts/server") "50000ms"}} {{range services}} frontend {{.Name}} bind *:{{key (printf "ports/%s" .Name)}} {{range service .Name}} server {{.Node}} {{.Address}}:{{.Port}}{{end}} {{end}}

Slide 27

Slide 27 text

global maxconn {{or (key "service/haproxy/maxconn") 256}} debug defaults mode http timeout connect {{or (key "service/haproxy/timeouts/connect") "5000ms"}} timeout client {{or (key "service/haproxy/timeouts/client") "50000ms"}} timeout server {{or (key "service/haproxy/timeouts/server") "50000ms"}} {{range services}} frontend {{.Name}} bind *:{{key (printf "ports/%s" .Name)}} {{range service .Name}} server {{.Node}} {{.Address}}:{{.Port}}{{end}} {{end}} Haproxy Template

Slide 28

Slide 28 text

global maxconn {{or (key "service/haproxy/maxconn") 256}} debug defaults mode http timeout connect {{or (key "service/haproxy/timeouts/connect") "5000ms"}} timeout client {{or (key "service/haproxy/timeouts/client") "50000ms"}} timeout server {{or (key "service/haproxy/timeouts/server") "50000ms"}} {{range services}} frontend {{.Name}} bind *:{{key (printf "ports/%s" .Name)}} {{range service .Name}} server {{.Node}} {{.Address}}:{{.Port}}{{end}} {{end}} Haproxy Template

Slide 29

Slide 29 text

& Q A

Slide 30

Slide 30 text

(yes, we're getting a new name) microservices-infrastructure Github.com/CiscoCloud/microservices-infrastructure Microservices infrastructure is a modern platform for rapidly deploying globally distributed services

Slide 31

Slide 31 text

Components

Slide 32

Slide 32 text

@brianhicks // brian@aster.is @ASteris_LLC // info@aster.is

Slide 33

Slide 33 text

Colophon Eggs. Plenty of them. Alex Barth, Licensed CC BY 2.0 https://www.flickr.com/photos/a-barth/4985481182 Dictionary Greeblie, Licensed CC BY 2.0 https://www.flickr.com/photos/greeblie/3338710223