SlideShare a Scribd company logo
1 of 34
Download to read offline
Docker and Maestro
For fun, development and profit
Maxime Petazzoni
Software Engineer at SignalFuse, Inc.
(also, Jérôme’s cousin)
!

max@signalfuse.com
Real-time monitoring, instrumentation,
observability and analytics
Still in “stealth” mode
Get updates at www.signalfuse.com
“Docker is awesome!”
–You, some time in the last hour (hopefully).
A versatile foundation
Service or application containment, security, software delivery, host
and environment isolation, …and so much more.
Power at your fingertips
Complete control through the remote API
Available programmatic clients like docker-py
docker:$ docker -d -H tcp://0.0.0.0:4243
!

client:$ cat << EOF | python import docker
from pprint import pprint as pp
pp(docker.client.Client(‘tcp://docker:4243')
.images('quay.io/signalfuse/maestro-base'))
EOF
!
!

[{u’Created': 1391202535,
u’Id': u’37de13d273eb9a02cd64…’,
u’Repository':
u'quay.io/signalfuse/maestro-base',
u'Size': 155663843,
u'Tag': u'0.1.6',
u'VirtualSize': 774767942}]
Docker’s Achilles:
orchestration
Single-host is alright with links, but multi-host just isn’t there.
How do I orchestrate the deployment
and control of a full, multi-host,
Docker-based environment?
(And more importantly:)

How do I make this process one and
the same for development, testing
and production environments?
Enter: Maestro
The totally not scalable, pet project that solved my use case.
(and maybe yours)
Maestro is actually MaestroNG,
a re-invention of Kimbro Staken’s Maestro
(formerly, dockermix)
Takes in a definition of services, their dependencies ,
configuration and target host…
!

…and automates the deployment (and control) of their
corresponding containers on these hosts.
Classic use case: a pool of “dumb” workers on your
favorite cloud/hosting provider that just run Docker.
!

No need to (ma)ssh into anything,
no need to pre-configure anything.
!

Everything is remote controlled.
Other typical use case: running all the components of
your stack in a single, local virtual machine.
!

Useful for development, integration testing, etc.
Philosophy: lightweight application/service containers.
!

Represent and control your software stack
and its dependencies.
!

Docker images are the output of your CI process
(automation!).
!

Start fast, fail faster.
Not for heavyweight, complex container “VMs”.
Each service instance (container) defines where it runs
and which ports it exposes, among other things.
!

Like Docker links, Maestro works by injecting this
information in the container’s environment about each
container’s service’s dependencies.
Let’s say broker-1 of kafka depends on ZooKeeper. Its
environment will contain:
MAESTRO_ENVIRONMENT_NAME = lspe
SERVICE_NAME = kafka
CONTAINER_NAME = broker-1
CONTAINER_HOST_ADDRESS = 192.168.10.2
!
ZOOKEEPER_ZK_NODE_1_HOST = 192.168.10.2
ZOOKEEPER_ZK_NODE_1_CLIENT_PORT = 2181
ZOOKEEPER_ZK_NODE_1_PEER_PORT = 2888
ZOOKEEPER_ZK_NODE_1_LEADER_ELECTION_PORT = 3888
!
KAFKA_BROKER_1_HOST = 192.168.10.2
KAFKA_BROKER_1_BROKER_INTERNAL_PORT = 9042
KAFKA_BROKER_1_BROKER_PORT = 9042
KAFKA_BROKER_1_JMX_INTERNAL_PORT = 7199
KAFKA_BROKER_1_JMX_PORT = 17199
<SERVICE_NAME>_<CONTAINER_NAME>_HOST
<SERVICE_NAME>_<CONTAINER_NAME>_PORT
<SERVICE_NAME>_<CONTAINER_NAME>_INTERNAL_PORT
Using this information, you can configure your
application at container start time.
!

If you like Python, Maestro helps you by providing a set
of guest helper functions in maestro.guestutils to easily
extract and use this data.
#!/usr/bin/env python
!

# This is my cool container’s “init script”
!

import os
from maestro.guestutils import *
!

os.execl(‘java’, ‘java’,
‘-jar’, ‘my-app.jar’,
‘-DlistenPort={}’.format(get_port(‘service’)),
‘-DzkServers={}’.format(
get_node_list(‘zookeeper’, ports=[‘peer’])))
Dependency order is respected on start;
inverse order on stop.
!

Can be overridden to stop individual services or
containers.
MyApp

Start order:
1. ZooKeeper
2. Kafka
3. MyApp

Kafka

ZK

Stop order:
1. MyApp
2. Kafka
3. ZooKeeper

Works on subsets of services too.
So how do you wield
this power?
A bit clunkily, with YAML (and a bit of Jinja2).
!
!
!

(sorry)
# Yay, YAML!
name: lspe
!

registries:
# Define custom image registries for
# private registries, with credentials.
!

ships:
# Declare each target host.
# (Docker daemon locations)
!

services:
# Declare each service, their
# instances, dependencies and
# configuration
registries:
# Quay.io with Maestro robot account
quay.io:
registry: https://quay.io/v1/
email: maestro@signalfuse.com
username: signalfuse+maestro
password: {{ env.SUPER_SECRET }}

When starting a container, Maestro will automatically
login and pull the image from the right place if the image
name matches a configured registry.
ships:
# Local virtual machine
vm:
ip: 192.168.10.2
docker_port: 4243
timeout: 10
# Slow VM is slow
# A shorter form…
vm2: {ip: 192.168.10.3, timeout: 5}

Ships carry containers and are referred to by name in the
configuration.
services:
# ZooKeeper
zookeeper:
image: quay.io/signalfuse/zookeeper:3.4.5
!

# Our zoo isn’t too wild,
# only one keeper is enough.
zk-node-1:
ship: vm
ports:
client: 2181
peer: 2888/tcp
leader_election: “3888/tcp:3888/tcp”
# Keep persistent data on the host.
volumes:
/var/lib/zookeeper: /data/zookeeper
# Environment can be passed-in too.
env:
JVM_FLAGS: “-Xmx1g”
# Kafka
kafka:
image: quay.io/signalfuse/kafka:0.8.0
requires: [ zookeeper ]
env:
ZOOKEEPER_BASE: /lspe/kafka
RETENTION_HOURS: 48
broker-1:
ship: vm
ports: {broker: 9092, jmx: “7199:17199”}
# Keep persistent data on the host.
volumes:
/var/lib/kafka: /data/kafka
env:
BROKER_ID: 0

More flexibility in port mappings, volume bindings, and
environment variables definition not shown here.
See README.md for full
syntax details and features
https://github.com/signalfuse/maestro-ng/blob/master/README.md
Demo time!
Be prepared for it to fail, because demos always do.
What’s next?
More flexible service status detection (not only port pinging)
Soft and hard service dependencies
Parallel startup of independent services and instances of a service
That’s it!
Thanks for listening! :)

