SlideShare a Scribd company logo
1 of 51
LB+HA webapp with Docker Swarm
Simone Soldateschi
ROME - APRIL 13/14 2018
“Let me tell you a story...”
Who I am
● Staff Engineer at Slack
● Previously at Microsoft,
Rackspace
● 10+ years of experience as
○ Software Engineer
○ Systems Engineer
○ DevOps'in for the last 8 years
Simone Soldateschi
@soldasimo
simone.soldateschi@gmail.com
Friday: 5.50pm-6.30pm
+ during breaks
● Container Orchestration Engines, COEs
● Docker Swarm Mode, why
● Cloud Infrastructure, abs
● Service Management, how
Agenda
Container Orchestration
Engines
COEs
- Lots of features (auto-
scaling, secrets
management, UI)
- YAML deployment
model
- Pods
- Large community
- Google, Red Hat, Azure
- Quite recent project
- YAML deployment model
- Multi-master
- Auto-healing
- TLS network security
- Quick and Easy
- No UI
- No auto-scaling
- No external load-
balancing
- Multi-master
- Highly scalable
- Multi OSes
- Steep learning curve
- Airbnb, ~Apple, eBay,
Netflix, Twitter
Docker Swarm Mode
The path to Docker Swarm Mode
«If you are using a Docker version prior to 1.12.0,
you can use standalone swarm,
but we recommend updating.»
https://docs.docker.com/engine/swarm/
Standalone Swarm != Swarm mode
$ docker swarm init
$ docker swarm join
Key Features
● Cluster management with Docker Engine
● Declarative service model
● Auto Scaling
● Multi-host networking
● Service Discovery
● Load balancing
● Secure by default (TLS)
● Rolling updates
● Developer oriented
Docker Swarm Security
Cloud Infrastructure
Manager initialises cluster
docker swarm init 
--advertise-addr $MANAGER_IP
Stand up basic cluster
[Manager|Worker]
docker swarm join 
--token $TOKEN_[MANAGER|WORKER] 
$MANAGER_IP:2377
Infrastructure as Code
template PRplan
plan destroyapply
DEV
DEPLOY
Basic Cluster
Architecture
Raft
Internal Distributed Store
Leader
Follower
Follower
Workers Gossip network
Raft consensus groupManagers
The Raft Consensus Algorithm
The Secret Lives of Data
Raft consensus
Given N managers:
● Raft tolerates up to (N-1)/2 failures.
● Raft requires a quorum of (N/2)+1 members to agree
on values proposed to the cluster.
Cluster Fault Tolerance
Multi AZ
Scale Cluster in/out
manager ASG
worker ASG
Docker Swarm cluster revised
Manager
docker swarm join 
--token $TOKEN_MANAGER 
$MANAGER_IP:2377
Worker
docker swarm join 
--token $TOKEN_WORKER 
$MANAGER_IP:2377
Autojoin Swarm Nodes
Autojoin Swarm Nodes
1. Ask manager for a token,
e.g. API, SSH
3. Join with token
2. Fetch token
Autojoin Swarm Nodes
1. Ask Vault for
a token
2. Fetch token
3. Join with token
Service Management
stack
Container, Service and Stack
service
container
A day in the life of a Docker Service
create scale rm
ls
logs rollback
ps
update
?
?
inspect
$ docker service create --name web -p 80:80 nginx
overall progress: 1 out of 1 tasks
1/1: running [=================================>]
verify: Service converged
Docker service
$ docker service scale web=3
web scaled to 3
overall progress: 3 out of 3 tasks
1/3: running [=================================>]
2/3: running [=================================>]
3/3: running [=================================>]
verify: Service converged
$ docker service rm web
A day in the life of a Docker Stack
deploy services rm
ls
?
ps
Docker Stacks
version: "3"
services:
web:
image: nginx
deploy:
replicas: 3
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- "80:80"
networks:
- webnet
networks:
webnet:
$ docker stack deploy -c docker-compose.yml webstack
Creating network webstack_webnet
Creating service webstack_web
$ docker stack ps --format 
"{{.Name}}: {{.Image}} {{.Node}}
{{.DesiredState}}"
webstack
webstack_web.1: nginx:latest worker2 Running
webstack_web.2: nginx:latest manager Running
webstack_web.3: nginx:latest worker1 Running
Docker Stacks
$ docker service scale webstack_web=6
webstack_web scaled to 6
overall progress: 6 out of 6 tasks
1/6: running [===================================>]
2/6: running [===================================>]
3/6: running [===================================>]
4/6: running [===================================>]
5/6: running [===================================>]
6/6: running [===================================>]
verify: Service converged
Secrets Management
● It’s best not to have secrets.
● Don’t write secrets down.
● Protect secrets in one place.
Secrets Management
manager
TLS
Internal distributed store
manager
TLS
manager
TLS
Service Deploy
worker
TLS
worker
TLS
worker
TLS
Raft Consensus Group
Multi-region
Cloud Infrastructure
Multi-region
Pilot Light
Tie up all things
// wait for it...
Demo Time
● Stand up development Swarm cluster
● Start services
● Start monitoring
● Scale and Load-test
Stand up Dev Swarm cluster
$ git clone 
https://github.com/siso/vagrant-docker-swarm.git
$ cd vagrant-docker-swarm
$ AUTO_START_SWARM=true vagrant up
Scale and Load-test
Monitor load-tests
Q&A
simone soldateschi
Friday: 5.50pm-6.30pm
+
during breaks
@soldasimo
simone.soldateschi@gmail.com
github.com/siso/vagrant-docker-
swarm
Recap
● Services and Stacks
Recap
● Swarm Mode
● Multi-region infrastructure
● Provision Infrastructure
● Demo
Lesson Learned
● Options are good. Many COEs to choose from.
● Docker Swarm Mode is great for greenfield project.
● Prototype, then automate. Don’t do both.
Thank You!
Extras
References
● vagrant-docker-swarm on github
Vagrantfile to stand up Docker Engine Swarm Mode cluster. It requires Docker 1.12+, and runs Debian.
● swarmprom
Docker Swarm instrumentation with Prometheus, Grafana, cAdvisor, Node Exporter and Alert Manager
● Raft - Understandable Distributed Consensus
● Swarm mode overview
License
Attribution-ShareAlike 4.0
International

