SlideShare a Scribd company logo
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)
How Stuffle uses Docker for deployments
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
How Stuffle uses Docker for deployments
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
How Stuffle uses Docker for deployments
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

DOCX
Docker consul-registrator
laonap166
 
PPTX
Into to Docker (Central PA Java User Group - 8/14/2017)
Mike Melusky
 
PDF
Automatic docker service announcement with registrator and confd
충섭 김
 
PDF
Dockerを使おう
Naohiro Kurihara
 
PDF
Rails in docker
Andrew Klotz
 
PPTX
Docker presentation
Shankar Chaudhary
 
PDF
Docker tutorial2
Tatsuya Yagi
 
PPTX
Docker
Amin Arab
 
Docker consul-registrator
laonap166
 
Into to Docker (Central PA Java User Group - 8/14/2017)
Mike Melusky
 
Automatic docker service announcement with registrator and confd
충섭 김
 
Dockerを使おう
Naohiro Kurihara
 
Rails in docker
Andrew Klotz
 
Docker presentation
Shankar Chaudhary
 
Docker tutorial2
Tatsuya Yagi
 
Docker
Amin Arab
 

What's hot (20)

PDF
Docker / Ansible
Stephane Manciot
 
PPTX
Docker slides
Ayla Khan
 
PDF
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
DevDay Dresden
 
PPTX
Academy PRO: Docker. Part 1
Binary Studio
 
PDF
Launching containers with fleet
충섭 김
 
PPTX
Docker for dev
Yusuf Found
 
PPTX
Academy PRO: Docker. Part 4
Binary Studio
 
PDF
Fun with containers: Use Ansible to build Docker images
abadger1999
 
PDF
Automating Kubernetes Environments with Ansible
Timothy Appnel
 
PPTX
Docker Ecosystem: Part III - Machine
Mario IC
 
PDF
Kubernetes: training micro-dragons for a serious battle
Amir Moghimi
 
PPTX
Academy PRO: Docker. Part 2
Binary Studio
 
PDF
Docker & FieldAware
Jakub Jarosz
 
PDF
Microservices on Kubernetes - The simple way
Suraj Deshmukh
 
PDF
Very Early Review - Rocket(CoreOS)
충섭 김
 
PPTX
ABCing docker with environments - workshop
VodqaBLR
 
PDF
GDG Lima - Docker Compose
Mario IC
 
PDF
From Docker Run To Docker Compose
Fitra Aditya
 
PDF
Docker Compose and Panamax - ContainerDays Boston - June 2015
Jonas Rosland
 
PDF
Docker 101
NSConclave
 
Docker / Ansible
Stephane Manciot
 
Docker slides
Ayla Khan
 
Dev Day 2019: Mirko Seifert – Next Level Integration Testing mit Docker und T...
DevDay Dresden
 
Academy PRO: Docker. Part 1
Binary Studio
 
Launching containers with fleet
충섭 김
 
Docker for dev
Yusuf Found
 
Academy PRO: Docker. Part 4
Binary Studio
 
Fun with containers: Use Ansible to build Docker images
abadger1999
 
Automating Kubernetes Environments with Ansible
Timothy Appnel
 
Docker Ecosystem: Part III - Machine
Mario IC
 
Kubernetes: training micro-dragons for a serious battle
Amir Moghimi
 
Academy PRO: Docker. Part 2
Binary Studio
 
Docker & FieldAware
Jakub Jarosz
 
Microservices on Kubernetes - The simple way
Suraj Deshmukh
 
Very Early Review - Rocket(CoreOS)
충섭 김
 
ABCing docker with environments - workshop
VodqaBLR
 
GDG Lima - Docker Compose
Mario IC
 
From Docker Run To Docker Compose
Fitra Aditya
 
Docker Compose and Panamax - ContainerDays Boston - June 2015
Jonas Rosland
 
Docker 101
NSConclave
 
Ad

Viewers also liked (18)

PDF
private loan PAID - not the loan/servicer
PNSS Juanita Gorgona
 
PPTX
Security alarm application droidcon tunisia challenge 2015
sahar dridi
 
PPSX
Bird Protection Nets
Reach Netting Solutions Pvt. Ltd
 
PPT
Il pendolo
cat_mar2000
 
PDF
Gli strumenti del mestiere del contabile Rev-2015
Stefania Pucci
 
PDF
How To Make Antler Art
trayerwilderness
 
DOC
Death
Tristine Thomas
 
PDF
Jaime Torres Bodet.
AnnyMellark
 
PPTX
Paul bochko portfolio 4 copy
Paul Bochko
 
