0
DOCKER @ FLUX7 LABS
DOCKER AUSTIN

FOR MORE DISCUSSIONS ON DOCKER!
Who am I?
● Aater Suleman
○ Part-time UT Professor
○ Geek, Architect, Developer, Ops, DevOps …

● Co-founder & CEO Flux7 L...
Four projects:
VyScale Dev Flow
Docker's impact on performance (whitepaper WIP)
Multi-tenancy
Live process migration using...
Application: Single Service Provider
Internet of Things -- Solar Panel Monitoring

Receive
Sensor Data

XML Data
over TCP
...
Gateway3

sensors
Gateway1

Gateway2

Location1

Location3

Location2

Provider Span
A provider has Mifi routers installed...
COMPONENTS

1. Cassandra for data persistence which we later use for generating reports
for each gateway.

2. A Twisted TC...
Customer 1

G

Customer 2 …

Customer N

G

G

G

Each customer can have
multiple gateways
commissioned to them.

*G - Gat...
SINGLE PROVIDER LAUNCH
For launching the single provider version, the following was done:

1. nohup python tcp_server.py &...
Application: Multiple Service Providers

…
Provider 2 sends data to port
6002 and accesses flask app at
port 8082

Provider 1 sends
data to port 6001
and accesses fl...
KNEE-JERK APPROACH
Sprinkle Tenant ID everywhere in the code and DB

Time consuming

Poor isolation
Security

Expensive

M...
MULTIPLE HOST/VMS
An alternate solution is to use Virtual Machine (VM)

Hosts are expensive ($)
VMs are expensive (high ov...
AND THE SOLUTION
WHY DOCKER?

Docker containers provide isolation that is
Fast

Inexpensive

How: Isolated environments for running multipl...
PLAN

Create a docker container for the new version of the app

Setup environments/dependencies correctly

Start a Cassand...
AUTOMATION
An automation was the next foreseeable step, and for that we found Docker-py
extremely useful. We used somethin...
OUR SOLUTION- EXPLAINED

For now, a locally running container serving at PORT 9160 using the command
similar to this:
dock...
OUR SOLUTION- EXPLAINED
▪ Create a keyspace ‘provider1’ using pycassaShell.
We fired up our two code bases on two separate...
DOCKER ISSUES DISCOVERED

Docker does not support multiple instances of Cassandra running on the
same machine.

Hosting mu...
OUR SOLUTION
❑ Followed the traditional solution to make an application multi-tenant

Use of KEYSPACE as the namespace for...
LESSONS WE LEARNED
1.

Docker is an extremely fast and elegant isolation framework: easy to
port, cheap to run, easy to or...
DOCKER AUSTIN

FOR MORE DISCUSSIONS ON DOCKER!
Upcoming SlideShare
Loading in...5
×

Docker at Flux7

6,988

Published on

This the talk I gave at Docker Docker Docker Austin Cloud Users meetup in Austin on January 21st, 2014. The talk was about the use of Docker at Flux7 Labs (flux7.com). I chose to deep dive into one of the most interesting Internet of Things use cases: Implement multi-tenancy on Solar Panel Monitoring Solution using Docker.

Published in: Technology, Business
0 Comments
9 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,988
On Slideshare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
40
Comments
0
Likes
9
Embeds 0
No embeds

No notes for slide

Transcript of "Docker at Flux7"

  1. 1. DOCKER @ FLUX7 LABS
  2. 2. DOCKER AUSTIN FOR MORE DISCUSSIONS ON DOCKER!
  3. 3. 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
  4. 4. Four projects: VyScale Dev Flow Docker's impact on performance (whitepaper WIP) Multi-tenancy Live process migration using CRIU (criu.org)
  5. 5. 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
  6. 6. 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
  7. 7. 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.
  8. 8. 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 )
  9. 9. SINGLE PROVIDER LAUNCH For launching the single provider version, the following was done: 1. nohup python tcp_server.py & # For firing up the TCP server. 2. nohup python flask_app.py & # For firing up the admin panel Both these code bases houses hard-coded Cassandra KEYSPACE Success!
  10. 10. Application: Multiple Service Providers …
  11. 11. 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
  12. 12. KNEE-JERK APPROACH Sprinkle Tenant ID everywhere in the code and DB Time consuming Poor isolation Security Expensive Maintenance Rigidity
  13. 13. MULTIPLE HOST/VMS An alternate solution is to use Virtual Machine (VM) Hosts are expensive ($) VMs are expensive (high overhead)
  14. 14. AND THE SOLUTION
  15. 15. WHY DOCKER? Docker containers provide isolation that is Fast Inexpensive How: Isolated environments for running multiple instances of the app
  16. 16. PLAN Create a docker container for the new version of the app Setup environments/dependencies correctly Start a Cassandra container.
  17. 17. 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/remote_server.py ' + 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, remote_server.py listens at 6000 docker_client.start(remote_server, port_bindings={6000: ('0.0.0.0', gateway_port)}, links={'db': 'cassandra'}) # start a docker container for serving admin panel at admin_port start_command = 'python software/flask_app.py ' + 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, remote_server.py listens at 6000 docker_client.start(remote_server, port_bindings={80: ('0.0.0.0',admin_port)}, links= {'db': 'cassandra'})
  18. 18. 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
  19. 19. 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 6000:6000 flux7/labs python software/remote_server. py provider1 docker run -name flask_app_1 -link db:cassandra -p 6000:6000 flux7/labs python software/flask_app.py provider1
  20. 20. 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
  21. 21. 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.
  22. 22. LESSONS WE LEARNED 1. Docker is an extremely fast and elegant isolation framework: easy to port, cheap to run, easy to orchestrate 2. Multi-tenancy != changing the app to support multiple tenants 3. Docker orchestration frameworks are not at par with Docker today. What we have written is yet another one but for multi-tenancy. 4. Dockerfiles still need work -- we used shell scripts in some places 5. We can run multiple commands/container
  23. 23. DOCKER AUSTIN FOR MORE DISCUSSIONS ON DOCKER!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×