github.com/dotcloud/docker-py
github.com/signalfuse/maestro-ng
SignalFuse is hiring
world class engineers!
jobs@signalfuse.com

More Related Content

What's hot

Fluentd and docker monitoring
Fluentd and docker monitoringFluentd and docker monitoring
Fluentd and docker monitoringVinay Krishna
 
Docker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker SwarmDocker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker SwarmDocker, Inc.
 
runC: The little engine that could (run Docker containers) by Docker Captain ...
runC: The little engine that could (run Docker containers) by Docker Captain ...runC: The little engine that could (run Docker containers) by Docker Captain ...
runC: The little engine that could (run Docker containers) by Docker Captain ...Docker, Inc.
 
Docker storage designing a platform for persistent data
Docker storage designing a platform for persistent dataDocker storage designing a platform for persistent data
Docker storage designing a platform for persistent dataDocker, Inc.
 
Kubernetes: Beyond Baby Steps
Kubernetes: Beyond Baby StepsKubernetes: Beyond Baby Steps
Kubernetes: Beyond Baby StepsDigitalOcean
 
Docker swarm introduction
Docker swarm introductionDocker swarm introduction
Docker swarm introductionEvan Lin
 
Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker, Inc.
 
Running & Monitoring Docker at Scale
Running & Monitoring Docker at ScaleRunning & Monitoring Docker at Scale
Running & Monitoring Docker at ScaleDatadog
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetesDongwon Kim
 
The age of orchestration: from Docker basics to cluster management
The age of orchestration: from Docker basics to cluster managementThe age of orchestration: from Docker basics to cluster management
The age of orchestration: from Docker basics to cluster managementNicola Paolucci
 
Swarm docker bangalore_meetup
Swarm docker bangalore_meetupSwarm docker bangalore_meetup
Swarm docker bangalore_meetupArunan Rabindran
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes NetworkingCJ Cullen
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationSuresh Kumar
 
Docker Swarm Introduction
Docker Swarm IntroductionDocker Swarm Introduction
Docker Swarm Introductionrajdeep
 