More Related Content

What's hot

WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineNGINX, Inc.
 
Altitude SF 2017: Advanced VCL: Shielding and Clustering
Altitude SF 2017: Advanced VCL: Shielding and ClusteringAltitude SF 2017: Advanced VCL: Shielding and Clustering
Altitude SF 2017: Advanced VCL: Shielding and ClusteringFastly
 
Nomad + Flatcar: a harmonious marriage of lightweights
Nomad + Flatcar: a harmonious marriage of lightweightsNomad + Flatcar: a harmonious marriage of lightweights
Nomad + Flatcar: a harmonious marriage of lightweightsIago López Galeiras
 
Apache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusApache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusClaus Ibsen
 
Integrating microservices with apache camel on kubernetes
Integrating microservices with apache camel on kubernetesIntegrating microservices with apache camel on kubernetes
Integrating microservices with apache camel on kubernetesClaus Ibsen
 
Host Health Monitoring with Docker Run
Host Health Monitoring with Docker RunHost Health Monitoring with Docker Run
Host Health Monitoring with Docker RunNoah Zoschke
 
Apache Camel K - Copenhagen
Apache Camel K - CopenhagenApache Camel K - Copenhagen
Apache Camel K - CopenhagenClaus Ibsen
 
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...Claus Ibsen
 
Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2Claus Ibsen
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.jsPrabin Silwal
 
SaltConf 2014: Safety with powertools
SaltConf 2014: Safety with powertoolsSaltConf 2014: Safety with powertools
SaltConf 2014: Safety with powertoolsThomas Jackson
 
Multiple django applications on a single server with nginx
Multiple django applications on a single server with nginxMultiple django applications on a single server with nginx
Multiple django applications on a single server with nginxroskakori
 
