SlideShare a Scribd company logo
A bitcoin broker
on Docker
Mathieu Buffenoir
@MBuffenoir
Sebastien Goasguen
@sebgoa
1
Mathieu Buffenoir
CTO Bity.com
VP of Swiss Bitcoin Association
@MBuffenoir
Sebastien Goasguen
VP Apache CloudStack
Author of O’Reilly Docker cookbook
@sebgoa
Outline
What is Bity ?
From nothing to Docker
Docker-compose in dev env
Ansible for cloud providers
Ansible for docker orchestration
Lessons learned
Future
4
What is Bity ?
Buy, sell and store
bitcoins
Regulated
Small team
hosted in Switzerland
fast-moving space
5
6
Our needs
Follow the “Twelve factor” app
recommendations.
Scalable, CI/CD -> Docker
Cloud (Paas) + Hosted in Switzerland ->
Exoscale
Our tech stack
8
Infrastructure design
9
Zero to Prod in 8 months ?
“It works on my machine” syndrome
10
Increase team collaboration
Gain Velocity
w/
Increased reproducibility
Easy portability
Difficulty on-boarding developers
Difficulty developing across team due to time to setup
environment
Teams working on different part of the infrastructure
Challenges to gain velocity
Steps
Nothing to Docker
Code on developer laptop with custom environment
Zero portability (i.e /source/tree )
Use of Vagrant box
Reproducibility of development environment (i.e /
source/tree/Vagrantfile )
Use of Vagrant box and Docker
Build image for applications and publish for
collaboration (i.e /source/tree/Dockerfile
+Vagrantfile)
$ docker build -t sbex/bity .

$ docker run -d -p 80:80 sbex/bity
Private repositories on Bitbucket
Private repositories on Docker Hub
Automated builds
Web Hooks from Bitbucket to Docker hub
Web Hooks from DockerHub to Jenkins
Docker Hub
dev server:
$ docker-compose up
CI/CD for dev
16
One docker-compose file to deploy entire infra
Great for developers and testing
Used to test parts of applications with latest image
from repo
Used prior to merging in staging
Docker-compose for dev env
17
Impossible to run command inside containers
How to deal with secrets ?
At the time, no Swarm so compose was a single host
dev tool
Limitations of compose
18
Going to production in the cloud
19
Choosing a Cloud and “config” tool
Need a Swiss sovereign cloud
Need a tool to configure:
security groups
key pairs
manage instances
Not a configuration management tool to deploy apps.
Dev (server or laptop + docker-compose) on bitcoin-testnet
Staging (cloudstack + ansible) on bitcoin-testnet
Prod (cloudstack + ansible) on bitcoin-mainnet
separate branches for code and different image tags
20
Environments
$ git merge dev
staging tags
$ ansible-playbook deploy.yml
staging environment
Deploying on staging env
22
Create Cloud Infrastructure at Will
- name: Start Backend VM
local_action:
module: cloudstack_vm
name: backendpublic
template: "{{ template }}"
service_offering: "{{ instance_type }}"
security_groups: [ 'backend_public' ]
ssh_key: "{{ ssh_key }}"
user_data: "{{ lookup('file', '../files/backend_userdata.yml') }}"
register: backend_public
tags: create_vm
Ansible CloudStack module
- name: backend SecGroup
local_action:
module: cloudstack_sg
name: database
description: Backend public
tags: secgroup
24
Ansible Docker module in Ansible core
Deploying/Managing containers with
Ansible
25
- name: Set Docker login credentials
command: docker login -u foobar -e {{ hub_email }} --
password={{ hub_password }}
- name: Docker pull sbex/angular-frontend
command: docker pull sbex/angular-frontend
- name: Start bity
docker:
image: sbex/angular-frontend
detach: true
restart_policy: always
name: bity
ports: 80:80
tags: start_container
Ansible docker module
26
Ansible and logdriver
- name: Start backend public
docker:
name: backend
image: sbex/backend
restart_policy: always
volumes:
- /app/_env:/usr/src/app/_env:ro
detach: true
ports: 8000:8000
log_driver: syslog
log_opt:
syslog-address: udp://{{hostvars['logserver'].ansible_ssh_host}}:5000
syslog-facility: local0
syslog-tag: backendpublic
27
Ansible to configure containers
- name: Create directory for settings
file: path=/app/_env state=directory
- name: Create json settings from template
template: src=env.j2 dest=/app/_env/env.json
...
- name: Create tables
command: docker exec -ti backend ./manage.py migrate
28
Dealing with secrets
No secrets in container images
Use Ansible vault to encrypt all secrets in playbooks stored in bitbucket
$ ansible-vault create /path/to/file.yml
$ ansible-vault encrypt /path/to/file.yml
$ ansible-vault decrypt /path/to/file.yml
$ ansible-vault rekey /path/to/file.yml
29
Container “Orchestration”
Every application has its role
Several playbooks
$ ansible-playbook deploy.yml
$ ansible-playbook upgrade.yml
$ ansible-playbook stop.yml
$ ansible-playbook start.yml
30
Early on:
Logspout to ELK
Now:
Logdriver (ansible 2.0) syslog driver to logstash with ELK
Test/deploy monitoring with docker-compose.
Logging
31
ElasticSearch 1.7 (+data container)
Logstash 1.5.3 (+conf for elk logs)
Kibana 4 (+Dashboard for elk logs)
cAdvisor (Collect & View containers performance)
Ngnix Proxy 1.9.3 (for SSL + password access).
One docker-compose runs
32
33
Container restart -> thanks to restart policy (docker > 1.6)
Weird Ansible docker behavior at times
Config as volume mounts (Too many env variables to handle)
Cannot use compose in prod yet (vault, execute commands
inside containers )
Lessons Learned
34
Currently using Ubuntu 14.04
Investigate the use of Docker optimized OS (e.g coreOS,
Atomic, RancherOS)
Need Easy upgrade of Docker versions
With new versions every 2 months, and possible change of
recommended storage driver, we need an easy way to cleanly
upgrade production systems
Investigate the use of a Docker orchestrator, possible
replacing Ansible docker module
(e.g Swarm, Kubernetes, tutum…)
Future
Thank you!MATHIEU BUFFENOIR
@MBuffenoir

