SlideShare a Scribd company logo
1 of 30
DOCKER @ STUFFLE
Robin Brandt / @rob_b
ABOUT ME
lead developer @ Stuffle since fall 2012
mostly working on the backend
ABOUT STUFFLE
mobile marketplace for classifieds
founded 2012 in Hamburg
since 2014 part of Immobilienscout24 Group
PLATFORMS
iOS, Android, Web (in order of appearance)
THE STUFFLE BACKEND
Rails app
hosted on AWS
using PostgreSQL (RDS), Elasticsearch (self-hosted), Redis
(ElastiCache), Elastic Load Balancer
MANAGING THE INFRASTRUCTURE
provisioning must be scripted, no manual installations
scripts are executable documentation, can be versioned
use the exact same scripts to setup development, staging
and production
AND DOCKER?
discovered Docker in late 2013
loved the idea of containerization
especially cool: running the exact same code in tests,
staging and production
running in production since 09/2014
COREOS / KUBERNETES / SWARM /
MESOS / ...?
haven't looked at it in depth, yet
interesting ecosystem growing around containerization
wanted to start somewhere simple
would love to have the problems some of these tools are
solving
TOOLS WE'RE USING
ansible sets up and provisions the environment
consul runs on every server and does service discovery
and stores application configuration
the application code is run in docker containers via a 40
line ruby script creatively called run-stuffle
ANSIBLE
no special "agent" needed on nodes
provisioning is described in playbooks (YAML files)
- hosts: application_servers:worker_servers
roles:
- docker
- td_agent
- stuffle-api
- monit
A task file:
- name: configure log rotation
template: src=stuffle.logrotate dest=/etc/logrotate.d/stuffle
- name: copy run script
template: src=run-stuffle.j2 dest=/usr/local/bin/run-stuffle mode=0755
ANSIBLE (2)
can specify different inventories (static or dynamic)
support for AWS out of the box
lots of available modules, see ansible docs
CONSUL
for service discovery and configuration management
one binary (thx Go!)
offers DNS and HTTP interfaces (we're using the HTTP
interface)
CONSUL (2)
Supports registering services via config file:
{
"service": {
"name": "elasticsearch",
"tags": [],
"port": 9200,
"check": {
"script": "nc -z -w2 localhost 9200 || exit 2",
"interval": "30s"
}
}
}
We use this for our self-hosted services (Elasticsearch).
CONSUL (3)
and via REST api:
curl -X PUT -d '{
"Datacenter": "dc1",
"Node": "psql-production.cz123xt6fab.eu-west-1.rds.amazonaws.com",
"Address": "10.11.12.13",
"Service": {"Service": "postgres", "Port": 5432}' 
http://127.0.0.1:8500/v1/catalog/register"
We use this for the AWS-hosted services (PostgreSQL, Redis).
RUN-STUFFLE
simple ruby script to make starting containers more
convenient
$ run-stuffle -i
deploy@cb338f9f93f0:/app$ rails c
Loading development environment (Rails 4.2.0)
irb(main):001:0>
RUN-STUFFLE (2) - CONFIG FILE
{"default_docker_args": "-e FQDN=stuffle.it -w /app -e RAILS_ENV=production",
"commands":
{"api_server":
{"command": "service/api_server/run",
"docker_args": "-p 8081:8080",
"name": "api_server",
"logdir": "/var/log/stuffle/api_server"},
...
"workers":
{"command": "service/workers/run",
"logdir": "/var/log/stuffle/workers",
"name": "workers",
"docker_args": "-e WORKER_COUNT=5"}}}
RUN-STUFFLE (3)
fetch application config from consul
fetch service hosts from consul
starts the docker container with parameters (e.g. port
mapping, env settings)
INSIDE THE DOCKER CONTAINER
not aware of consul (at the moment)
read the configuration and services from environment
variables
write /app/config/database.yml, etc.
run the configured start command (we don't use a full-
blown init)
webserver
resque worker
resque scheduler
DEV ENVIRONMENT
using
source directory is synced to VM via synced folders and
bind-mounted to the docker container
vagrant
DEMO
service discovery via consul
run-stuffle
TESTING
test runs on our CI server (jenkins) are triggered by git
push or pull-request
builds new container
starts dependent service containers (PostgreSQL,
Redis, chromedriver)
uses port ranges for parallel builds
runs tests
shuts down containers
pushes image to our registry
DEPLOYMENT
done via ansible and a deployment playbook
- hosts: application_servers:worker_servers
tasks:
- name: login to docker registry
command: sudo su deploy -c "docker login -e ... -u registry -p {{docker
- name: pull the current container
command: sudo su deploy -c "docker pull {{docker_api_container}}"
- hosts: application_servers[0]
tasks:
- name: execute database migrations
command: sudo su deploy -c "run-stuffle -c {{docker_api_container}} bun
- include: restart_containers.yml
DEPLOYMENT (2)
for workers:
- hosts: worker_servers
tasks:
- service: name=stuffle_workers state=restarted
upstart file:
...
post-stop script
docker kill -s QUIT $CONTAINER
sleep 15 # wait for jobs to finish
docker stop $CONTAINER
docker rm $CONTAINER || true
end script
DEPLOYMENT (3)
for web servers:
start a second container with the new code
make warm up request
shut down old container
haproxy balances in front of the two containers
EXPERIENCE SO FAR
very happy with docker, ansible and consul
took some time to setup dev environment that doesn't
get into your way (avoid docker builds)
running different versions of the application in parallel is
great for debugging
QUESTIONS?
THANK YOU!