Server Side Rendering, caching and performance
Server Side Rendering, caching and performanceServer Side Rendering, caching and performance
Server Side Rendering, caching and performanceAteev Chopra
 
Operating CloudStack: the easy way (automation!)
Operating CloudStack: the easy way (automation!)Operating CloudStack: the easy way (automation!)
Operating CloudStack: the easy way (automation!)Remi Bergsma
 
Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...
Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...
Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...Claus Ibsen
 
Consul - service discovery and others
Consul - service discovery and othersConsul - service discovery and others
Consul - service discovery and othersWalter Liu
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsBenjamin Cane
 
London devops logging
London devops loggingLondon devops logging
London devops loggingTomas Doran
 

What's hot (20)

WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngine
 
Altitude SF 2017: Advanced VCL: Shielding and Clustering
Altitude SF 2017: Advanced VCL: Shielding and ClusteringAltitude SF 2017: Advanced VCL: Shielding and Clustering
Altitude SF 2017: Advanced VCL: Shielding and Clustering
 
Nomad + Flatcar: a harmonious marriage of lightweights
Nomad + Flatcar: a harmonious marriage of lightweightsNomad + Flatcar: a harmonious marriage of lightweights
Nomad + Flatcar: a harmonious marriage of lightweights
 
Apache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusApache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel Quarkus
 
Integrating microservices with apache camel on kubernetes
Integrating microservices with apache camel on kubernetesIntegrating microservices with apache camel on kubernetes
Integrating microservices with apache camel on kubernetes
 
Host Health Monitoring with Docker Run
Host Health Monitoring with Docker RunHost Health Monitoring with Docker Run
Host Health Monitoring with Docker Run
 
Apache Camel K - Copenhagen
Apache Camel K - CopenhagenApache Camel K - Copenhagen
Apache Camel K - Copenhagen
 
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
 
About Node.js
About Node.jsAbout Node.js
About Node.js
 
Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.js
 
SaltConf 2014: Safety with powertools
SaltConf 2014: Safety with powertoolsSaltConf 2014: Safety with powertools
SaltConf 2014: Safety with powertools
 
Multiple django applications on a single server with nginx
Multiple django applications on a single server with nginxMultiple django applications on a single server with nginx
Multiple django applications on a single server with nginx
 
Server Side Rendering, caching and performance
Server Side Rendering, caching and performanceServer Side Rendering, caching and performance
Server Side Rendering, caching and performance
 
Operating CloudStack: the easy way (automation!)
Operating CloudStack: the easy way (automation!)Operating CloudStack: the easy way (automation!)
Operating CloudStack: the easy way (automation!)
 
Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...
Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...
Red Hat Nordics 2020 - Apache Camel 3 the next generation of enterprise integ...
 
Consul - service discovery and others
Consul - service discovery and othersConsul - service discovery and others
Consul - service discovery and others
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environments
 
Docker in practice
Docker in practiceDocker in practice
Docker in practice
 
London devops logging
London devops loggingLondon devops logging
London devops logging
 

Similar to Codemotion Rome 2018 Docker Swarm Mode

DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansiblesriram_rajan
 
New Docker Features for Orchestration and Containers
New Docker Features for Orchestration and ContainersNew Docker Features for Orchestration and Containers
New Docker Features for Orchestration and ContainersJeff Anderson
 
Drupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from SunDrupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from Sunsmattoon
 
What's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
What's New in Docker 1.12 by Mike Goelzer and Andrea LuzzardiWhat's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
What's New in Docker 1.12 by Mike Goelzer and Andrea LuzzardiDocker, Inc.
 
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea LuzzardiWhat's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea LuzzardiMike Goelzer
 
Drupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, ScalingDrupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, Scalingsmattoon
 
Salting new ground one man ops from scratch
Salting new ground   one man ops from scratchSalting new ground   one man ops from scratch
Salting new ground one man ops from scratchJay Harrison
 
Scaling Mapufacture on Amazon Web Services
Scaling Mapufacture on Amazon Web ServicesScaling Mapufacture on Amazon Web Services
Scaling Mapufacture on Amazon Web ServicesAndrew Turner
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardwayDave Pitts
 
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesApache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesDataWorks Summit
 
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...Amazon Web Services
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
Container orchestration from theory to practice
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practiceDocker, Inc.
 