Deep dive in container service discovery
Deep dive in container service discoveryDeep dive in container service discovery
Deep dive in container service discoveryDocker, Inc.
 
Scaling Microservices with Kubernetes
Scaling Microservices with KubernetesScaling Microservices with Kubernetes
Scaling Microservices with KubernetesDeivid Hahn Fração
 
Container Performance Analysis
Container Performance AnalysisContainer Performance Analysis
Container Performance AnalysisBrendan Gregg
 
Docker Swarm 45-min Workshop (Mountain View Docker Meetup 2/24/2016)
Docker Swarm 45-min Workshop (Mountain View Docker Meetup 2/24/2016)Docker Swarm 45-min Workshop (Mountain View Docker Meetup 2/24/2016)
Docker Swarm 45-min Workshop (Mountain View Docker Meetup 2/24/2016)Mike Goelzer
 

What's hot (20)

Fluentd and docker monitoring
Fluentd and docker monitoringFluentd and docker monitoring
Fluentd and docker monitoring
 
Docker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker SwarmDocker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker Swarm
 
runC: The little engine that could (run Docker containers) by Docker Captain ...
runC: The little engine that could (run Docker containers) by Docker Captain ...runC: The little engine that could (run Docker containers) by Docker Captain ...
runC: The little engine that could (run Docker containers) by Docker Captain ...
 
Docker storage designing a platform for persistent data
Docker storage designing a platform for persistent dataDocker storage designing a platform for persistent data
Docker storage designing a platform for persistent data
 
Kubernetes: Beyond Baby Steps
Kubernetes: Beyond Baby StepsKubernetes: Beyond Baby Steps
Kubernetes: Beyond Baby Steps
 
Docker swarm introduction
Docker swarm introductionDocker swarm introduction
Docker swarm introduction
 
Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker Swarm 0.2.0
Docker Swarm 0.2.0
 
Running & Monitoring Docker at Scale
Running & Monitoring Docker at ScaleRunning & Monitoring Docker at Scale
Running & Monitoring Docker at Scale
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetes
 
The age of orchestration: from Docker basics to cluster management
The age of orchestration: from Docker basics to cluster managementThe age of orchestration: from Docker basics to cluster management
The age of orchestration: from Docker basics to cluster management
 
Swarm docker bangalore_meetup
Swarm docker bangalore_meetupSwarm docker bangalore_meetup
Swarm docker bangalore_meetup
 
Beginning mesos
Beginning mesosBeginning mesos
Beginning mesos
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes Networking
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
London HUG 12/4
London HUG 12/4London HUG 12/4
London HUG 12/4
 
Docker Swarm Introduction
Docker Swarm IntroductionDocker Swarm Introduction
Docker Swarm Introduction
 
Deep dive in container service discovery
Deep dive in container service discoveryDeep dive in container service discovery
Deep dive in container service discovery
 
Scaling Microservices with Kubernetes
Scaling Microservices with KubernetesScaling Microservices with Kubernetes
Scaling Microservices with Kubernetes
 
Container Performance Analysis
Container Performance AnalysisContainer Performance Analysis
Container Performance Analysis
 
Docker Swarm 45-min Workshop (Mountain View Docker Meetup 2/24/2016)
Docker Swarm 45-min Workshop (Mountain View Docker Meetup 2/24/2016)Docker Swarm 45-min Workshop (Mountain View Docker Meetup 2/24/2016)
Docker Swarm 45-min Workshop (Mountain View Docker Meetup 2/24/2016)
 

Viewers also liked

Orchestration for the rest of us
Orchestration for the rest of usOrchestration for the rest of us
Orchestration for the rest of usJérôme Petazzoni
 
Docker networking basics & coupling with Software Defined Networks
Docker networking basics & coupling with Software Defined NetworksDocker networking basics & coupling with Software Defined Networks
Docker networking basics & coupling with Software Defined NetworksAdrien Blind
 
Docker at Spotify
Docker at SpotifyDocker at Spotify
Docker at SpotifyRohan Singh
 
Docker Overview - AWS Tech Connect - Seattle 10/28
Docker Overview - AWS Tech Connect - Seattle 10/28Docker Overview - AWS Tech Connect - Seattle 10/28
Docker Overview - AWS Tech Connect - Seattle 10/28Mike Coleman
 
Docker Budapest meetup 2016.02.09.
Docker Budapest meetup 2016.02.09.Docker Budapest meetup 2016.02.09.
Docker Budapest meetup 2016.02.09.Zsolt Molnar
 
