Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mesos + Consul = Developer Happiness (JUG)

Mesos + Consul = Developer Happiness (JUG)

Talk given to the Chicago Java User Group on March 15, 2016

Brian Hicks

March 15, 2016
Tweet

More Decks by Brian Hicks

Other Decks in Programming

Transcript

  1. Hello I'm Brian Hicks I do computer stuff [email protected] //

    @brianhicks 2 — Chicago JUG, March 15 2016
  2. Service discovery and configuration made easy. Distributed, highly available, and

    datacenter- aware. — consul.io 5 — Chicago JUG, March 15 2016
  3. Query a Service Over HTTP $ curl localhost:8500/v1/catalog/service/marathon [{ "Address":

    "10.0.113.214", "Node": "batman-control-01", "ServiceAddress": "", "ServiceID": "marathon", "ServiceName": "marathon", "ServicePort": 18080, "ServiceTags": ["marathon"] }] 7 — Chicago JUG, March 15 2016
  4. SRV Records $ dig +short marathon.service.consul 10.0.113.214 10.0.220.54 10.0.131.25 $

    dig +short marathon.service.consul SRV 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 9 — Chicago JUG, March 15 2016
  5. Service Definition { "name": "marathon", "tags": [ "marathon", "dc-ord" ],

    "port": 18080, "check": { "script": "curl http://127.0.0.1:18080/ping", "interval": "10s" } } 10 — Chicago JUG, March 15 2016
  6. Getting and Setting $ curl -X PUT -d world http://localhost:8500/v1/kv/hello

    true $ curl -X GET http://localhost:8500/v1/kv/hello [{ "CreateIndex": 223, "Flags": 0, "Key": "hello", "LockIndex": 0, "ModifyIndex": 223, "Value": "d29ybGQ=" }] 14 — Chicago JUG, March 15 2016
  7. Check and Set $ curl -X PUT -d chicago http://localhost:8500/v1/kv/hello?cas=223

    true $ curl -X PUT -d world http://localhost:8500/v1/kv/hello?cas=1 false 15 — Chicago JUG, March 15 2016
  8. Watches HTTP/1.1 200 OK Content-Type: application/json X-Consul-Index: 226 X-Consul-Knownleader: true

    X-Consul-Lastcontact: 0 Date: Tue, 15 Mar 2016 16:24:45 GMT Content-Length: 96 $ curl http://localhost:8500/v1/kv/hello?index=226 16 — Chicago JUG, March 15 2016
  9. 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 17 — Chicago JUG, March 15 2016
  10. 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}} 18 — Chicago JUG, March 15 2016
  11. Mantl’s ethos is to focus a community around an end

    to end solution, not around an individual component; designed to solve business and team challenges, one glue, improved by the community, tested everywhere. — mantl.io 20 — Chicago JUG, March 15 2016
  12. Colophon → White Rabbit by Houser Wolf Licensed CC BY-ND

    2.0 → Eggs. Plenty of them. by Alex Barth Licensed CC BY 2.0 → I got that feeling by Josep Ma. Rosell Licensed CC BY 2.0 22 — Chicago JUG, March 15 2016