Why Sun for Drupal?
Why Sun for Drupal?Why Sun for Drupal?
Why Sun for Drupal?smattoon
 
Deep Dive into Docker Swarm Mode
Deep Dive into Docker Swarm ModeDeep Dive into Docker Swarm Mode
Deep Dive into Docker Swarm ModeAjeet Singh Raina
 
CCCEU15 run cloudstack in docker
CCCEU15 run cloudstack in dockerCCCEU15 run cloudstack in docker
CCCEU15 run cloudstack in dockerPierre-Luc Dion
 
CloudStack Collab Conference 2015 Run CloudStack in Docker
CloudStack Collab Conference 2015 Run CloudStack in DockerCloudStack Collab Conference 2015 Run CloudStack in Docker
CloudStack Collab Conference 2015 Run CloudStack in DockerCloudOps2005
 
The Future is Now: Leveraging the Cloud with Ruby
The Future is Now: Leveraging the Cloud with RubyThe Future is Now: Leveraging the Cloud with Ruby
The Future is Now: Leveraging the Cloud with RubyRobert Dempsey
 
Oracle 11g R2 RAC setup on rhel 5.0
Oracle 11g R2 RAC setup on rhel 5.0Oracle 11g R2 RAC setup on rhel 5.0
Oracle 11g R2 RAC setup on rhel 5.0Santosh Kangane
 
Dockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and NovaDockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and Novaclayton_oneill
 

Similar to Codemotion Rome 2018 Docker Swarm Mode (20)

DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansible
 
New Docker Features for Orchestration and Containers
New Docker Features for Orchestration and ContainersNew Docker Features for Orchestration and Containers
New Docker Features for Orchestration and Containers
 
Drupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from SunDrupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from Sun
 
What's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
What's New in Docker 1.12 by Mike Goelzer and Andrea LuzzardiWhat's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
What's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
 
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea LuzzardiWhat's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
 
Drupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, ScalingDrupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, Scaling
 
Salting new ground one man ops from scratch
Salting new ground   one man ops from scratchSalting new ground   one man ops from scratch
Salting new ground one man ops from scratch
 
Scaling Mapufacture on Amazon Web Services
Scaling Mapufacture on Amazon Web ServicesScaling Mapufacture on Amazon Web Services
Scaling Mapufacture on Amazon Web Services
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesApache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
 
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Container orchestration from theory to practice
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practice
 
Why Sun for Drupal?
Why Sun for Drupal?Why Sun for Drupal?
Why Sun for Drupal?
 
Deep Dive into Docker Swarm Mode
Deep Dive into Docker Swarm ModeDeep Dive into Docker Swarm Mode
Deep Dive into Docker Swarm Mode
 
CCCEU15 run cloudstack in docker
CCCEU15 run cloudstack in dockerCCCEU15 run cloudstack in docker
CCCEU15 run cloudstack in docker
 
CloudStack Collab Conference 2015 Run CloudStack in Docker
CloudStack Collab Conference 2015 Run CloudStack in DockerCloudStack Collab Conference 2015 Run CloudStack in Docker
CloudStack Collab Conference 2015 Run CloudStack in Docker
 
The Future is Now: Leveraging the Cloud with Ruby
The Future is Now: Leveraging the Cloud with RubyThe Future is Now: Leveraging the Cloud with Ruby
The Future is Now: Leveraging the Cloud with Ruby
 
Oracle 11g R2 RAC setup on rhel 5.0
Oracle 11g R2 RAC setup on rhel 5.0Oracle 11g R2 RAC setup on rhel 5.0
Oracle 11g R2 RAC setup on rhel 5.0
 
Dockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and NovaDockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and Nova
 

More from Simone Soldateschi

Immutable Systems in the AWS Cloud
Immutable Systems in the AWS CloudImmutable Systems in the AWS Cloud
Immutable Systems in the AWS CloudSimone Soldateschi
 