Egy .NET fejlesztő élete a Node.js világában
Egy .NET fejlesztő élete a Node.js világábanEgy .NET fejlesztő élete a Node.js világában
Egy .NET fejlesztő élete a Node.js világábanGyörgy Balássy
 
Containers, docker, and security: state of the union (Bay Area Infracoders Me...
Containers, docker, and security: state of the union (Bay Area Infracoders Me...Containers, docker, and security: state of the union (Bay Area Infracoders Me...
Containers, docker, and security: state of the union (Bay Area Infracoders Me...Jérôme Petazzoni
 
Docker: automation for the rest of us
Docker: automation for the rest of usDocker: automation for the rest of us
Docker: automation for the rest of usJérôme Petazzoni
 
Docker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and securityDocker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and securityJérôme Petazzoni
 
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxConAnatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxConJérôme Petazzoni
 

Viewers also liked (12)

Docker {at,with} SignalFx
Docker {at,with} SignalFxDocker {at,with} SignalFx
Docker {at,with} SignalFx
 
Orchestration for the rest of us
Orchestration for the rest of usOrchestration for the rest of us
Orchestration for the rest of us
 
Docker networking basics & coupling with Software Defined Networks
Docker networking basics & coupling with Software Defined NetworksDocker networking basics & coupling with Software Defined Networks
Docker networking basics & coupling with Software Defined Networks
 
Docker at Spotify
Docker at SpotifyDocker at Spotify
Docker at Spotify
 
Docker Overview - AWS Tech Connect - Seattle 10/28
Docker Overview - AWS Tech Connect - Seattle 10/28Docker Overview - AWS Tech Connect - Seattle 10/28
Docker Overview - AWS Tech Connect - Seattle 10/28
 
Docker Budapest meetup 2016.02.09.
Docker Budapest meetup 2016.02.09.Docker Budapest meetup 2016.02.09.
Docker Budapest meetup 2016.02.09.
 
Tiad - Docker: Automation for the rest of us
Tiad - Docker: Automation for the rest of usTiad - Docker: Automation for the rest of us
Tiad - Docker: Automation for the rest of us
 
Egy .NET fejlesztő élete a Node.js világában
Egy .NET fejlesztő élete a Node.js világábanEgy .NET fejlesztő élete a Node.js világában
Egy .NET fejlesztő élete a Node.js világában
 
Containers, docker, and security: state of the union (Bay Area Infracoders Me...
Containers, docker, and security: state of the union (Bay Area Infracoders Me...Containers, docker, and security: state of the union (Bay Area Infracoders Me...
Containers, docker, and security: state of the union (Bay Area Infracoders Me...
 
Docker: automation for the rest of us
Docker: automation for the rest of usDocker: automation for the rest of us
Docker: automation for the rest of us
 
Docker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and securityDocker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and security
 
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxConAnatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
 

Similar to Docker and Maestro for fun, development and profit

When Docker Engine 1.12 features unleashes software architecture
When Docker Engine 1.12 features unleashes software architectureWhen Docker Engine 1.12 features unleashes software architecture
When Docker Engine 1.12 features unleashes software architecture Adrien Blind
 
Docker Internet Money Gateway
Docker Internet Money GatewayDocker Internet Money Gateway
Docker Internet Money GatewayMathieu Buffenoir
 
Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...Codemotion
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Partner S.A.
 
Docker container a-brief_introduction_2016-01-30
Docker container a-brief_introduction_2016-01-30Docker container a-brief_introduction_2016-01-30
Docker container a-brief_introduction_2016-01-30Khelender Sasan
 
Docker - Der Wal in der Kiste
Docker - Der Wal in der KisteDocker - Der Wal in der Kiste
Docker - Der Wal in der KisteUlrich Krause
 
Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3Velocidex Enterprises
 
Kubernetes Java Operator
Kubernetes Java OperatorKubernetes Java Operator
Kubernetes Java OperatorAnthony Dahanne
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachPROIDEA
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Anthony Dahanne
 
Using the Azure Container Service in your company
Using the Azure Container Service in your companyUsing the Azure Container Service in your company
Using the Azure Container Service in your companyJan de Vries
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudMassimiliano Dessì
 
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 JavaCodemotion
 
Practical Design Patterns in Docker Networking
Practical Design Patterns in Docker NetworkingPractical Design Patterns in Docker Networking
Practical Design Patterns in Docker NetworkingDocker, Inc.
 
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 TrioJérôme Petazzoni
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Jen Andre
 
Docker Security
Docker SecurityDocker Security
Docker SecurityBladE0341
 

Similar to Docker and Maestro for fun, development and profit (20)

When Docker Engine 1.12 features unleashes software architecture
When Docker Engine 1.12 features unleashes software architectureWhen Docker Engine 1.12 features unleashes software architecture
When Docker Engine 1.12 features unleashes software architecture
 
Docker Internet Money Gateway
Docker Internet Money GatewayDocker Internet Money Gateway
Docker Internet Money Gateway
 
Docker img-no-disclosure
Docker img-no-disclosureDocker img-no-disclosure
Docker img-no-disclosure
 
Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: Introduction
 
Docker container a-brief_introduction_2016-01-30
Docker container a-brief_introduction_2016-01-30Docker container a-brief_introduction_2016-01-30
Docker container a-brief_introduction_2016-01-30
 
Docker
DockerDocker
Docker
 
Axigen on docker
Axigen on dockerAxigen on docker
Axigen on docker
 
Docker - Der Wal in der Kiste
Docker - Der Wal in der KisteDocker - Der Wal in der Kiste
Docker - Der Wal in der Kiste
 
Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3
 
Kubernetes Java Operator
Kubernetes Java OperatorKubernetes Java Operator
Kubernetes Java Operator
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !
 
Using the Azure Container Service in your company
Using the Azure Container Service in your companyUsing the Azure Container Service in your company
Using the Azure Container Service in your company
 
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
 
Practical Design Patterns in Docker Networking
Practical Design Patterns in Docker NetworkingPractical Design Patterns in Docker Networking
Practical Design Patterns in Docker Networking
 
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
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
 
Docker Security
Docker SecurityDocker Security
Docker Security
 

Recently uploaded

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 FMESafe Software
 
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 FMESafe Software
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governanceWSO2
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....rightmanforbloodline
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfdanishmna97
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
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...DianaGray10
 
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...Orbitshub
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceIES VE
 
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 DevelopersWSO2
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxMarkSteadman7
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2
 

Recently uploaded (20)

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
 
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
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
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...
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
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
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 

Docker and Maestro for fun, development and profit

  • 1. Docker and Maestro For fun, development and profit
  • 2. Maxime Petazzoni Software Engineer at SignalFuse, Inc. (also, Jérôme’s cousin) ! max@signalfuse.com
  • 3. Real-time monitoring, instrumentation, observability and analytics Still in “stealth” mode Get updates at www.signalfuse.com
  • 4. “Docker is awesome!” –You, some time in the last hour (hopefully).
  • 5. A versatile foundation Service or application containment, security, software delivery, host and environment isolation, …and so much more.
  • 6. Power at your fingertips Complete control through the remote API Available programmatic clients like docker-py
  • 7. docker:$ docker -d -H tcp://0.0.0.0:4243 ! client:$ cat << EOF | python import docker from pprint import pprint as pp pp(docker.client.Client(‘tcp://docker:4243') .images('quay.io/signalfuse/maestro-base')) EOF ! ! [{u’Created': 1391202535, u’Id': u’37de13d273eb9a02cd64…’, u’Repository': u'quay.io/signalfuse/maestro-base', u'Size': 155663843, u'Tag': u'0.1.6', u'VirtualSize': 774767942}]
  • 8. Docker’s Achilles: orchestration Single-host is alright with links, but multi-host just isn’t there.
  • 9. How do I orchestrate the deployment and control of a full, multi-host, Docker-based environment?
  • 10. (And more importantly:) How do I make this process one and the same for development, testing and production environments?
  • 11. Enter: Maestro The totally not scalable, pet project that solved my use case. (and maybe yours)
  • 12. Maestro is actually MaestroNG, a re-invention of Kimbro Staken’s Maestro (formerly, dockermix)
  • 13. Takes in a definition of services, their dependencies , configuration and target host… ! …and automates the deployment (and control) of their corresponding containers on these hosts.
  • 14. Classic use case: a pool of “dumb” workers on your favorite cloud/hosting provider that just run Docker. ! No need to (ma)ssh into anything, no need to pre-configure anything. ! Everything is remote controlled.
  • 15. Other typical use case: running all the components of your stack in a single, local virtual machine. ! Useful for development, integration testing, etc.
  • 16. Philosophy: lightweight application/service containers. ! Represent and control your software stack and its dependencies. ! Docker images are the output of your CI process (automation!). ! Start fast, fail faster. Not for heavyweight, complex container “VMs”.
  • 17. Each service instance (container) defines where it runs and which ports it exposes, among other things. ! Like Docker links, Maestro works by injecting this information in the container’s environment about each container’s service’s dependencies.
  • 18. Let’s say broker-1 of kafka depends on ZooKeeper. Its environment will contain: MAESTRO_ENVIRONMENT_NAME = lspe SERVICE_NAME = kafka CONTAINER_NAME = broker-1 CONTAINER_HOST_ADDRESS = 192.168.10.2 ! ZOOKEEPER_ZK_NODE_1_HOST = 192.168.10.2 ZOOKEEPER_ZK_NODE_1_CLIENT_PORT = 2181 ZOOKEEPER_ZK_NODE_1_PEER_PORT = 2888 ZOOKEEPER_ZK_NODE_1_LEADER_ELECTION_PORT = 3888 ! KAFKA_BROKER_1_HOST = 192.168.10.2 KAFKA_BROKER_1_BROKER_INTERNAL_PORT = 9042 KAFKA_BROKER_1_BROKER_PORT = 9042 KAFKA_BROKER_1_JMX_INTERNAL_PORT = 7199 KAFKA_BROKER_1_JMX_PORT = 17199
  • 20. Using this information, you can configure your application at container start time. ! If you like Python, Maestro helps you by providing a set of guest helper functions in maestro.guestutils to easily extract and use this data.
  • 21. #!/usr/bin/env python ! # This is my cool container’s “init script” ! import os from maestro.guestutils import * ! os.execl(‘java’, ‘java’, ‘-jar’, ‘my-app.jar’, ‘-DlistenPort={}’.format(get_port(‘service’)), ‘-DzkServers={}’.format( get_node_list(‘zookeeper’, ports=[‘peer’])))
  • 22. Dependency order is respected on start; inverse order on stop. ! Can be overridden to stop individual services or containers.
  • 23. MyApp Start order: 1. ZooKeeper 2. Kafka 3. MyApp Kafka ZK Stop order: 1. MyApp 2. Kafka 3. ZooKeeper Works on subsets of services too.
  • 24. So how do you wield this power? A bit clunkily, with YAML (and a bit of Jinja2). ! ! ! (sorry)
  • 25. # Yay, YAML! name: lspe ! registries: # Define custom image registries for # private registries, with credentials. ! ships: # Declare each target host. # (Docker daemon locations) ! services: # Declare each service, their # instances, dependencies and # configuration
  • 26. registries: # Quay.io with Maestro robot account quay.io: registry: https://quay.io/v1/ email: maestro@signalfuse.com username: signalfuse+maestro password: {{ env.SUPER_SECRET }} When starting a container, Maestro will automatically login and pull the image from the right place if the image name matches a configured registry.
  • 27. ships: # Local virtual machine vm: ip: 192.168.10.2 docker_port: 4243 timeout: 10 # Slow VM is slow # A shorter form… vm2: {ip: 192.168.10.3, timeout: 5} Ships carry containers and are referred to by name in the configuration.
  • 28. services: # ZooKeeper zookeeper: image: quay.io/signalfuse/zookeeper:3.4.5 ! # Our zoo isn’t too wild, # only one keeper is enough. zk-node-1: ship: vm ports: client: 2181 peer: 2888/tcp leader_election: “3888/tcp:3888/tcp” # Keep persistent data on the host. volumes: /var/lib/zookeeper: /data/zookeeper # Environment can be passed-in too. env: JVM_FLAGS: “-Xmx1g”
  • 29. # Kafka kafka: image: quay.io/signalfuse/kafka:0.8.0 requires: [ zookeeper ] env: ZOOKEEPER_BASE: /lspe/kafka RETENTION_HOURS: 48 broker-1: ship: vm ports: {broker: 9092, jmx: “7199:17199”} # Keep persistent data on the host. volumes: /var/lib/kafka: /data/kafka env: BROKER_ID: 0 More flexibility in port mappings, volume bindings, and environment variables definition not shown here.
  • 30. See README.md for full syntax details and features https://github.com/signalfuse/maestro-ng/blob/master/README.md
  • 31. Demo time! Be prepared for it to fail, because demos always do.
  • 32. What’s next? More flexible service status detection (not only port pinging) Soft and hard service dependencies Parallel startup of independent services and instances of a service
  • 33. That’s it! Thanks for listening! :) github.com/dotcloud/docker-py github.com/signalfuse/maestro-ng
  • 34. SignalFuse is hiring world class engineers! jobs@signalfuse.com