Docker @ Flux7 Labs

40 %
60 %
Information about Docker @ Flux7 Labs

Published on February 22, 2014

Author: Flux7Labs



Link to Blog Post:


WHO AM I? Aater Suleman Part-time UT Professor Geek, Architect, Developer, Ops, DevOps … Co-founder & CEO Flux7 Labs DevOps Solutions ■ Deployments ■ Cost/performance optimized large scale website (Ruby on rails, node.js, Django) and Hadoop deployments

RESOURCES Blog: Slideshare: Twitter: @futurechips Email:

WHY WE USE DOCKER? Better than running processes Low CPU/memory overhead The ability to diff containers - Easier to share containers than VMs Fast boot/shutdown Cross cloud/infrastructure: The ability to put on top of cloud

HOW DO WE FEEL? Enough said! Read the blog post here The aforementioned reasons are real -- very real

Four N projects: Dev Flow projects: VyScale,, Clients Docker's impact on performance (whitepaper WIP) Multi-tenancy Live process migration using CRIU ( Wordpress hosting

APPLICATION: SINGLE SERVICE PROVIDER Internet of Things -- Solar Panel Monitoring Receive Sensor Data XML Data over TCP Report Generation based on data Big Data Analytics Report sent to End User

Gateway3 sensors Gateway1 Gateway2 Location1 Location3 Location2 Provider Span A provider has Mifi routers installed at multiple Locations which collect data from sensors and sends it to a remote TCP server via the internet. Browser Uses the Flask app at port 80 Internet Flask App Port 80 TCP server Port 6000 Cassandra port 9160 Single Provider System

COMPONENTS 1. Cassandra for data persistence which we later use for generating reports for each gateway. 2. A Twisted TCP server listening at PORT 6000, for data ingestion from multiple gateways owned by the provider. 3. A Flask app serving at PORT 80 as the admin panel for setting customizations and viewing reports.

Customer 1 G Customer 2 … Customer N G G G Each customer can have multiple gateways commissioned to them. *G - Gateway Remote Twister TCP Server (Non–Blocking I/O) Web App Power consumption status on website and mails Mailer Cassandra NoSQL data store (High Volume High Velocity Write which scales Linearly across the cluster )

SINGLE PROVIDER LAUNCH For launching the single provider version, the following was done: 1. nohup python & # For firing up the TCP server. 2. nohup python & # For firing up the admin panel Both these code bases houses hard-coded Cassandra KEYSPACE


Provider 2 sends data to port 6002 and accesses flask app at port 8082 Provider 1 sends data to port 6001 and accesses flask app at port 8081 Internet TCP server containerruns at port 6000. Exposes port 6000 and published it to port 6001 for provider 1 Flask container-runs flask app at port 80. Exposes port 80 and published it to port 8081 for provider 1 TCP server container-runs at port 6000. Exposes port 6000 and published it to port 6002 for provider 2 Flask container-runs flask app at port 80. Exposes port 80 and published it to port 8082 for provider 2 Cassandra

KNEE-JERK APPROACH Sprinkle Tenant ID everywhere in the code and DB Time consuming Expensive Poor isolation Security Maintenance Rigidity

MULTIPLE HOSTS/VMS An alternate solution is to use Virtual Machine (VM) or Multiple Hosts Downside: Both VMs and Multiple Hosts cost a lot of money


WHY DOCKER? Docker containers provide isolation that is Fast Inexpensive How: Isolated environments for running multiple instances of the app

PLAN Create a docker container for the new version of the app Setup environments/dependencies correctly Start a Cassandra container.

