SlideShare uma empresa Scribd logo
1 de 42
Baixar para ler offline
Docker in production:
service discovery with Consul
Giovanni Toraldo - Lead developer @ ClouDesire.com
Road to OpsCon 2015 - Milano
About me
Open Source Enthusiast
with SuperCow Powers
PHP/Java/whatever
developer
writer of the OpenNebula
book
Lead developer at
ClouDesire.com
2
What is ClouDesire?
Application Marketplace to help software vendors to sell and provision
applications
● Web Applications:
○ provision VM
○ on multiple cloud providers
○ deploy/upgrade application and dependencies
○ application logging
○ resource monitoring
● With multi-tenant applications/SaaS:
○ expose REST hooks and API for billing lifecycle
● manage subscriptions, billing, pay-per-use, invoicing, payments.
3
ClouDesire platform components
Multitude of components of different stacks:
● Multiple Java/Tomcat REST backends
● Minor Ruby, Node REST backends
● AngularJS frontend
● PostgreSQL
● MongoDB
● Rsyslog + nxlog + Logstash + ElasticSearch
● ActiveMQ
4
Before Docker: platform deployments
Problems faced:
● Different stacks, different ways to handle deployments
○ Hundreds LOC of Chef recipes
○ Inevitable complexity
○ No trustworthy procedure to rollback
● Hard to switch between deps versions
○ Only the one available on official Ubuntu repositories
● Heterogeneous dev environments (vagrant?)
○ Ubuntu, Arch Linux, Mac
5
Before Docker: application packaging
How to grab applications from ClouDesire vendors?
● GIT repository (heroku)?
○ Not really its use-case, require understanding
○ Customization may require branching
● DEB/RPM packages?
○ Too much complexity
● Custom approach?
6
Before Docker: hand-made zip package
Requirements:
● Everyone should be able to do it
● even Windows users
● in a short time
Our solution, not elegant but effective:
● A ZIP archive with:
○ a folder for sources/artifacts
○ a folder for sql scripts
○ predefined environment variables to use
7
Before Docker: custom zip package
Application source code itself is not sufficient:
● Custom dependencies (e.g.: Alfresco)
● Custom dependencies versions
● Configuration for external resources
● Shameful hacks?
8
“Maybe Docker can help?”
9
10
Docker: container lifecycle
● Pulls an image from a registry
● Creates a new container
○ Allocates a r/w filesystem
○ Allocates a network interface (on a bridge)
○ Sets up network (IP address, dns..)
● Launch a process into the container
● Captures and provides application output
● Container terminates when the process exits
11
Docker: why?
Enables software developers to:
● package an application
● with all dependencies
● runs it everywhere unchanged
● re-use images via composition
12
Docker: why?
Enables system administrators to:
● standardize application deployment
● ease scale-up & scale-down
● process separation/isolation
13
Docker adoption: platform deployment
● Different stacks, different ways to handle deployments
○ Docker Image for each component
○ Dozens LOC of Chef recipe for deploy / upgrades
○ Deployment complexity hidden into Dockerfile
○ Rollback is equal to upgrade
● Hard to switch between deps versions
○ Docker for external dependencies
○ Use them without thinking how to deploy / upgrade
● Heterogeneous dev environments (vagrant?)
○ Docker-compose for each module
14
Docker adoption: application packaging
How to grab applications from ClouDesire vendors?
● Custom ZIP package
○ Build a docker image for the application
○ Push your image to our registry.
Advantages:
● Easy to follow documentation
● Fast Try-Fail-Retry cycle while building
● Works-for-me is works everywhere
● Re-use community images for dependencies
15
Docker adoption: application packaging
● Custom dependencies (e.g.: Alfresco)
○ (Re-)Use multiple containers
● Custom dependencies versions
○ Multiple versions easily available
● Configuration for external resources
○ Environment variables
● Shameful hacks?
○ Hidden in the Dockerfile
16
Docker: it looks like something is missing
Moving to containers introduced a new layer of complexity:
● communication between containers:
○ Same host (with docker linking feature)
■ restart everything after redeploy
○ Multiple hosts
■ not a docker problem
● Scaling/hot-deploy ready
○ but load balancers are statically configured
17
“It would be a mess”
18
Service Discovery to the rescue
19
Before Consul (and service discovery)
● Hardcoded IP:port configuration
○ Hand-made copy-paste
○ Not fault-tolerant
○ No autoscaling
○ No self-healing
● Configuration management (e.g. Puppet, Chef)
○ Slow to react to events
○ Ordered service starting
Above not really feasible when running dozens of containers
20
Consul on github
21
When service discovery is needed
● Monolithic architecture? No problem.
● Distributed architecture?
○ Is there at least one foo instance running?
○ At which address?
○ On which port?
FOO
BAR
Service
Registry
Client
22
Consul features
● Agent based
● Query interfaces
○ HTTP JSON API
○ DNS
● Health-Checking
○ No one want borked services
● Key-Value Store
○ Shared dynamic configuration
○ Feature toggle
○ Leader election
23
docker run --rm --name consul -p 8500:8500 -p 8600:8600
voxxit/consul agent -server -bootstrap-expect 1 -data-dir
/tmp/consul --client 0.0.0.0 -node helloworld
● consensus protocol
○ https://github.com/hashicorp/raft
● lightweight gossip protocol
○ https://github.com/hashicorp/serf
Single node bootstrap
24
25
Second node bootstrap
$ docker run --rm --name consul2 voxxit/consul agent -server -
join 172.17.0.2 -data-dir /tmp/consul --client 0.0.0.0 -node
helloworld2
26
Two nodes cluster alive
● helloworld2 joined cluster
● replication take place
● helloworld2 marked as healthy
27
Node querying - DNS interface
$ dig helloworld.node.consul @localhost -p 8600 +tcp
helloworld.node.consul. 0 IN A 172.17.0.2
$ dig helloworld2.node.consul @localhost -p 8600 +tcp
helloworld2.node.consul. 0 IN A 172.17.0.3
28
Node querying - HTTP interface
$ curl localhost:8500/v1/catalog/nodes
[{"Node":"helloworld2","Address":"172.17.0.3"},{"Node":"
helloworld","Address":"172.17.0.2"}]%
29
Register a new service
$ curl -X POST -d @service.json localhost:
8500/v1/agent/service/register
{
"ID": "redis1",
"Name": "redis",
"Tags": [
"master",
"v1"
],
"Address": "172.16.0.2",
"Port": 8000
}
30
Retrieve service details
$ dig redis.service.consul @localhost -p 8600 +tcp
redis.service.consul. 0 IN A 172.16.0.2
$ curl localhost:8500/v1/agent/services
{"consul":{"ID":"consul","Service":"consul","Tags":[],"
Address":"","Port":8300},"redis1":{"ID":"redis1","Service":"redis","
Tags":["master","v1"],"Address":"172.16.0.2","Port":8000}}%
31
Populate services from Docker
https://github.com/gliderlabs/registrator
● Discover containers using docker API
● Skip containers without published ports
● Register service when container goes up
○ Service name is the image name
○ Tags via environment variables
● Unregister service when container goes down
32
Running registrator
$ docker run -d 
--name=registrator 
--net=host 
--volume=/var/run/docker.sock:/tmp/docker.sock 
gliderlabs/registrator:latest 
consul://localhost:8500
Note: exposing docker.sock in a container is a security
concern.
33
Enrich service metadata
● Registrator auto discovery can be enriched via
environment variables
$ docker run --name redis-0
-p 10000:6379 
-e "SERVICE_NAME=db" 
-e "SERVICE_TAGS=master" 
-e "SERVICE_REGION=it" redis
34
Retrieve registrator services
$ dig consul.service.consul @localhost -p 8600 +tcp
consul.service.consul. 0 IN A 172.17.0.3
consul.service.consul. 0 IN A 172.17.0.2
$ curl localhost:8500/v1/agent/services
{"consul":{"ID":"consul","Service":"consul","Tags":[],"Address":"","Port":8300},"
viserion:consul:8500":{"ID":"viserion:consul:8500","Service":"consul-8500","Tags":
null,"Address":"127.0.1.1","Port":8500},"viserion:consul:8600":{"ID":"viserion:consul:
8600","Service":"consul-8600","Tags":null,"Address":"127.0.1.1","Port":8600}}%
35
Automatic reverse proxy for web services
$ consul-template 
-consul 127.0.0.1:8500 
-template "/tmp/template.ctmpl:/var/www/nginx.conf:service
nginx restart" 
-retry 30s
upstream upstream-<%= @service_name %> {
least_conn;
{{range service "<%= @service_name %>"}}server {{.Address}}:
{{.Port}} max_fails=3 fail_timeout=60 weight=1;
{{else}}server 127.0.0.1:65535; # force a 502{{end}}
} 36
Example nginx.conf fragment
server {
listen 80 default_server;
location ~ ^/api/(.*)$ {
proxy_pass http://upstream-service-name/$1$is_args$args;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
37
Real-world architecture of everything
Container
A
Container
B
Registrator
Consul
agent
Consul
agent
Registrator
Backend Node A Backend Node B
Network
● Consul agent running on each node
● Registrator on each docker node
● Every node has 127.0.0.1 in /etc/resolv.conf
● Services discover dependencies via DNS
● Nginx endpoint generated by consul-template
Frontend Node(s)
Nginx
Consul
agent
Consul-
template 38
Consul: additional goodies
● Key-Value store for configurations
● DNS forwarding
● DNS caching
● WAN replication (Multi-DC)
● Atlas bootstrapping (https://atlas.hashicorp.
com/)
● Web UI (http://demo.consul.io/ui/)
39
40
Homework for the coming months
● Take a look at:
○ Docker swarm (1.0 released on nov 2015)
○ Kubernetes (1.0 release on july 2015)
○ Apache Mesos (0.25 release on oct 2015)
41
Thanks!
We are hiring!
https://cloudesire.cloud/jobs/
42

Mais conteúdo relacionado

Mais procurados

Docker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker SwarmDocker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker SwarmDocker, Inc.
 
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22Ajeet Singh Raina
 
Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm UpdatedDocker, Inc.
 
Consul: Microservice Enabling Microservices and Reactive Programming
Consul: Microservice Enabling Microservices and Reactive ProgrammingConsul: Microservice Enabling Microservices and Reactive Programming
Consul: Microservice Enabling Microservices and Reactive ProgrammingRick Hightower
 
Kubernetes intro public - kubernetes meetup 4-21-2015
Kubernetes intro   public - kubernetes meetup 4-21-2015Kubernetes intro   public - kubernetes meetup 4-21-2015
Kubernetes intro public - kubernetes meetup 4-21-2015Rohit Jnagal
 
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) ItalyClustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) ItalyGiovanni Toraldo
 
Docker Swarm Introduction
Docker Swarm IntroductionDocker Swarm Introduction
Docker Swarm Introductionrajdeep
 
Consul First Steps
Consul First StepsConsul First Steps
Consul First StepsMarc Cluet
 
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...Docker, Inc.
 
Docker Swarm Meetup (15min lightning)
Docker Swarm Meetup (15min lightning)Docker Swarm Meetup (15min lightning)
Docker Swarm Meetup (15min lightning)Mike Goelzer
 
Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker, Inc.
 
Docker swarm introduction
Docker swarm introductionDocker swarm introduction
Docker swarm introductionEvan Lin
 
Service discovery in mesos miguel, Angel Guillen
Service discovery in mesos miguel, Angel GuillenService discovery in mesos miguel, Angel Guillen
Service discovery in mesos miguel, Angel GuillenJ On The Beach
 
Introduction to docker swarm
Introduction to docker swarmIntroduction to docker swarm
Introduction to docker swarmWalid Ashraf
 
Deploying and Scaling a Rails Application with Docker and Friends
Deploying and Scaling a Rails Application with Docker and FriendsDeploying and Scaling a Rails Application with Docker and Friends
Deploying and Scaling a Rails Application with Docker and FriendsInvisiblelines
 
Fluentd and docker monitoring
Fluentd and docker monitoringFluentd and docker monitoring
Fluentd and docker monitoringVinay Krishna
 

Mais procurados (20)

Docker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker SwarmDocker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker Swarm
 
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22
 
Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm Updated
 
Consul: Microservice Enabling Microservices and Reactive Programming
Consul: Microservice Enabling Microservices and Reactive ProgrammingConsul: Microservice Enabling Microservices and Reactive Programming
Consul: Microservice Enabling Microservices and Reactive Programming
 
Swarm mode
Swarm modeSwarm mode
Swarm mode
 
Kubernetes intro public - kubernetes meetup 4-21-2015
Kubernetes intro   public - kubernetes meetup 4-21-2015Kubernetes intro   public - kubernetes meetup 4-21-2015
Kubernetes intro public - kubernetes meetup 4-21-2015
 
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) ItalyClustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
 
Docker Swarm Introduction
Docker Swarm IntroductionDocker Swarm Introduction
Docker Swarm Introduction
 
Consul First Steps
Consul First StepsConsul First Steps
Consul First Steps
 
What's New in Docker 1.12?
What's New in Docker 1.12?What's New in Docker 1.12?
What's New in Docker 1.12?
 
Docker 1.12 and swarm mode
Docker 1.12 and swarm modeDocker 1.12 and swarm mode
Docker 1.12 and swarm mode
 
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
 
Docker Swarm Meetup (15min lightning)
Docker Swarm Meetup (15min lightning)Docker Swarm Meetup (15min lightning)
Docker Swarm Meetup (15min lightning)
 
Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker Swarm 0.2.0
Docker Swarm 0.2.0
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Docker swarm introduction
Docker swarm introductionDocker swarm introduction
Docker swarm introduction
 
Service discovery in mesos miguel, Angel Guillen
Service discovery in mesos miguel, Angel GuillenService discovery in mesos miguel, Angel Guillen
Service discovery in mesos miguel, Angel Guillen
 
Introduction to docker swarm
Introduction to docker swarmIntroduction to docker swarm
Introduction to docker swarm
 
Deploying and Scaling a Rails Application with Docker and Friends
Deploying and Scaling a Rails Application with Docker and FriendsDeploying and Scaling a Rails Application with Docker and Friends
Deploying and Scaling a Rails Application with Docker and Friends
 
Fluentd and docker monitoring
Fluentd and docker monitoringFluentd and docker monitoring
Fluentd and docker monitoring
 

Semelhante a Docker in production service discovery with consul - road to opscon 2015

Swarm: Native Docker Clustering
Swarm: Native Docker ClusteringSwarm: Native Docker Clustering
Swarm: Native Docker ClusteringRoyee Tager
 
Future of Microservices - Jakub Hadvig
Future of Microservices - Jakub HadvigFuture of Microservices - Jakub Hadvig
Future of Microservices - Jakub HadvigWEBtlak
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tipsSamuel Chow
 
Docker Timisoara: Dockercon19 recap slides, 23 may 2019
Docker Timisoara: Dockercon19 recap slides, 23 may 2019Docker Timisoara: Dockercon19 recap slides, 23 may 2019
Docker Timisoara: Dockercon19 recap slides, 23 may 2019Radulescu Adina-Valentina
 
Developer workflow with docker
Developer workflow with dockerDeveloper workflow with docker
Developer workflow with dockerLalatendu Mohanty
 
Kubernetes - how to orchestrate containers
Kubernetes - how to orchestrate containersKubernetes - how to orchestrate containers
Kubernetes - how to orchestrate containersinovex GmbH
 
Who needs containers in a serverless world
Who needs containers in a serverless worldWho needs containers in a serverless world
Who needs containers in a serverless worldMatthias Luebken
 
OpenShift As A DevOps Platform
OpenShift As A DevOps PlatformOpenShift As A DevOps Platform
OpenShift As A DevOps PlatformLalatendu Mohanty
 
Getting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdf
Getting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdfGetting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdf
Getting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdfssuser348b1c
 
12 FACTOR APP WITH DOCKER
12 FACTOR APP WITH DOCKER12 FACTOR APP WITH DOCKER
12 FACTOR APP WITH DOCKERTREEPTIK
 
DevEx | there’s no place like k3s
DevEx | there’s no place like k3sDevEx | there’s no place like k3s
DevEx | there’s no place like k3sHaggai Philip Zagury
 
Making kubernetes simple for developers
Making kubernetes simple for developersMaking kubernetes simple for developers
Making kubernetes simple for developersSuraj Deshmukh
 
Docker up and Running For Web Developers
Docker up and Running For Web DevelopersDocker up and Running For Web Developers
Docker up and Running For Web DevelopersBADR
 
Docker Up and Running for Web Developers
Docker Up and Running for Web DevelopersDocker Up and Running for Web Developers
Docker Up and Running for Web DevelopersAmr Fawzy
 
Docker on docker leveraging kubernetes in docker ee
Docker on docker leveraging kubernetes in docker eeDocker on docker leveraging kubernetes in docker ee
Docker on docker leveraging kubernetes in docker eeDocker, Inc.
 
Docker Enterprise Workshop - Technical
Docker Enterprise Workshop - TechnicalDocker Enterprise Workshop - Technical
Docker Enterprise Workshop - TechnicalPatrick Chanezon
 
Introduction to Docker Container
Introduction to Docker ContainerIntroduction to Docker Container
Introduction to Docker ContainerSamsul Ma'arif
 

Semelhante a Docker in production service discovery with consul - road to opscon 2015 (20)

Swarm: Native Docker Clustering
Swarm: Native Docker ClusteringSwarm: Native Docker Clustering
Swarm: Native Docker Clustering
 
Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Ma...
Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Ma...Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Ma...
Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Ma...
 
Future of Microservices - Jakub Hadvig
Future of Microservices - Jakub HadvigFuture of Microservices - Jakub Hadvig
Future of Microservices - Jakub Hadvig
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tips
 
Docker Timisoara: Dockercon19 recap slides, 23 may 2019
Docker Timisoara: Dockercon19 recap slides, 23 may 2019Docker Timisoara: Dockercon19 recap slides, 23 may 2019
Docker Timisoara: Dockercon19 recap slides, 23 may 2019
 
Developer workflow with docker
Developer workflow with dockerDeveloper workflow with docker
Developer workflow with docker
 
Kubernetes - how to orchestrate containers
Kubernetes - how to orchestrate containersKubernetes - how to orchestrate containers
Kubernetes - how to orchestrate containers
 
Who needs containers in a serverless world
Who needs containers in a serverless worldWho needs containers in a serverless world
Who needs containers in a serverless world
 
OpenShift As A DevOps Platform
OpenShift As A DevOps PlatformOpenShift As A DevOps Platform
OpenShift As A DevOps Platform
 
Getting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdf
Getting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdfGetting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdf
Getting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdf
 
12 FACTOR APP WITH DOCKER
12 FACTOR APP WITH DOCKER12 FACTOR APP WITH DOCKER
12 FACTOR APP WITH DOCKER
 
DevEx | there’s no place like k3s
DevEx | there’s no place like k3sDevEx | there’s no place like k3s
DevEx | there’s no place like k3s
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Making kubernetes simple for developers
Making kubernetes simple for developersMaking kubernetes simple for developers
Making kubernetes simple for developers
 
Docker up and Running For Web Developers
Docker up and Running For Web DevelopersDocker up and Running For Web Developers
Docker up and Running For Web Developers
 
Docker Up and Running for Web Developers
Docker Up and Running for Web DevelopersDocker Up and Running for Web Developers
Docker Up and Running for Web Developers
 
Docker on docker leveraging kubernetes in docker ee
Docker on docker leveraging kubernetes in docker eeDocker on docker leveraging kubernetes in docker ee
Docker on docker leveraging kubernetes in docker ee
 
Docker+java
Docker+javaDocker+java
Docker+java
 
Docker Enterprise Workshop - Technical
Docker Enterprise Workshop - TechnicalDocker Enterprise Workshop - Technical
Docker Enterprise Workshop - Technical
 
Introduction to Docker Container
Introduction to Docker ContainerIntroduction to Docker Container
Introduction to Docker Container
 

Mais de Giovanni Toraldo

About code review and BUGS
About code review and BUGSAbout code review and BUGS
About code review and BUGSGiovanni Toraldo
 
Managing GCP Projects with Terraform (devfest Pisa 2018)
Managing GCP Projects with Terraform (devfest Pisa 2018)Managing GCP Projects with Terraform (devfest Pisa 2018)
Managing GCP Projects with Terraform (devfest Pisa 2018)Giovanni Toraldo
 
Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)Giovanni Toraldo
 
Software Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery ApproachSoftware Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery ApproachGiovanni Toraldo
 
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps ItaliaWhen Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps ItaliaGiovanni Toraldo
 
Easy applications deployment on OpenStack clouds
Easy applications deployment on OpenStack cloudsEasy applications deployment on OpenStack clouds
Easy applications deployment on OpenStack cloudsGiovanni Toraldo
 
Introduction to Continuous Delivery
Introduction to Continuous DeliveryIntroduction to Continuous Delivery
Introduction to Continuous DeliveryGiovanni Toraldo
 
ClouDesire @ Italian DevOps Initiative 2013 #idi2013
ClouDesire @ Italian DevOps Initiative 2013 #idi2013ClouDesire @ Italian DevOps Initiative 2013 #idi2013
ClouDesire @ Italian DevOps Initiative 2013 #idi2013Giovanni Toraldo
 
Cloud Computing in practice with OpenNebula ~ Develer workshop 2012
Cloud Computing in practice with OpenNebula ~ Develer workshop 2012Cloud Computing in practice with OpenNebula ~ Develer workshop 2012
Cloud Computing in practice with OpenNebula ~ Develer workshop 2012Giovanni Toraldo
 
An introduction to cloud computing
An introduction to cloud computingAn introduction to cloud computing
An introduction to cloud computingGiovanni Toraldo
 
EVA Florence 2012 ~ Open low-cost HA cluster cloud
EVA Florence 2012 ~ Open low-cost HA cluster cloudEVA Florence 2012 ~ Open low-cost HA cluster cloud
EVA Florence 2012 ~ Open low-cost HA cluster cloudGiovanni Toraldo
 

Mais de Giovanni Toraldo (14)

About code review and BUGS
About code review and BUGSAbout code review and BUGS
About code review and BUGS
 
Introduction to Traefik
Introduction to TraefikIntroduction to Traefik
Introduction to Traefik
 
Managing GCP Projects with Terraform (devfest Pisa 2018)
Managing GCP Projects with Terraform (devfest Pisa 2018)Managing GCP Projects with Terraform (devfest Pisa 2018)
Managing GCP Projects with Terraform (devfest Pisa 2018)
 
Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)
 
Software Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery ApproachSoftware Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery Approach
 
From zero to Docker
From zero to DockerFrom zero to Docker
From zero to Docker
 
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps ItaliaWhen Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
 
Easy applications deployment on OpenStack clouds
Easy applications deployment on OpenStack cloudsEasy applications deployment on OpenStack clouds
Easy applications deployment on OpenStack clouds
 
Introduction to Continuous Delivery
Introduction to Continuous DeliveryIntroduction to Continuous Delivery
Introduction to Continuous Delivery
 
ClouDesire @ Italian DevOps Initiative 2013 #idi2013
ClouDesire @ Italian DevOps Initiative 2013 #idi2013ClouDesire @ Italian DevOps Initiative 2013 #idi2013
ClouDesire @ Italian DevOps Initiative 2013 #idi2013
 
Cloud Computing in practice with OpenNebula ~ Develer workshop 2012
Cloud Computing in practice with OpenNebula ~ Develer workshop 2012Cloud Computing in practice with OpenNebula ~ Develer workshop 2012
Cloud Computing in practice with OpenNebula ~ Develer workshop 2012
 
An introduction to cloud computing
An introduction to cloud computingAn introduction to cloud computing
An introduction to cloud computing
 
EVA Florence 2012 ~ Open low-cost HA cluster cloud
EVA Florence 2012 ~ Open low-cost HA cluster cloudEVA Florence 2012 ~ Open low-cost HA cluster cloud
EVA Florence 2012 ~ Open low-cost HA cluster cloud
 
Open@BNCF
Open@BNCFOpen@BNCF
Open@BNCF
 

Último

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 

Último (20)

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 

Docker in production service discovery with consul - road to opscon 2015

  • 1. Docker in production: service discovery with Consul Giovanni Toraldo - Lead developer @ ClouDesire.com Road to OpsCon 2015 - Milano
  • 2. About me Open Source Enthusiast with SuperCow Powers PHP/Java/whatever developer writer of the OpenNebula book Lead developer at ClouDesire.com 2
  • 3. What is ClouDesire? Application Marketplace to help software vendors to sell and provision applications ● Web Applications: ○ provision VM ○ on multiple cloud providers ○ deploy/upgrade application and dependencies ○ application logging ○ resource monitoring ● With multi-tenant applications/SaaS: ○ expose REST hooks and API for billing lifecycle ● manage subscriptions, billing, pay-per-use, invoicing, payments. 3
  • 4. ClouDesire platform components Multitude of components of different stacks: ● Multiple Java/Tomcat REST backends ● Minor Ruby, Node REST backends ● AngularJS frontend ● PostgreSQL ● MongoDB ● Rsyslog + nxlog + Logstash + ElasticSearch ● ActiveMQ 4
  • 5. Before Docker: platform deployments Problems faced: ● Different stacks, different ways to handle deployments ○ Hundreds LOC of Chef recipes ○ Inevitable complexity ○ No trustworthy procedure to rollback ● Hard to switch between deps versions ○ Only the one available on official Ubuntu repositories ● Heterogeneous dev environments (vagrant?) ○ Ubuntu, Arch Linux, Mac 5
  • 6. Before Docker: application packaging How to grab applications from ClouDesire vendors? ● GIT repository (heroku)? ○ Not really its use-case, require understanding ○ Customization may require branching ● DEB/RPM packages? ○ Too much complexity ● Custom approach? 6
  • 7. Before Docker: hand-made zip package Requirements: ● Everyone should be able to do it ● even Windows users ● in a short time Our solution, not elegant but effective: ● A ZIP archive with: ○ a folder for sources/artifacts ○ a folder for sql scripts ○ predefined environment variables to use 7
  • 8. Before Docker: custom zip package Application source code itself is not sufficient: ● Custom dependencies (e.g.: Alfresco) ● Custom dependencies versions ● Configuration for external resources ● Shameful hacks? 8
  • 9. “Maybe Docker can help?” 9
  • 10. 10
  • 11. Docker: container lifecycle ● Pulls an image from a registry ● Creates a new container ○ Allocates a r/w filesystem ○ Allocates a network interface (on a bridge) ○ Sets up network (IP address, dns..) ● Launch a process into the container ● Captures and provides application output ● Container terminates when the process exits 11
  • 12. Docker: why? Enables software developers to: ● package an application ● with all dependencies ● runs it everywhere unchanged ● re-use images via composition 12
  • 13. Docker: why? Enables system administrators to: ● standardize application deployment ● ease scale-up & scale-down ● process separation/isolation 13
  • 14. Docker adoption: platform deployment ● Different stacks, different ways to handle deployments ○ Docker Image for each component ○ Dozens LOC of Chef recipe for deploy / upgrades ○ Deployment complexity hidden into Dockerfile ○ Rollback is equal to upgrade ● Hard to switch between deps versions ○ Docker for external dependencies ○ Use them without thinking how to deploy / upgrade ● Heterogeneous dev environments (vagrant?) ○ Docker-compose for each module 14
  • 15. Docker adoption: application packaging How to grab applications from ClouDesire vendors? ● Custom ZIP package ○ Build a docker image for the application ○ Push your image to our registry. Advantages: ● Easy to follow documentation ● Fast Try-Fail-Retry cycle while building ● Works-for-me is works everywhere ● Re-use community images for dependencies 15
  • 16. Docker adoption: application packaging ● Custom dependencies (e.g.: Alfresco) ○ (Re-)Use multiple containers ● Custom dependencies versions ○ Multiple versions easily available ● Configuration for external resources ○ Environment variables ● Shameful hacks? ○ Hidden in the Dockerfile 16
  • 17. Docker: it looks like something is missing Moving to containers introduced a new layer of complexity: ● communication between containers: ○ Same host (with docker linking feature) ■ restart everything after redeploy ○ Multiple hosts ■ not a docker problem ● Scaling/hot-deploy ready ○ but load balancers are statically configured 17
  • 18. “It would be a mess” 18
  • 19. Service Discovery to the rescue 19
  • 20. Before Consul (and service discovery) ● Hardcoded IP:port configuration ○ Hand-made copy-paste ○ Not fault-tolerant ○ No autoscaling ○ No self-healing ● Configuration management (e.g. Puppet, Chef) ○ Slow to react to events ○ Ordered service starting Above not really feasible when running dozens of containers 20
  • 22. When service discovery is needed ● Monolithic architecture? No problem. ● Distributed architecture? ○ Is there at least one foo instance running? ○ At which address? ○ On which port? FOO BAR Service Registry Client 22
  • 23. Consul features ● Agent based ● Query interfaces ○ HTTP JSON API ○ DNS ● Health-Checking ○ No one want borked services ● Key-Value Store ○ Shared dynamic configuration ○ Feature toggle ○ Leader election 23
  • 24. docker run --rm --name consul -p 8500:8500 -p 8600:8600 voxxit/consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul --client 0.0.0.0 -node helloworld ● consensus protocol ○ https://github.com/hashicorp/raft ● lightweight gossip protocol ○ https://github.com/hashicorp/serf Single node bootstrap 24
  • 25. 25
  • 26. Second node bootstrap $ docker run --rm --name consul2 voxxit/consul agent -server - join 172.17.0.2 -data-dir /tmp/consul --client 0.0.0.0 -node helloworld2 26
  • 27. Two nodes cluster alive ● helloworld2 joined cluster ● replication take place ● helloworld2 marked as healthy 27
  • 28. Node querying - DNS interface $ dig helloworld.node.consul @localhost -p 8600 +tcp helloworld.node.consul. 0 IN A 172.17.0.2 $ dig helloworld2.node.consul @localhost -p 8600 +tcp helloworld2.node.consul. 0 IN A 172.17.0.3 28
  • 29. Node querying - HTTP interface $ curl localhost:8500/v1/catalog/nodes [{"Node":"helloworld2","Address":"172.17.0.3"},{"Node":" helloworld","Address":"172.17.0.2"}]% 29
  • 30. Register a new service $ curl -X POST -d @service.json localhost: 8500/v1/agent/service/register { "ID": "redis1", "Name": "redis", "Tags": [ "master", "v1" ], "Address": "172.16.0.2", "Port": 8000 } 30
  • 31. Retrieve service details $ dig redis.service.consul @localhost -p 8600 +tcp redis.service.consul. 0 IN A 172.16.0.2 $ curl localhost:8500/v1/agent/services {"consul":{"ID":"consul","Service":"consul","Tags":[]," Address":"","Port":8300},"redis1":{"ID":"redis1","Service":"redis"," Tags":["master","v1"],"Address":"172.16.0.2","Port":8000}}% 31
  • 32. Populate services from Docker https://github.com/gliderlabs/registrator ● Discover containers using docker API ● Skip containers without published ports ● Register service when container goes up ○ Service name is the image name ○ Tags via environment variables ● Unregister service when container goes down 32
  • 33. Running registrator $ docker run -d --name=registrator --net=host --volume=/var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://localhost:8500 Note: exposing docker.sock in a container is a security concern. 33
  • 34. Enrich service metadata ● Registrator auto discovery can be enriched via environment variables $ docker run --name redis-0 -p 10000:6379 -e "SERVICE_NAME=db" -e "SERVICE_TAGS=master" -e "SERVICE_REGION=it" redis 34
  • 35. Retrieve registrator services $ dig consul.service.consul @localhost -p 8600 +tcp consul.service.consul. 0 IN A 172.17.0.3 consul.service.consul. 0 IN A 172.17.0.2 $ curl localhost:8500/v1/agent/services {"consul":{"ID":"consul","Service":"consul","Tags":[],"Address":"","Port":8300}," viserion:consul:8500":{"ID":"viserion:consul:8500","Service":"consul-8500","Tags": null,"Address":"127.0.1.1","Port":8500},"viserion:consul:8600":{"ID":"viserion:consul: 8600","Service":"consul-8600","Tags":null,"Address":"127.0.1.1","Port":8600}}% 35
  • 36. Automatic reverse proxy for web services $ consul-template -consul 127.0.0.1:8500 -template "/tmp/template.ctmpl:/var/www/nginx.conf:service nginx restart" -retry 30s upstream upstream-<%= @service_name %> { least_conn; {{range service "<%= @service_name %>"}}server {{.Address}}: {{.Port}} max_fails=3 fail_timeout=60 weight=1; {{else}}server 127.0.0.1:65535; # force a 502{{end}} } 36
  • 37. Example nginx.conf fragment server { listen 80 default_server; location ~ ^/api/(.*)$ { proxy_pass http://upstream-service-name/$1$is_args$args; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } } 37
  • 38. Real-world architecture of everything Container A Container B Registrator Consul agent Consul agent Registrator Backend Node A Backend Node B Network ● Consul agent running on each node ● Registrator on each docker node ● Every node has 127.0.0.1 in /etc/resolv.conf ● Services discover dependencies via DNS ● Nginx endpoint generated by consul-template Frontend Node(s) Nginx Consul agent Consul- template 38
  • 39. Consul: additional goodies ● Key-Value store for configurations ● DNS forwarding ● DNS caching ● WAN replication (Multi-DC) ● Atlas bootstrapping (https://atlas.hashicorp. com/) ● Web UI (http://demo.consul.io/ui/) 39
  • 40. 40
  • 41. Homework for the coming months ● Take a look at: ○ Docker swarm (1.0 released on nov 2015) ○ Kubernetes (1.0 release on july 2015) ○ Apache Mesos (0.25 release on oct 2015) 41