mathieu@bity.com
@sebgoa

runseb@gmail.com
SEBASTIEN GOASGUEN

More Related Content

What's hot (20)

PDF
Configuration Management and Transforming Legacy Applications in the Enterpri...
Docker, Inc.
 
PPTX
DockerCon EU 2015: Speed Up Deployment: Building a Distributed Docker Registr...
Docker, Inc.
 
PDF
DCSF19 How To Build Your Containerization Strategy
Docker, Inc.
 
PPTX
Docker Container As A Service - March 2016
Patrick Chanezon
 
PDF
Docker for developers on mac and windows
Docker, Inc.
 
PPTX
Windows Server Containers- How we hot here and architecture deep dive
Docker, Inc.
 
PDF
Automatically Renew Certificated In Your Kubernetes Cluster
HungWei Chiu
 
PDF
Docker on Google App Engine
Docker, Inc.
 
PDF
Docker Multi-arch All The Things
Docker, Inc.
 
PDF
Online Meetup: Why should container system / platform builders care about con...
Docker, Inc.
 
PPTX
Docker Online Meetup: Announcing Docker CE + EE
Docker, Inc.
 
PDF
Docker to the Rescue of an Ops Team
Rachid Zarouali
 
PDF
It takes a Village to do the Impossible - Jeff Lindsay
Docker, Inc.
 
PDF
Docker for Ops - Scott Coulton, Puppet
Docker, Inc.
 
PDF
Deeper Dive in Docker Overlay Networks
Docker, Inc.
 
PDF
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
Docker, Inc.
 
PDF
Docker for Devs - John Zaccone, IBM
Docker, Inc.
 
PDF
Docker for Java Developers - Fabiane Nardon and Arun gupta
Docker, Inc.
 
PDF
Docker Security Deep Dive by Ying Li and David Lawrence
Docker, Inc.
 
PDF
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
Mike Goelzer
 
Configuration Management and Transforming Legacy Applications in the Enterpri...
Docker, Inc.
 
DockerCon EU 2015: Speed Up Deployment: Building a Distributed Docker Registr...
Docker, Inc.
 
DCSF19 How To Build Your Containerization Strategy
Docker, Inc.
 