PDF
Untitled Presentation
Daniela Ambros
 
PDF
Все для вас
adrian3513
 
PPT
святитель феофан в орле
Нина Степанова
 
PPTX
Yimei chan's data analysis work
yimeichan
 
PPTX
Paul Bochko portfolio 4 copy
Paul Bochko
 
PDF
Forever Living - Programma Detox C9
FaBenessere
 
PDF
Wisc-r Testi
Özgür Özgür
 
DOCX
Altria Analysis- Cassie Pennington
Cassandra Pennington
 
private loan PAID - not the loan/servicer
PNSS Juanita Gorgona
 
Security alarm application droidcon tunisia challenge 2015
sahar dridi
 
Bird Protection Nets
Reach Netting Solutions Pvt. Ltd
 
Il pendolo
cat_mar2000
 
Gli strumenti del mestiere del contabile Rev-2015
Stefania Pucci
 
How To Make Antler Art
trayerwilderness
 
Jaime Torres Bodet.
AnnyMellark
 
Paul bochko portfolio 4 copy
Paul Bochko
 
Untitled Presentation
Daniela Ambros
 
Все для вас
adrian3513
 
святитель феофан в орле
Нина Степанова
 
Yimei chan's data analysis work
yimeichan
 
Paul Bochko portfolio 4 copy
Paul Bochko
 
Forever Living - Programma Detox C9
FaBenessere
 
Wisc-r Testi
Özgür Özgür
 
Altria Analysis- Cassie Pennington
Cassandra Pennington
 
Ad

Similar to How Stuffle uses Docker for deployments (20)

PDF
Docker Online Meetup #3: Docker in Production
Docker, Inc.
 
PDF
Shipping Applications to Production in Containers with Docker
Jérôme Petazzoni
 
PPTX
Docker based Architecture by Denys Serdiuk
Lohika_Odessa_TechTalks
 
PDF
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
PROIDEA
 
PDF
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Erica Windisch
 
PDF
Docker 0.11 at MaxCDN meetup in Los Angeles
Jérôme Petazzoni
 
PDF
Continuous Delivery: The Next Frontier
Carlos Sanchez
 
PDF
Butter bei die Fische - Ein Jahr Entwicklung und Produktion mit Docker
johannesunterstein
 
PDF
Dockercon EU 2014
Rafe Colton
 
PDF
Containers, Docker, and Microservices: the Terrific Trio
Jérôme Petazzoni
 
PDF
Containerization Is More than the New Virtualization
C4Media
 
PDF
From development environments to production deployments with Docker, Compose,...
Jérôme Petazzoni
 
PPTX
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
Docker, Inc.
 
PPTX
Docker - Demo on PHP Application deployment
Arun prasath
 
PDF
Docker-v3.pdf
Bruno Cornec
 
PDF
Killer Docker Workflows for Development
Chris Tankersley
 
PDF
Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up
Jérôme Petazzoni
 
PDF
JOSA TechTalk: Taking Docker to Production
Jordan Open Source Association
 
PDF
Techtalks: taking docker to production
muayyad alsadi
 
PPTX
State of the Container Ecosystem
Vinay Rao
 
Docker Online Meetup #3: Docker in Production
Docker, Inc.
 
Shipping Applications to Production in Containers with Docker
Jérôme Petazzoni
 
Docker based Architecture by Denys Serdiuk
Lohika_Odessa_TechTalks
 
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
PROIDEA
 
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Erica Windisch
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Jérôme Petazzoni
 
Continuous Delivery: The Next Frontier
Carlos Sanchez
 
Butter bei die Fische - Ein Jahr Entwicklung und Produktion mit Docker
johannesunterstein
 
Dockercon EU 2014
Rafe Colton
 
Containers, Docker, and Microservices: the Terrific Trio
Jérôme Petazzoni
 
Containerization Is More than the New Virtualization
C4Media
 
From development environments to production deployments with Docker, Compose,...
Jérôme Petazzoni
 
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
Docker, Inc.
 
Docker - Demo on PHP Application deployment
Arun prasath
 
Docker-v3.pdf
Bruno Cornec
 
Killer Docker Workflows for Development
Chris Tankersley
 
Docker Intro at the Google Developer Group and Google Cloud Platform Meet Up
Jérôme Petazzoni
 
JOSA TechTalk: Taking Docker to Production
Jordan Open Source Association
 
Techtalks: taking docker to production
muayyad alsadi
 
State of the Container Ecosystem
Vinay Rao
 

Recently uploaded (20)

PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Doc9.....................................
SofiaCollazos
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 

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)
  • 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
  • 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
  • 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