AUTOMATION An automation was the next foreseeable step, and for that we found Docker-py extremely useful. We used something like: # Yes. We love Python! def start_provider(provider_id, gateway_port, admin_port ): docker_client = docker.Client(base_url='unix://var/run/docker.sock', version='1.6', timeout=100) # start a docker container for consuming gateway data at gateway_port start_command = 'python software/ ' + provider_id remote_server = docker_client.create_container('flux7/labs', # docker image command=start_command, # start command contains the keyspace parameter, keyspace is the provider_id name='remote_server_' + provider_id, # name the container, name is provider_id ports=[(6000, 'tcp'),]) # open port for binding, listens at 6000 docker_client.start(remote_server, port_bindings={6000: ('', gateway_port)}, links={'db': 'cassandra'}) # start a docker container for serving admin panel at admin_port start_command = 'python software/ ' + provider_id remote_server = docker_client.create_container('flux7/labs', # docker image command=start_command, # start command contains the keyspace parameter, keyspace is the provider_id name='admin_panel_' + provider_id, # name the container, name is provider_id ports=[(80, 'tcp'),]) # open port for binding, listens at 6000 docker_client.start(remote_server, port_bindings={80: ('',admin_port)}, links= {'db': 'cassandra'})

OUR SOLUTION- EXPLAINED For now, a locally running container serving at PORT 9160 using the command similar to this: docker run -d -p 9160:9160 -name db flux7/cassandra

OUR SOLUTION- EXPLAINED Create a keyspace ‘provider1’ using pycassaShell. We fired up our two code bases on two separate containers like this: docker run -name remote_server_1 -link db:cassandra p 6001:6000 flux7/labs python software/remote_server. py provider1 docker run -name flask_app_1 -link db:cassandra -p 8081:80 flux7/labs python software/ provider1

DOCKER ISSUES DISCOVERED Docker does not support multiple instances of Cassandra running on the same machine. Hosting multiple database instances on a single machine can quickly cause resource shortages

OUR SOLUTION ❑ Followed the traditional solution to make an application multi-tenant Use of KEYSPACE as the namespace for each provider in the data store Code Changes Cassandra KEYSPACE / provider ID •• To data ingestion server and web server by adding the keyspace parameter to the DB accesses. •• Passed to each instance of the app on the command line. ❑ Each provider in the data store gets a separate namespace without making any changes to the column family schema.

LESSONS WE LEARNT Docker is an extremely fast and elegant isolation framework: easy to port, cheap to run, easy to orchestrate Multi-tenancy != changing the app to support multiple tenants Docker orchestration frameworks are not at par with Docker today. What we have written is yet another one but for multi-tenancy. Dockerfiles still need work -- we used shell scripts in some places We can run multiple commands/container

DOCKER IN DEVELOPER ENVIRONMENT 4 Reasons Performance Overhead Fast Boot Container Size is small Ability to put on top of cloud (and even cross cloud)


Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

Flux7 | DevOps, AWS Migration

Flux7 AWS partners provide AWS migration, AWS DevOps and other services such as IoT architecture and cloud architecture design ensuring AWS security
Read more

Container Consulting | Flux7

Flux7 Austin DevOps experts and Docker consultants provide container consulting and AWS infrastructure services
Read more

GitHub - Flux7Labs/docker-ssh-ubuntu: This is a Docker ...

docker-ssh-ubuntu - This is a Docker file to mimic the AWS Ubuntu 12.04 image as closely as possible
Read more

Flux7 | Facebook

Flux7, Austin, Texas. 211 likes · 3 talking about this · 7 were here. Flux7 is a DevOps-based IT consultancy providing architecture and migration...
Read more

Join us at DockerCon 16 -

Join Fugro and Flux7 at Dockercon; hear how they brought a new Internet of Things (IoT) based service to market based on Docker containers and AWS.
Read more

8 Docker use cases - Flux 7

8 ways to implement Docker software containers . Our Flux7 Labs Docker experts have tried and tested and found eight Docker use cases where implementing ...
Read more

Docker Performance - Flux 7

Docker Performance. Docker, ... CTO & Co-Founder at Flux7 Labs, has been designing scalable and distributed systems for the last decade.
Read more

GitHub - Flux7Labs/docker-atlassian-jira: Docker container ...

A containerized installation of Atlassian JIRA setup with a goal of keeping the installation as default as possible, but with a few Docker ...
Read more