Berlin
Continuous Deployment on ECS Sébastien Stormacq, Training Manager, AWS
[email protected]
@sebsto
CONTINUOUS INTEGRATION
DEVELOPERS
INFRASTRUCTURE
SOURCE CODE REPOSITORY
DEVELOPERS
INFRASTRUCTURE
SOURCE CODE REPOSITORY
DEVELOPERS PROJECT MANAGEMENT SERVER
INFRASTRUCTURE
SOURCE CODE REPOSITORY
CONTINUOUS INTEGRATION SERVERS
DEVELOPERS PROJECT MANAGEMENT SERVER
INFRASTRUCTURE
SOURCE CODE REPOSITORY
CONTINUOUS INTEGRATION SERVERS
DEVELOPERS
PICK TASKS
PROJECT MANAGEMENT SERVER
INFRASTRUCTURE
SOURCE CODE REPOSITORY
SUBMIT CODE CONTINUOUS INTEGRATION SERVERS
DEVELOPERS PROJECT MANAGEMENT SERVER
INFRASTRUCTURE
SOURCE CODE REPOSITORY
CONTINUOUS INTEGRATION SERVERS
CODE FETCH
DEVELOPERS PROJECT MANAGEMENT SERVER
INFRASTRUCTURE
SOURCE CODE REPOSITORY
DOCS
CONTINUOUS INTEGRATION SERVERS
BUILD OUTPUT
BINARIES & PACKAGES DEVELOPERS PROJECT MANAGEMENT SERVER
INFRASTRUCTURE
SOURCE CODE REPOSITORY
DOCS
CONTINUOUS INTEGRATION SERVERS BINARIES & PACKAGES DEVELOPERS PROJECT MANAGEMENT SERVER
INFRASTRUCTURE
DOCS
BINARIES & PACKAGES DEVELOPERS
?
INFRASTRUCTURE
= PROGRAMMABLE PLATFORM
IF YOU CAN PROGRAM IT, YOU CAN AUTOMATE IT
Docker on AWS Sascha Möllering, Senior Software Engineer, zanox AG
[email protected] sascha242
What is zanox?
Simplified architecture
Title with free format content section
Shipping with Docker
Docker Registry
S3 bucket with Docker Images
Docker Image
Workstation GitHub
Jenkins
Amazon Cloud Python/Boto
Shipping with Docker
EC2 instance with Docker registry (port 5000)
S3 bucket to store Docker images
Shipping with Docker
Shipping with Docker
Shipping with Docker • EC2 User Data • Data to configure instance during launch – Install Docker – Start Daemon – Run Docker container
Immutable Server
Title with free format content section
Immutable Server • • • •
Trash your servers! New deployment -> new infrastructure Don’t change an existing server Problem: snowflake server
Immutable Server
Title with free format content section
Immutable Server
Immutable Server • • • •
Pre-Baking AMIs with Packer Security patches Configuration Additional software
[email protected] @sascha242
CONTINUOUS DEPLOYMENT
CONTINUOUS DEPLOYMENT SERVERS DEPLOY
BINARIES & PACKAGES
DEVELOPERS
INFRASTRUCTURE
Elastic Beanstalk
Cloudformation
Code Deploy
OpsWorks
EC2 Container Services
+
CLUSTER MANAGEMENT
FLEXIBLE CONTAINER PLACEMENT
INTEGRATED WITH OTHER SERVICES
EXTENSIBLE
PERFORMANCE AT SCALE
SECURITY FIRST
ANATOMY OF AN ECS DEPLOYMENT
DOCKER CONTAINERS
EC2 INSTANCES CLUSTER
TASK DEFINITIONS
[
[ { "image": "tutum/wordpress-stackable", "name": "wordpress", "cpu": 10, "memory": 500, "essential": true, "links": [ "db" ], "entryPoint": [ "/bin/sh", "-c" ], "environment": [ … ], "portMappings": [ { "containerPort": 80, "hostPort": 80 } ] }, ]
{ "image": "mysql", "name": "db", "cpu": 10, "memory": 500, "essential": true, "entryPoint": [ "/entrypoint.sh" ], "environment": [ { "name": "MYSQL_ROOT_PASSWORD", "value": "pass" } ], "portMappings": []
} ]
Tasks are defined via Task Definitions [
[ { "image": "tutum/wordpress-stackable", "name": "wordpress", "cpu": 10, "memory": 500, "essential": true, "links": [ "db" ], "entryPoint": [ "/bin/sh", "-c" ], "environment": [ … ], "portMappings": [ { "containerPort": 80, "hostPort": 80 } ] }, ]
{
From Dockerhub
"image": "mysql", "name": "db", "cpu": 10, "memory": 500, "essential": true, "entryPoint": [ "/entrypoint.sh" ], "environment": [ { "name": "MYSQL_ROOT_PASSWORD", "value": "pass" } ], "portMappings": []
10 CPU Units (1024 is full CPU), 500 Megabytes of Memory
Environment Variables
No external ports exposed
} ]
[
[ { "image": "tutum/wordpress-stackable", "name": "wordpress", "cpu": 10, "memory": 500, "essential": true, "links": [ "db" ], "entryPoint": [ "/bin/sh", "-c" ], "environment": [ … ], "portMappings": [ { "containerPort": 80, "hostPort": 80 } ] }, ]
{ "image": "mysql", "name": "db", "cpu": 10, "memory": 500, "essential": true, "entryPoint": [ "/entrypoint.sh" ], "environment": [ { "name": "MYSQL_ROOT_PASSWORD", "value": "pass" } ], "portMappings": []
Essential to our Task
Docker link to mysql container
} ]
Expose port 80 in container to port 80 on host
DEPLOYMENT TO ECS register-task-definition
update-service
CONTINUOUS INTEGRATION or DEPLOYMENT SERVER
AWS SDK or AWS CLI
EC2 CONTAINER SERVICE
POST BUILD STEP
CONTINUOUS INTEGRATION or DEPLOYMENT SERVER
AWS SDK or AWS CLI
API CALLS
EC2 CONTAINER SERVICE
DEMO
EC2 INSTANCES CLUSTER DOCKER REGISTRY
EC2
ECS SOURCE
GITHUB
JENKINS & AWS CLI AWS CLOUD
[email protected] @sebsto