Docker Container As A Service - March 2016
Patrick Chanezon
 
Docker for developers on mac and windows
Docker, Inc.
 
Windows Server Containers- How we hot here and architecture deep dive
Docker, Inc.
 
Automatically Renew Certificated In Your Kubernetes Cluster
HungWei Chiu
 
Docker on Google App Engine
Docker, Inc.
 
Docker Multi-arch All The Things
Docker, Inc.
 
Online Meetup: Why should container system / platform builders care about con...
Docker, Inc.
 
Docker Online Meetup: Announcing Docker CE + EE
Docker, Inc.
 
Docker to the Rescue of an Ops Team
Rachid Zarouali
 
It takes a Village to do the Impossible - Jeff Lindsay
Docker, Inc.
 
Docker for Ops - Scott Coulton, Puppet
Docker, Inc.
 
Deeper Dive in Docker Overlay Networks
Docker, Inc.
 
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
Docker, Inc.
 
Docker for Devs - John Zaccone, IBM
Docker, Inc.
 
Docker for Java Developers - Fabiane Nardon and Arun gupta
Docker, Inc.
 
Docker Security Deep Dive by Ying Li and David Lawrence
Docker, Inc.
 
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
Mike Goelzer
 

Viewers also liked (20)

PPTX
DockerCon EU 2015: Placing a container on a train at 200mph
Docker, Inc.
 
PPSX
Metrics at Scale @ UBER (Mantas Klasavicius Technology Stream)
IT Arena
 
PDF
Stream Processing with Kafka in Uber, Danny Yuan
confluent
 
PPTX
UBER Human Resource
Divyae Sherry
 
PPTX
Kafka + Uber- The World’s Realtime Transit Infrastructure, Aaron Schildkrout
confluent
 
PDF
Spark: Interactive To Production
Jen Aman
 
PPTX
Open source is good for both business and humanity
Docker, Inc.
 
PPTX
The Future of Hardware-Backed Keys
Docker, Inc.
 
PDF
Containerize All the (Multi-Platform) Things! by Phil Estes
Docker, Inc.
 
PDF
DockerCon 2015: Docker Engine Breakout Session
Docker, Inc.
 
PPTX
DockerCon14 John Engates
Docker, Inc.
 
PDF
LXC Docker and the Future of Software Delivery
Docker, Inc.
 
PDF
Victor Vieux at Docker Paris Meetup #1
Docker, Inc.
 
PPTX
DockerCon SF 2015: Networking Breakout
Docker, Inc.
 
PDF
DockerCon SF 2015: How to Build a Secure DevOps Environment for the Government
Docker, Inc.
 
PPTX
DockerCon SF 2015: Orchestration for Devs (machine + compose)
Docker, Inc.
 
PDF
Contribute and Collaborate 101
Docker, Inc.
 
PDF
Securing your Containers (Meetup at Docker HQ 4/7)
Docker, Inc.
 
PPTX
DockerCon SF 2015: MomOps in DevOps w/ Mukta Aphale
Docker, Inc.
 
PPTX
Dockerfile Basics Workshop #1
Docker, Inc.
 
DockerCon EU 2015: Placing a container on a train at 200mph
Docker, Inc.
 
Metrics at Scale @ UBER (Mantas Klasavicius Technology Stream)
IT Arena
 
Stream Processing with Kafka in Uber, Danny Yuan
confluent
 
UBER Human Resource
Divyae Sherry
 
Kafka + Uber- The World’s Realtime Transit Infrastructure, Aaron Schildkrout
confluent
 
Spark: Interactive To Production
Jen Aman
 
Open source is good for both business and humanity
Docker, Inc.
 
The Future of Hardware-Backed Keys
Docker, Inc.
 
Containerize All the (Multi-Platform) Things! by Phil Estes
Docker, Inc.
 
DockerCon 2015: Docker Engine Breakout Session
Docker, Inc.
 
DockerCon14 John Engates
Docker, Inc.
 
LXC Docker and the Future of Software Delivery
Docker, Inc.
 
Victor Vieux at Docker Paris Meetup #1
Docker, Inc.
 
DockerCon SF 2015: Networking Breakout
Docker, Inc.
 
DockerCon SF 2015: How to Build a Secure DevOps Environment for the Government
Docker, Inc.
 
