Docker tlv

16
Production with Consul & Docker And a few more friends...

description

Ariel Moskovich Presentation at Docker Tlv

Transcript of Docker tlv

Page 1: Docker tlv

Production with Consul & DockerAnd a few more friends...

Page 2: Docker tlv

Challenges

● High Traffic: 1.7 Billion requests per day

● Maintaining Lots of data● Data integrity● Fast growing user base● Need to deploy new features

fast● Getting out of the garage: be

scalable & redundant● Bottom line: We need tools

that can help us grow fast!

Page 3: Docker tlv

What we will cover

How It's all connected

Page 4: Docker tlv

Our Dockerfiles Principles● Create a base image and

template for each application type: Clojure, Python...

● Then auto generate from project name

● Infrastructure Dockerfiles examples are all over, just download and modify.

● Keep it as minimized as possible.

● But not at all costs.

Page 5: Docker tlv

Docker private registry● Build & push only once, pull many

● Manage tags

● Centralized repository

● Simple usage via Docker cmd / API

● Supported by Mesos / Marathon

● Use Local / S3 as storage

● Enable multiple environments: test, prod

You can also USE

External payed hubs with web user interface and Github / Bitbucket integration.

Page 6: Docker tlv

I need x application jarI need x application jarI need x application jar

let me grab it from Bitbucket and build it for you

You know that's a legacy code, right? ;-)

Done, just take it from the target directory

Now, Docker Daemon, Please build, tag and push the image to the repository

Page 7: Docker tlv

Consul

“Service Discovery and configuration”

Page 8: Docker tlv

Principles Agent: Long running Daemon, can be client or server (same executable)

Client: agent that forwards all RPC to server

Server: responsible for Raft quorum, cluster state, RPC queries

Running as client:consul agent -dc=$DC -join $CONSULMASTER -pid-file=$PIDFILE -data-dir $DATADIR -config-dir $CONFDIR -bind $IP

Running as server:consul agent -server -bootstrap -pid-file=$PIDFILE -dc=$DC -ui-dir $UIDIR -data-dir $DATADIR -config-dir $CONFDIR -bind $IP

Page 9: Docker tlv

Forwarding queries to consul DNS

ariel@ariels:~/present$ host neo4j.eu1.appsflyer.comneo4j.eu1.appsflyer.com is an alias for neo4j.service.consul.neo4j.service.consul has address 10.12.6.71neo4j.service.consul has address 10.12.5.25

zone "service.consul" IN { type forward; forward only; forwarders { 10.12.4.88 port 8600; 10.12.6.88 port 8600; 10.12.8.88 port 8600;};};

Page 10: Docker tlv
Page 11: Docker tlv

Apache Mesos & Mesosphere Marathon

Mesos: Abstracts compute resources away from machines, enable to build clusters upon frameworks

Marathon: Framework for long-running applications (like docker), provide a rest API

c

Page 12: Docker tlv

Provisioning & Deploy Flow with Mesos – Stage 1Provisioning & Deploy Flow with Mesos – Stage 1Provisioning & Deploy Flow with Mesos – Stage 1

I need x docker instances in AWS I can do that

Now we have Mesos cluster of X instances, each with Chef, Docker Daemon, Mesos slave and Consul agent which serves as discovery source

Page 13: Docker tlv

Provisioning & Deploy Flow with Mesos – Stage 2Please deploy an application to the cluster from the registry

That's fine by me

Provisioning & Deploy Flow with Mesos – Stage 2Please deploy an application to the cluster from the registry

That's fine by me Deploy, deploy, deploy

Also, I will need you to provide me the servers and ports that serve this application, I would like to update my buddy consul

Sure

Here's what Marathon knows, go gossip about it

Page 14: Docker tlv

Up and running

Page 15: Docker tlv

Connecting to Dockers

● Using ssh?● Nsenter?● 1.3 exec?● Other methods?● Avoid connecting?