Build Chef development box from scratch
Build Chef development box from scratchBuild Chef development box from scratch
Build Chef development box from scratchSimone Soldateschi
 
Test Driven Development with Chef
Test Driven Development with ChefTest Driven Development with Chef
Test Driven Development with ChefSimone Soldateschi
 
PyCon Russia 2014 - Auto Scale in the Cloud
PyCon Russia 2014 - Auto Scale in the CloudPyCon Russia 2014 - Auto Scale in the Cloud
PyCon Russia 2014 - Auto Scale in the CloudSimone Soldateschi
 

More from Simone Soldateschi (6)

Immutable Systems in the AWS Cloud
Immutable Systems in the AWS CloudImmutable Systems in the AWS Cloud
Immutable Systems in the AWS Cloud
 
Build Chef development box from scratch
Build Chef development box from scratchBuild Chef development box from scratch
Build Chef development box from scratch
 
Test Driven Development with Chef
Test Driven Development with ChefTest Driven Development with Chef
Test Driven Development with Chef
 
Ansible - Crash course
Ansible - Crash courseAnsible - Crash course
Ansible - Crash course
 
Git Crash Course
Git Crash CourseGit Crash Course
Git Crash Course
 
PyCon Russia 2014 - Auto Scale in the Cloud
PyCon Russia 2014 - Auto Scale in the CloudPyCon Russia 2014 - Auto Scale in the Cloud
PyCon Russia 2014 - Auto Scale in the Cloud
 

Recently uploaded

Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewingbigorange77
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一3sw2qly1
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 

Recently uploaded (20)

Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewing
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
Call Girls Service Dwarka @9999965857 Delhi 🫦 No Advance VVIP 🍎 SERVICE
Call Girls Service Dwarka @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SERVICECall Girls Service Dwarka @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SERVICE
Call Girls Service Dwarka @9999965857 Delhi 🫦 No Advance VVIP 🍎 SERVICE
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 

