View
278
Download
1
Category
Tags:
Preview:
Citation preview
About me
Sascha Möllering
sascha@autoscaling.io
sascha.moellering@zanox.com
Lead Engineer / DevOps Hipster
zanox AG
http://autoscaling.io
@sascha242
About meJava Magazin 11.14
Architektur im Kontext der Cloud: Patterns und Best Practices
AWS Virtual Cloud Summit
Continuous delivery in AWS using Docker
http://aws-summit.de/
Entwickler Spezial: Docker
Über den Wolken: Ein Erfahrungsbericht zum Docker-Einsatz in der Amazon Cloud
Problem?
• Using different Cloud providers
• Additionally: own DC• Different
infrastructure• Different
deployment mechanisms
• One container to rule them all!
• Application detects deployment target
• Application uses specific infrastructure
Real Solution!
Real World example
• JVM based event-driven application
• Ingests data into bus system
• Uses Redis as a cache
• Base framework is Vert.x
• Pre-build Docker image
Real World example
• Our own data center:– Linux servers with Docker 1.6– Apache Kafka 0.8.1/0.8.2
• Topics and partitions• Easy to write, hard to read from
– Redis 2.8
Real World example
• Amazon Web Services:– EC2 instance with Docker 1.6– Amazon Kinesis
• Amazon’s implementation of Kafka (?)• Streams and shards• KCL does the heavy lifting
– ElastiCache with Redis engine• Amazon’s implementation of Redis
Real World example
• Microsoft Azure:– Azure Ubuntu VM with Docker 1.6– Azure Service Bus
• Bus system in Azure• AMQP and JMS• Problem: no partitioning for Java
– Azure Cache• Redis implementation in Azure
Real World example
• For Redis: Jedis client in all cases
• Difference: bus system– mod-kafka– mod-kinesis– mod-service-bus
Real World example
• mod-kafka:– Vert.x module for Apache Kafka– Recieves events by other verticles– Sends events to Kafka broker– Either Strings or binary data– Supports StatsD– Based on Apache Kafka Java API
Real World example
• mod-kinesis:– Vert.x module for Amazon Kinesis– Recieves events by other verticles– Sends events to Kinesis stream– Either Strings or binary data– Support for partitioning in events– Based on AWS Java SDK
Real World example
• mod-service-bus:– Vert.x module for Azure Service Bus– Recieves events by other verticles– Support for binary data only ATM– No partitioning (Service Bus problem)– Based on AMQP and JMS
Real World example
boolean isAzure = true;
try { RoleEnvironment.getRoles();
} catch (Exception exc) { isAzure = false;}
Real World example
• Problem: not working in Docker container• Alternative: check for /etc/waagent.conf• File has to be mapped in Docker container
Real World example
• StarterVerticle pattern:– Bootstrapping Vert.x application– Start all verticles in StarterVerticle– Deploy all modules in StartVerticle
Docker implementations
• Basic implementation:– EC2 using User Data– Install Docker and start service– Either pull Container in User Data script – Or Remote API
Docker implementations
• AWS OpsWorks:– No “official” support– Docker Chef Cookbook by AWS – Problem: Docker Images are build in the
Cookbook
Docker implementations
• Amazon Elastic Beanstalk:– Support for single/multi container
environments– ELB support on container level– Multi container environments -> ECS
resources – Running containers locally is possible
Docker implementations
• Amazon EC2 Container Service:– Container management service for Docker– Description language for applications (“task
definition”)– Supports batch mode (taks that only run
once)– Supports long running taks– ELB support on container level
Docker implementations
• xplat-cli:– Support for:
• Ubuntu from Azure Image Gallery• Custom Linux image with Azure Linux VM
Agent
– Similar to plain EC2 approach
Deployment
Amazon Cloud
WorkstationGitHub Jenkins
Python/Boto
Docker Image
Docker Registry S3 bucket withDocker Images
Deployment
• AWS OpsWorks:– Docker Chef Cookbook by AWS – Add a new stack containing the Cookbook– Add a new layer and add custom recipes– Docker Images are build in the Cookbook– Use custom JSON to modify stack
configuration
Deployment
• Amazon Elastic Beanstalk:– Create an application using console or CLI– Create Dockerrun.aws.json to deploy a
Docker container– Create a ZIP-file containing application
files (optional)
Deployment
1. Create a cluster
2. Create a task definition
3. Create a service
4. Configure cluster
5. Run task
Recommended