More Related Content

What's hot

Docker & FieldAware
Docker & FieldAwareDocker & FieldAware
Docker & FieldAware
Jakub Jarosz
 

What's hot (20)

Docker / Ansible
Docker / AnsibleDocker / Ansible
Docker / Ansible
 
Docker slides
Docker slidesDocker slides
Docker slides
 
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
 
Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1
 
Launching containers with fleet
Launching containers with fleetLaunching containers with fleet
Launching containers with fleet
 
Docker for dev
Docker for devDocker for dev
Docker for dev
 
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4
 
Fun with containers: Use Ansible to build Docker images
Fun with containers: Use Ansible to build Docker imagesFun with containers: Use Ansible to build Docker images
Fun with containers: Use Ansible to build Docker images
 
Automating Kubernetes Environments with Ansible
Automating Kubernetes Environments with AnsibleAutomating Kubernetes Environments with Ansible
Automating Kubernetes Environments with Ansible
 
Docker Ecosystem: Part III - Machine
Docker Ecosystem: Part III - MachineDocker Ecosystem: Part III - Machine
Docker Ecosystem: Part III - Machine
 
Kubernetes: training micro-dragons for a serious battle
Kubernetes: training micro-dragons for a serious battleKubernetes: training micro-dragons for a serious battle
Kubernetes: training micro-dragons for a serious battle
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
 
Docker & FieldAware
Docker & FieldAwareDocker & FieldAware
Docker & FieldAware
 
Microservices on Kubernetes - The simple way
Microservices on Kubernetes - The simple wayMicroservices on Kubernetes - The simple way
Microservices on Kubernetes - The simple way
 
Very Early Review - Rocket(CoreOS)
Very Early Review - Rocket(CoreOS)Very Early Review - Rocket(CoreOS)
Very Early Review - Rocket(CoreOS)
 
ABCing docker with environments - workshop
ABCing docker with environments - workshopABCing docker with environments - workshop
ABCing docker with environments - workshop
 
GDG Lima - Docker Compose
GDG Lima - Docker ComposeGDG Lima - Docker Compose
GDG Lima - Docker Compose
 
From Docker Run To Docker Compose
From Docker Run To Docker ComposeFrom Docker Run To Docker Compose
From Docker Run To Docker Compose
 
Docker Compose and Panamax - ContainerDays Boston - June 2015
Docker Compose and Panamax - ContainerDays Boston - June 2015Docker Compose and Panamax - ContainerDays Boston - June 2015
Docker Compose and Panamax - ContainerDays Boston - June 2015
 
Docker 101
Docker 101Docker 101
Docker 101
 

Viewers also liked

Jaime Torres Bodet.
Jaime Torres Bodet.Jaime Torres Bodet.
Jaime Torres Bodet.
AnnyMellark
 
Все для вас
Все для васВсе для вас
Все для вас
adrian3513
 
Yimei chan's data analysis work
Yimei chan's data analysis workYimei chan's data analysis work
Yimei chan's data analysis work
yimeichan
 
Altria Analysis- Cassie Pennington
Altria Analysis- Cassie PenningtonAltria Analysis- Cassie Pennington
Altria Analysis- Cassie Pennington
Cassandra Pennington
 

Viewers also liked (18)

private loan PAID - not the loan/servicer
private loan PAID - not the loan/servicerprivate loan PAID - not the loan/servicer
private loan PAID - not the loan/servicer
 