Codemotion Rome 2018 Docker Swarm Mode

  • 1. LB+HA webapp with Docker Swarm Simone Soldateschi ROME - APRIL 13/14 2018
  • 2. “Let me tell you a story...”
  • 3. Who I am ● Staff Engineer at Slack ● Previously at Microsoft, Rackspace ● 10+ years of experience as ○ Software Engineer ○ Systems Engineer ○ DevOps'in for the last 8 years Simone Soldateschi @soldasimo simone.soldateschi@gmail.com Friday: 5.50pm-6.30pm + during breaks
  • 4. ● Container Orchestration Engines, COEs ● Docker Swarm Mode, why ● Cloud Infrastructure, abs ● Service Management, how Agenda
  • 6. COEs - Lots of features (auto- scaling, secrets management, UI) - YAML deployment model - Pods - Large community - Google, Red Hat, Azure - Quite recent project - YAML deployment model - Multi-master - Auto-healing - TLS network security - Quick and Easy - No UI - No auto-scaling - No external load- balancing - Multi-master - Highly scalable - Multi OSes - Steep learning curve - Airbnb, ~Apple, eBay, Netflix, Twitter
  • 8. The path to Docker Swarm Mode «If you are using a Docker version prior to 1.12.0, you can use standalone swarm, but we recommend updating.» https://docs.docker.com/engine/swarm/
  • 9. Standalone Swarm != Swarm mode $ docker swarm init $ docker swarm join
  • 10. Key Features ● Cluster management with Docker Engine ● Declarative service model ● Auto Scaling ● Multi-host networking ● Service Discovery ● Load balancing ● Secure by default (TLS) ● Rolling updates ● Developer oriented
  • 13. Manager initialises cluster docker swarm init --advertise-addr $MANAGER_IP Stand up basic cluster [Manager|Worker] docker swarm join --token $TOKEN_[MANAGER|WORKER] $MANAGER_IP:2377
  • 14. Infrastructure as Code template PRplan plan destroyapply DEV DEPLOY
  • 17. The Raft Consensus Algorithm The Secret Lives of Data
  • 18. Raft consensus Given N managers: ● Raft tolerates up to (N-1)/2 failures. ● Raft requires a quorum of (N/2)+1 members to agree on values proposed to the cluster.
  • 22. Docker Swarm cluster revised Manager docker swarm join --token $TOKEN_MANAGER $MANAGER_IP:2377 Worker docker swarm join --token $TOKEN_WORKER $MANAGER_IP:2377
  • 24. Autojoin Swarm Nodes 1. Ask manager for a token, e.g. API, SSH 3. Join with token 2. Fetch token
  • 25. Autojoin Swarm Nodes 1. Ask Vault for a token 2. Fetch token 3. Join with token
  • 27. stack Container, Service and Stack service container
  • 28. A day in the life of a Docker Service create scale rm ls logs rollback ps update ? ? inspect
  • 29. $ docker service create --name web -p 80:80 nginx overall progress: 1 out of 1 tasks 1/1: running [=================================>] verify: Service converged Docker service $ docker service scale web=3 web scaled to 3 overall progress: 3 out of 3 tasks 1/3: running [=================================>] 2/3: running [=================================>] 3/3: running [=================================>] verify: Service converged $ docker service rm web
  • 30. A day in the life of a Docker Stack deploy services rm ls ? ps
  • 31. Docker Stacks version: "3" services: web: image: nginx deploy: replicas: 3 resources: limits: cpus: "0.1" memory: 50M restart_policy: condition: on-failure ports: - "80:80" networks: - webnet networks: webnet: $ docker stack deploy -c docker-compose.yml webstack Creating network webstack_webnet Creating service webstack_web $ docker stack ps --format "{{.Name}}: {{.Image}} {{.Node}} {{.DesiredState}}" webstack webstack_web.1: nginx:latest worker2 Running webstack_web.2: nginx:latest manager Running webstack_web.3: nginx:latest worker1 Running
  • 32. Docker Stacks $ docker service scale webstack_web=6 webstack_web scaled to 6 overall progress: 6 out of 6 tasks 1/6: running [===================================>] 2/6: running [===================================>] 3/6: running [===================================>] 4/6: running [===================================>] 5/6: running [===================================>] 6/6: running [===================================>] verify: Service converged
  • 33. Secrets Management ● It’s best not to have secrets. ● Don’t write secrets down. ● Protect secrets in one place.
  • 34. Secrets Management manager TLS Internal distributed store manager TLS manager TLS Service Deploy worker TLS worker TLS worker TLS Raft Consensus Group
  • 38. Tie up all things // wait for it...
  • 39. Demo Time ● Stand up development Swarm cluster ● Start services ● Start monitoring ● Scale and Load-test
  • 40. Stand up Dev Swarm cluster $ git clone https://github.com/siso/vagrant-docker-swarm.git $ cd vagrant-docker-swarm $ AUTO_START_SWARM=true vagrant up
  • 43. Q&A
  • 44. simone soldateschi Friday: 5.50pm-6.30pm + during breaks @soldasimo simone.soldateschi@gmail.com github.com/siso/vagrant-docker- swarm
  • 45. Recap
  • 46. ● Services and Stacks Recap ● Swarm Mode ● Multi-region infrastructure ● Provision Infrastructure ● Demo
  • 47. Lesson Learned ● Options are good. Many COEs to choose from. ● Docker Swarm Mode is great for greenfield project. ● Prototype, then automate. Don’t do both.
  • 50. References ● vagrant-docker-swarm on github Vagrantfile to stand up Docker Engine Swarm Mode cluster. It requires Docker 1.12+, and runs Debian. ● swarmprom Docker Swarm instrumentation with Prometheus, Grafana, cAdvisor, Node Exporter and Alert Manager ● Raft - Understandable Distributed Consensus ● Swarm mode overview

Editor's Notes

  1. Hi! Thanks for joining me. :) My name is Simone Soldateschi. I am going to share with you a project I worked on based on load-balanced high-available multi-region webapp with Docker Swarm.
  2. Let’s see a screencast of a session in which webstack service scale up by doubling the number of containers 4 times, and load-test with Apache ab.
  3. Additional content I would use to exemplify thoughts, or anticipatedly respond frequently-asked-questions.