DockerCon SF 2015: Orchestration for Devs (machine + compose)
Docker, Inc.
 
Contribute and Collaborate 101
Docker, Inc.
 
Securing your Containers (Meetup at Docker HQ 4/7)
Docker, Inc.
 
DockerCon SF 2015: MomOps in DevOps w/ Mukta Aphale
Docker, Inc.
 
Dockerfile Basics Workshop #1
Docker, Inc.
 
Ad

Similar to DockerCon EU 2015: Trading Bitcoin with Docker (20)

PDF
2015 DockerCon Using Docker in production at bity.com
Mathieu Buffenoir
 
PPTX
Develop with docker 2014 aug
Vincent De Smet
 
PDF
DCSF 19 Building Your Development Pipeline
Docker, Inc.
 
PDF
Serverless containers … with source-to-image
Josef Adersberger
 
PDF
Serverless Container with Source2Image
QAware GmbH
 
PDF
Mihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti
 
PPTX
Docker Ecosystem on Azure
Patrick Chanezon
 
PPTX
Dockerizing a Symfony2 application
Roman Rodomansky
 
PDF
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
Michael Hofmann
 
PDF
Docker for mere mortals
Henryk Konsek
 
PDF
Real-World Docker: 10 Things We've Learned
RightScale
 
PDF
Continuous Delivery of Cloud Applications with Docker Containers and IBM Bluemix
Florian Georg
 
PDF
Microservices DevOps on Google Cloud Platform
Sunnyvale
 
PDF
Docker intro
Frei Zhang
 
PDF
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Carlos Sanchez
 
PDF
Using Kubernetes for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
PDF
Delivering Docker & K3s worloads to IoT Edge devices
Ajeet Singh Raina
 
PDF
Rooting Out Root: User namespaces in Docker
Phil Estes
 
PDF
Containers, Docker, and Microservices: the Terrific Trio
Jérôme Petazzoni
 
PDF
Kubernetes: training micro-dragons for a serious battle
Amir Moghimi
 
2015 DockerCon Using Docker in production at bity.com
Mathieu Buffenoir
 
Develop with docker 2014 aug
Vincent De Smet
 
DCSF 19 Building Your Development Pipeline
Docker, Inc.
 
Serverless containers … with source-to-image
Josef Adersberger
 
Serverless Container with Source2Image
QAware GmbH
 
Mihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti
 
Docker Ecosystem on Azure
Patrick Chanezon
 
Dockerizing a Symfony2 application
Roman Rodomansky
 
Developer Experience Cloud Native - From Code Gen to Git Commit without a CI/...
Michael Hofmann
 
Docker for mere mortals
Henryk Konsek
 
Real-World Docker: 10 Things We've Learned
RightScale
 
Continuous Delivery of Cloud Applications with Docker Containers and IBM Bluemix
Florian Georg
 
Microservices DevOps on Google Cloud Platform
Sunnyvale
 
Docker intro
Frei Zhang
 
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Carlos Sanchez
 
Using Kubernetes for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
Delivering Docker & K3s worloads to IoT Edge devices
Ajeet Singh Raina
 
Rooting Out Root: User namespaces in Docker
Phil Estes
 
Containers, Docker, and Microservices: the Terrific Trio
Jérôme Petazzoni
 
Kubernetes: training micro-dragons for a serious battle
Amir Moghimi
 
Ad

More from Docker, Inc. (20)

PDF
Containerize Your Game Server for the Best Multiplayer Experience
Docker, Inc.
 
PDF
How to Improve Your Image Builds Using Advance Docker Build
Docker, Inc.
 
PDF
Build & Deploy Multi-Container Applications to AWS
Docker, Inc.
 
PDF
Securing Your Containerized Applications with NGINX
Docker, Inc.
 
PDF
How To Build and Run Node Apps with Docker and Compose
Docker, Inc.
 
PDF
Hands-on Helm
Docker, Inc.
 
PDF
Distributed Deep Learning with Docker at Salesforce
Docker, Inc.
 
PDF
The First 10M Pulls: Building The Official Curl Image for Docker Hub
Docker, Inc.
 
PDF
Monitoring in a Microservices World
Docker, Inc.
 
PDF
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
Docker, Inc.
 