Security alarm application droidcon tunisia challenge 2015
Security alarm application droidcon tunisia challenge 2015Security alarm application droidcon tunisia challenge 2015
Security alarm application droidcon tunisia challenge 2015
 
Bird Protection Nets
Bird Protection NetsBird Protection Nets
Bird Protection Nets
 
Il pendolo
Il pendoloIl pendolo
Il pendolo
 
Gli strumenti del mestiere del contabile Rev-2015
Gli strumenti del mestiere del contabile Rev-2015Gli strumenti del mestiere del contabile Rev-2015
Gli strumenti del mestiere del contabile Rev-2015
 
How To Make Antler Art
How To Make Antler ArtHow To Make Antler Art
How To Make Antler Art
 
Death
DeathDeath
Death
 
Jaime Torres Bodet.
Jaime Torres Bodet.Jaime Torres Bodet.
Jaime Torres Bodet.
 
Paul bochko portfolio 4 copy
Paul bochko portfolio 4 copyPaul bochko portfolio 4 copy
Paul bochko portfolio 4 copy
 
Untitled Presentation
Untitled PresentationUntitled Presentation
Untitled Presentation
 
Все для вас
Все для васВсе для вас
Все для вас
 
святитель феофан в орле
святитель феофан в орлесвятитель феофан в орле
святитель феофан в орле
 
Yimei chan's data analysis work
Yimei chan's data analysis workYimei chan's data analysis work
Yimei chan's data analysis work
 
8
88
8
 
Paul Bochko portfolio 4 copy
Paul Bochko portfolio 4 copyPaul Bochko portfolio 4 copy
Paul Bochko portfolio 4 copy
 
Forever Living - Programma Detox C9
Forever Living - Programma Detox C9Forever Living - Programma Detox C9
Forever Living - Programma Detox C9
 
Wisc-r Testi
Wisc-r TestiWisc-r Testi
Wisc-r Testi
 
Altria Analysis- Cassie Pennington
Altria Analysis- Cassie PenningtonAltria Analysis- Cassie Pennington
Altria Analysis- Cassie Pennington
 

Similar to How Stuffle uses Docker for deployments

Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in Production
Docker, Inc.
 

Similar to How Stuffle uses Docker for deployments (20)

Containers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioContainers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific Trio
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
 
Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in Production
 
Docker Basic to Advance
Docker Basic to AdvanceDocker Basic to Advance
Docker Basic to Advance
 
Docker Starter Pack
Docker Starter PackDocker Starter Pack
Docker Starter Pack
 
Scala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouScala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camou
 
ILM - Pipeline in the cloud
ILM - Pipeline in the cloudILM - Pipeline in the cloud
ILM - Pipeline in the cloud
 
Shipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with DockerShipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with Docker
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloud
 
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e JavaCome costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
 
ContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small businessContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small business
 
Docker @ FOSS4G 2016, Bonn
Docker @ FOSS4G 2016, BonnDocker @ FOSS4G 2016, Bonn
Docker @ FOSS4G 2016, Bonn
 
Accelerate your development with Docker
Accelerate your development with DockerAccelerate your development with Docker
Accelerate your development with Docker
 
Accelerate your software development with Docker
Accelerate your software development with DockerAccelerate your software development with Docker
Accelerate your software development with Docker
 
How to _docker
How to _dockerHow to _docker
How to _docker
 
Architecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based DeploymentsArchitecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based Deployments
 
Docker 101
Docker 101 Docker 101
Docker 101
 
Up and running with docker
Up and running with dockerUp and running with docker
Up and running with docker
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 