PDF
Predicting Space Weather with Docker
Docker, Inc.
 
PDF
Become a Docker Power User With Microsoft Visual Studio Code
Docker, Inc.
 
PDF
How to Use Mirroring and Caching to Optimize your Container Registry
Docker, Inc.
 
PDF
Monolithic to Microservices + Docker = SDLC on Steroids!
Docker, Inc.
 
PDF
Kubernetes at Datadog Scale
Docker, Inc.
 
PDF
Labels, Labels, Labels
Docker, Inc.
 
PDF
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Docker, Inc.
 
PDF
Build & Deploy Multi-Container Applications to AWS
Docker, Inc.
 
PDF
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
Docker, Inc.
 
PDF
Developing with Docker for the Arm Architecture
Docker, Inc.
 
Containerize Your Game Server for the Best Multiplayer Experience
Docker, Inc.
 
How to Improve Your Image Builds Using Advance Docker Build
Docker, Inc.
 
Build & Deploy Multi-Container Applications to AWS
Docker, Inc.
 
Securing Your Containerized Applications with NGINX
Docker, Inc.
 
How To Build and Run Node Apps with Docker and Compose
Docker, Inc.
 
Hands-on Helm
Docker, Inc.
 
Distributed Deep Learning with Docker at Salesforce
Docker, Inc.
 
The First 10M Pulls: Building The Official Curl Image for Docker Hub
Docker, Inc.
 
Monitoring in a Microservices World
Docker, Inc.
 
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
Docker, Inc.
 
Predicting Space Weather with Docker
Docker, Inc.
 
Become a Docker Power User With Microsoft Visual Studio Code
Docker, Inc.
 
How to Use Mirroring and Caching to Optimize your Container Registry
Docker, Inc.
 
Monolithic to Microservices + Docker = SDLC on Steroids!
Docker, Inc.
 
Kubernetes at Datadog Scale
Docker, Inc.
 
Labels, Labels, Labels
Docker, Inc.
 
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Docker, Inc.
 
Build & Deploy Multi-Container Applications to AWS
Docker, Inc.
 
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
Docker, Inc.
 
Developing with Docker for the Arm Architecture
Docker, Inc.
 

Recently uploaded (20)

PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Per Axbom: The spectacular lies of maps
Nexer Digital
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 

DockerCon EU 2015: Trading Bitcoin with Docker

  • 1. A bitcoin broker on Docker Mathieu Buffenoir @MBuffenoir Sebastien Goasguen @sebgoa 1
  • 2. Mathieu Buffenoir CTO Bity.com VP of Swiss Bitcoin Association @MBuffenoir Sebastien Goasguen VP Apache CloudStack Author of O’Reilly Docker cookbook @sebgoa
  • 3. Outline What is Bity ? From nothing to Docker Docker-compose in dev env Ansible for cloud providers Ansible for docker orchestration Lessons learned Future
  • 4. 4 What is Bity ? Buy, sell and store bitcoins Regulated Small team hosted in Switzerland fast-moving space
  • 5. 5
  • 6. 6 Our needs Follow the “Twelve factor” app recommendations. Scalable, CI/CD -> Docker Cloud (Paas) + Hosted in Switzerland -> Exoscale
  • 9. 9 Zero to Prod in 8 months ?
  • 10. “It works on my machine” syndrome 10 Increase team collaboration Gain Velocity w/ Increased reproducibility Easy portability
  • 11. Difficulty on-boarding developers Difficulty developing across team due to time to setup environment Teams working on different part of the infrastructure Challenges to gain velocity
  • 12. Steps
  • 13. Nothing to Docker Code on developer laptop with custom environment Zero portability (i.e /source/tree ) Use of Vagrant box Reproducibility of development environment (i.e / source/tree/Vagrantfile ) Use of Vagrant box and Docker Build image for applications and publish for collaboration (i.e /source/tree/Dockerfile +Vagrantfile) $ docker build -t sbex/bity .
 $ docker run -d -p 80:80 sbex/bity
  • 14. Private repositories on Bitbucket Private repositories on Docker Hub Automated builds Web Hooks from Bitbucket to Docker hub Web Hooks from DockerHub to Jenkins Docker Hub
  • 15. dev server: $ docker-compose up CI/CD for dev
  • 16. 16 One docker-compose file to deploy entire infra Great for developers and testing Used to test parts of applications with latest image from repo Used prior to merging in staging Docker-compose for dev env
  • 17. 17 Impossible to run command inside containers How to deal with secrets ? At the time, no Swarm so compose was a single host dev tool Limitations of compose
  • 18. 18 Going to production in the cloud
  • 19. 19 Choosing a Cloud and “config” tool Need a Swiss sovereign cloud Need a tool to configure: security groups key pairs manage instances Not a configuration management tool to deploy apps.
  • 20. Dev (server or laptop + docker-compose) on bitcoin-testnet Staging (cloudstack + ansible) on bitcoin-testnet Prod (cloudstack + ansible) on bitcoin-mainnet separate branches for code and different image tags 20 Environments
  • 21. $ git merge dev staging tags $ ansible-playbook deploy.yml staging environment Deploying on staging env
  • 23. - name: Start Backend VM local_action: module: cloudstack_vm name: backendpublic template: "{{ template }}" service_offering: "{{ instance_type }}" security_groups: [ 'backend_public' ] ssh_key: "{{ ssh_key }}" user_data: "{{ lookup('file', '../files/backend_userdata.yml') }}" register: backend_public tags: create_vm Ansible CloudStack module - name: backend SecGroup local_action: module: cloudstack_sg name: database description: Backend public tags: secgroup
  • 24. 24 Ansible Docker module in Ansible core Deploying/Managing containers with Ansible
  • 25. 25 - name: Set Docker login credentials command: docker login -u foobar -e {{ hub_email }} -- password={{ hub_password }} - name: Docker pull sbex/angular-frontend command: docker pull sbex/angular-frontend - name: Start bity docker: image: sbex/angular-frontend detach: true restart_policy: always name: bity ports: 80:80 tags: start_container Ansible docker module
  • 26. 26 Ansible and logdriver - name: Start backend public docker: name: backend image: sbex/backend restart_policy: always volumes: - /app/_env:/usr/src/app/_env:ro detach: true ports: 8000:8000 log_driver: syslog log_opt: syslog-address: udp://{{hostvars['logserver'].ansible_ssh_host}}:5000 syslog-facility: local0 syslog-tag: backendpublic
  • 27. 27 Ansible to configure containers - name: Create directory for settings file: path=/app/_env state=directory - name: Create json settings from template template: src=env.j2 dest=/app/_env/env.json ... - name: Create tables command: docker exec -ti backend ./manage.py migrate
  • 28. 28 Dealing with secrets No secrets in container images Use Ansible vault to encrypt all secrets in playbooks stored in bitbucket $ ansible-vault create /path/to/file.yml $ ansible-vault encrypt /path/to/file.yml $ ansible-vault decrypt /path/to/file.yml $ ansible-vault rekey /path/to/file.yml
  • 29. 29 Container “Orchestration” Every application has its role Several playbooks $ ansible-playbook deploy.yml $ ansible-playbook upgrade.yml $ ansible-playbook stop.yml $ ansible-playbook start.yml
  • 30. 30 Early on: Logspout to ELK Now: Logdriver (ansible 2.0) syslog driver to logstash with ELK Test/deploy monitoring with docker-compose. Logging
  • 31. 31 ElasticSearch 1.7 (+data container) Logstash 1.5.3 (+conf for elk logs) Kibana 4 (+Dashboard for elk logs) cAdvisor (Collect & View containers performance) Ngnix Proxy 1.9.3 (for SSL + password access). One docker-compose runs
  • 32. 32
  • 33. 33 Container restart -> thanks to restart policy (docker > 1.6) Weird Ansible docker behavior at times Config as volume mounts (Too many env variables to handle) Cannot use compose in prod yet (vault, execute commands inside containers ) Lessons Learned
  • 34. 34 Currently using Ubuntu 14.04 Investigate the use of Docker optimized OS (e.g coreOS, Atomic, RancherOS) Need Easy upgrade of Docker versions With new versions every 2 months, and possible change of recommended storage driver, we need an easy way to cleanly upgrade production systems Investigate the use of a Docker orchestrator, possible replacing Ansible docker module (e.g Swarm, Kubernetes, tutum…) Future