How Stuffle uses Docker for deployments

  • 1. DOCKER @ STUFFLE Robin Brandt / @rob_b
  • 2. ABOUT ME lead developer @ Stuffle since fall 2012 mostly working on the backend
  • 3. ABOUT STUFFLE mobile marketplace for classifieds founded 2012 in Hamburg since 2014 part of Immobilienscout24 Group
  • 4. PLATFORMS iOS, Android, Web (in order of appearance)
  • 5.
  • 6. THE STUFFLE BACKEND Rails app hosted on AWS using PostgreSQL (RDS), Elasticsearch (self-hosted), Redis (ElastiCache), Elastic Load Balancer
  • 7. MANAGING THE INFRASTRUCTURE provisioning must be scripted, no manual installations scripts are executable documentation, can be versioned use the exact same scripts to setup development, staging and production
  • 8. AND DOCKER? discovered Docker in late 2013 loved the idea of containerization especially cool: running the exact same code in tests, staging and production running in production since 09/2014
  • 9. COREOS / KUBERNETES / SWARM / MESOS / ...? haven't looked at it in depth, yet interesting ecosystem growing around containerization wanted to start somewhere simple would love to have the problems some of these tools are solving
  • 10. TOOLS WE'RE USING ansible sets up and provisions the environment consul runs on every server and does service discovery and stores application configuration the application code is run in docker containers via a 40 line ruby script creatively called run-stuffle
  • 11.
  • 12. ANSIBLE no special "agent" needed on nodes provisioning is described in playbooks (YAML files) - hosts: application_servers:worker_servers roles: - docker - td_agent - stuffle-api - monit A task file: - name: configure log rotation template: src=stuffle.logrotate dest=/etc/logrotate.d/stuffle - name: copy run script template: src=run-stuffle.j2 dest=/usr/local/bin/run-stuffle mode=0755
  • 13. ANSIBLE (2) can specify different inventories (static or dynamic) support for AWS out of the box lots of available modules, see ansible docs
  • 14.
  • 15. CONSUL for service discovery and configuration management one binary (thx Go!) offers DNS and HTTP interfaces (we're using the HTTP interface)
  • 16. CONSUL (2) Supports registering services via config file: { "service": { "name": "elasticsearch", "tags": [], "port": 9200, "check": { "script": "nc -z -w2 localhost 9200 || exit 2", "interval": "30s" } } } We use this for our self-hosted services (Elasticsearch).
  • 17. CONSUL (3) and via REST api: curl -X PUT -d '{ "Datacenter": "dc1", "Node": "psql-production.cz123xt6fab.eu-west-1.rds.amazonaws.com", "Address": "10.11.12.13", "Service": {"Service": "postgres", "Port": 5432}' http://127.0.0.1:8500/v1/catalog/register" We use this for the AWS-hosted services (PostgreSQL, Redis).
  • 18. RUN-STUFFLE simple ruby script to make starting containers more convenient $ run-stuffle -i deploy@cb338f9f93f0:/app$ rails c Loading development environment (Rails 4.2.0) irb(main):001:0>
  • 19. RUN-STUFFLE (2) - CONFIG FILE {"default_docker_args": "-e FQDN=stuffle.it -w /app -e RAILS_ENV=production", "commands": {"api_server": {"command": "service/api_server/run", "docker_args": "-p 8081:8080", "name": "api_server", "logdir": "/var/log/stuffle/api_server"}, ... "workers": {"command": "service/workers/run", "logdir": "/var/log/stuffle/workers", "name": "workers", "docker_args": "-e WORKER_COUNT=5"}}}
  • 20. RUN-STUFFLE (3) fetch application config from consul fetch service hosts from consul starts the docker container with parameters (e.g. port mapping, env settings)
  • 21. INSIDE THE DOCKER CONTAINER not aware of consul (at the moment) read the configuration and services from environment variables write /app/config/database.yml, etc. run the configured start command (we don't use a full- blown init) webserver resque worker resque scheduler
  • 22. DEV ENVIRONMENT using source directory is synced to VM via synced folders and bind-mounted to the docker container vagrant
  • 23. DEMO service discovery via consul run-stuffle
  • 24. TESTING test runs on our CI server (jenkins) are triggered by git push or pull-request builds new container starts dependent service containers (PostgreSQL, Redis, chromedriver) uses port ranges for parallel builds runs tests shuts down containers pushes image to our registry
  • 25. DEPLOYMENT done via ansible and a deployment playbook - hosts: application_servers:worker_servers tasks: - name: login to docker registry command: sudo su deploy -c "docker login -e ... -u registry -p {{docker - name: pull the current container command: sudo su deploy -c "docker pull {{docker_api_container}}" - hosts: application_servers[0] tasks: - name: execute database migrations command: sudo su deploy -c "run-stuffle -c {{docker_api_container}} bun - include: restart_containers.yml
  • 26. DEPLOYMENT (2) for workers: - hosts: worker_servers tasks: - service: name=stuffle_workers state=restarted upstart file: ... post-stop script docker kill -s QUIT $CONTAINER sleep 15 # wait for jobs to finish docker stop $CONTAINER docker rm $CONTAINER || true end script
  • 27. DEPLOYMENT (3) for web servers: start a second container with the new code make warm up request shut down old container haproxy balances in front of the two containers
  • 28. EXPERIENCE SO FAR very happy with docker, ansible and consul took some time to setup dev environment that doesn't get into your way (avoid docker builds) running different versions of the application in parallel is great for debugging