SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Jessie Wei
Seek
Taking Docker to Dance:
Continuous Delivery on AWSTwitter: @jessieweiyi
Twitter: @jessieweiyi
Why Dance?
Continuous delivery requires a lot of moving parts to work with in a coordinated
and smooth manner.
In the container world, this translates into juggling with several containers at
once… Therefore, let’s take Docker to dance!
Twitter: @jessieweiyi
Objective
Show how application containerization and current
cloud offerings can greatly streamline the delivery
of new features from inception to production.
Tools & Tech
Focus on Docker and AWS (Some knowledge required).
Demo App
Demonstrate these concepts with a demo application.
Twitter: @jessieweiyi
How to setup a AWS-like local development
environment?
How to optimize the CI process to build better
docker images more quickly?
How to seamlessly migrate changes into production
without service interruption?
More specifically…. we will answer these questions:
Twitter: @jessieweiyi
application
Source code: https://github.com/jessieweiyi/aws-demo-app-2019-infra
A simple image processing service…
UI
API
Worker
Twitter: @jessieweiyi
S3 SQS DynamoDB
S3: Simple Storage Service
SQS: Simple Queue Service
localstack
Twitter: @jessieweiyi
demo-ui
demo-api
demo-worker
LocalStack: https://github.com/localstack/localstack Twitter: @jessieweiyi
AWS service compliant interface:
 from cli: -endpoint-url http://localhost:4572
 compatible with AWS SDK, no additional tooling
Web console for user-friendly managementThe good ….
No capabilities for services configuration on startupthe bad ….
Workaround: local nc ping for service ready, and use
AWS cli to setup the services needed.
and the ugly!
Local implementation of a wide range of AWS Services (e.g.
S3, DynamoDB, SQS, SNS, Lambda, API Gateway, SES…)
continuous
integration
deploy to
staging
deploy to
prod
Twitter: @jessieweiyi
source
Install
Dependencies
Unit Test
Code
Quality
Testing
Coverage
Build
Docker Image
Security
Test
Publish
Sanity CheckSmoke Test
Twitter: @jessieweiyi
Optimize Builds
Docker Image Size
Twitter: @jessieweiyi
Docker image size has a considerable impact on the
build (and the deployment) process, as it influences
download and upload times.
Keeping docker image size small has several benefits:
 reduces download/upload times
 reduces the attack surface
 reduces the potential of incompatibilities
Tips
 use slim base images (-alpine, -slim, or scratch)
 install only essential dependencies/packages
 remove build dependencies
Docker Build Context
Twitter: @jessieweiyi
With ..dockerignore file
Clean checkout and without ..dockerignore file
Local Dev and without ..dockerignore file
docker build -t $(APP_IMAGE) .
.dockerignore
Multi-Stage Build
Twitter: @jessieweiyi
FROM node:10.15.3-alpine
ENV usernode
WORKDIR /opt/app
COPY ./package.json/opt/app/package.json
COPY ./yarn.lock /opt/app/yarn.lock
RUN chown $user–R /opt/app
USER $user
RUN yarn
COPY ./ /opt/app
RUN yarnbuild
ENTRYPOINT ["yarn"]
CMD["start"]
Without Multi-Stage Builds
With
Multi-Stage
Builds
378MB
161MB
Speed-up with Caching
Twitter: @jessieweiyi
Docker images are built of layers, which are
incremental file-system portions, and the main
contributors to the overall image size.
Layer caching reduces the need to download layers
during the build process, thus speeding up the build.
Layer caching is the default behavior on your local
environment, while it may need to be explicitly
configured in your CI/CD environment.
Enable Layer Caching in AWS
Twitter: @jessieweiyi
AWS CodeBuild supports caching in Local and S3, and this can be
easily configured by accessing the configuration options.
Use Cached Docker Image
version: 0.2
phases:
pre_build:
commands:
- `aws ecr get-login --region $(AWS_REGION) --no-include-email`
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- VERSION=${COMMIT_HASH:=latest}
- docker pull $(REGISTRY)/aws-demo-app-2019-api-build:latest || exit 0
build:
commands:
- docker build --cache-from $REGISTRY/aws-demo-app-2019-api-build:latest
-t aws-demo-app-2019-api:$VERSION .
post_build:
commands:
- docker tag aws-demo-app-2019-api:$VERSION $REGISTRY/aws-demo-app-2019-api:$VERSION
- docker push $REGISTRY/aws-demo-app-2019-api:$VERSION
- docker tag aws-demo-app-2019-api:$VERSION $REGISTRY/aws-demo-app-2019-api:latest
- docker push $(REGISTRY)/aws-demo-app-2019-api:latest
- docker build --target dependencies --cache-from $REGISTRY/aws-demo-app-2019-api-build:latest
-t $REGISTRY/aws-demo-app-2019-api-build:latest .
- docker push $REGISTRY/aws-demo-app-2019-api-build:latest
artifacts:
files: imagedefinitions.json
Twitter: @jessieweiyi
Docker Hosting
Twitter: @jessieweiyi
Docker and Docker Compose are a good
solution for a local environment, but in
production we need something more….
… in short, we need a “much bigger boat”!
rolling updates for uninterrupted
service
container orchestration
elastic scalability, to serve varying
demand
AWS Offerings
Twitter: @jessieweiyi
“AWS ECS is for you if you like using Docker!”
“AWS EKS is for you if you love Kubernetes!”
“AWS Fargate is for you if do not want the grunt work of managing either Docker or Kubernetes!”
AWS Fargate - AWS ECS Fargate Launch Mode
AWS EC2 - AWS ECS EC2 Launch Mode
AWS EKS - Amazon Elastic Container Service for
Kubernetes
ECS Vs. EKS Vs. Fargate: The Good, the Bad, the Ugly
http://blog.totalcloud.io/ecs-vs-eks-vs-fargate-good-bad-ugly/
AWS ECS Fargate
Twitter: @jessieweiyi
Run containers without having to
manage EC2 instances
Serverless
Pay-as-you-go (vCPUs and memory used):
☹ more expensive than running on ECS EC2
� cheaper considering maintenance costs
App Environment on AWS
Environment Provisioning
Network
VPC, Subnets, Security Groups, Internet Gateway
AWS Services
SQS, S3, DynamoDB Table
ECS Cluster
ECS, Load Balancer
Export-Name
Fn::ImportValue
ECS Service
Service, Task Definition, LoadBalancerListener, Rout53RecordSet , TaskIAMRole
Tip: by structuring your
deployment in layers, you can
make reusable components of
infrastructure for other
deployments!
AWS CloudFormation
“Infrastructure as Code” approach for your
deployment topology
Deployment Process
Objective:
Zero Downtime Deployments!
AWS Fargate Deployment Types
 Rolling updates
 Blue-Green deployments
Rolling Update
 Default ECS Deployment Type
 Does not require a load balancer (health check
can be shell command)
 Great for background tasks (e.g. demo-worker)
T0
T1 Both versions exist, until connections
to old version are completed.
T2 After a while, only new versions exist
Update!
Blue-Green Deployments
 Reduces risk
 Adds complexities at scale
 Great for public APIs (e.g. demo-api)
T0
T1 A twin deployment with the
new version is added to the
load balancer, and the previous
one removed
Listener
(port 80)
Listener
(port 80)
Listener
(port 8080)
T2
Listener
(port 80)
Rolling Updates vs
Blue-Green Deployments
GET /hello_world
{ "message" :"hello worldv1" }
{ "message" :"hello worldv2" }
from:
to:
Rolling Updates
{ "message": "helloworldv1"}
{ "message": "helloworldv1"}
{ "message": "helloworldv2"}
{ "message": "helloworldv1"}
{ "message": "helloworldv2"}
{ "message": "helloworldv1"}
{ "message": "helloworldv2"}
{ "message": "helloworldv2"}
{ "message": "helloworldv2"}
{ "message": "helloworldv1"}
{ "message": "helloworldv1"} { "message": "helloworldv1" }{
"message": "helloworldv1" }
{ "message": "helloworldv2"}
{ "message": "helloworldv2"}
{ "message": "helloworldv2"}
{ "message": "helloworldv2"}
{ "message": "helloworldv2"}
Blue-Green DeploymentsTime
Service Auto Scaling
Twitter: @jessieweiyi
 Scale up to deal with high demand during
peak times
 Scale down to reduce costs during periods
of low utilizations
 Choose the right auto-scaling metrics
 Service Utilization (% of CPU, Memory)
 # active connections
 # jobs in the SQS queue
Demo
Twitter: @jessieweiyi
Twitter: @jessieweiyi
What did we cover?
Setup of a local dev environment that
mimics AWS services
Techniques for optimizing the build
process of containerized applications
Overview of AWS offerings for running
Docker containers
Deployment updates techniques for
uninterrupted service operation
Twitter: @jessieweiyi

Weitere ähnliche Inhalte

Was ist angesagt?

.Net Core Fall update
.Net Core Fall update.Net Core Fall update
.Net Core Fall updateMSDEVMTL
 
Kubernetes on AWS
Kubernetes on AWSKubernetes on AWS
Kubernetes on AWSGrant Ellis
 
Micro services infrastructure with AWS and Ansible
Micro services infrastructure with AWS and AnsibleMicro services infrastructure with AWS and Ansible
Micro services infrastructure with AWS and AnsibleBamdad Dashtban
 
Cloud Foundry V2 | Intermediate Deep Dive
Cloud Foundry V2 | Intermediate Deep DiveCloud Foundry V2 | Intermediate Deep Dive
Cloud Foundry V2 | Intermediate Deep DiveKazuto Kusama
 
Docker and Windows: The State of the Union
Docker and Windows: The State of the UnionDocker and Windows: The State of the Union
Docker and Windows: The State of the UnionElton Stoneman
 
"On-premises" FaaS on Kubernetes
"On-premises" FaaS on Kubernetes"On-premises" FaaS on Kubernetes
"On-premises" FaaS on KubernetesAlex Casalboni
 
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...
Orchestration tool roundup   kubernetes vs. docker vs. heat vs. terra form vs...Orchestration tool roundup   kubernetes vs. docker vs. heat vs. terra form vs...
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...Nati Shalom
 
Adventures in docker compose
Adventures in docker composeAdventures in docker compose
Adventures in docker composeLinkMe Srl
 
Messaging with the Docker
Messaging with the DockerMessaging with the Docker
Messaging with the DockerHenryk Konsek
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 introTerry Cho
 
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...Docker, Inc.
 
Continuous integration with Docker and Ansible
Continuous integration with Docker and AnsibleContinuous integration with Docker and Ansible
Continuous integration with Docker and AnsibleDmytro Slupytskyi
 
Serverless technologies with Kubernetes
Serverless technologies with KubernetesServerless technologies with Kubernetes
Serverless technologies with KubernetesProvectus
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationSuresh Kumar
 
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014Amazon Web Services
 
Container Days Boston - Kubernetes in production
Container Days Boston - Kubernetes in productionContainer Days Boston - Kubernetes in production
Container Days Boston - Kubernetes in productionMike Splain
 
IPC16: A Practical Introduction to Kubernetes
IPC16: A Practical Introduction to Kubernetes IPC16: A Practical Introduction to Kubernetes
IPC16: A Practical Introduction to Kubernetes Robert Lemke
 
Introduction to CircleCI
Introduction to CircleCIIntroduction to CircleCI
Introduction to CircleCIHungWei Chiu
 

Was ist angesagt? (20)

.Net Core Fall update
.Net Core Fall update.Net Core Fall update
.Net Core Fall update
 
Kubernetes on AWS
Kubernetes on AWSKubernetes on AWS
Kubernetes on AWS
 
Micro services infrastructure with AWS and Ansible
Micro services infrastructure with AWS and AnsibleMicro services infrastructure with AWS and Ansible
Micro services infrastructure with AWS and Ansible
 
Cloud Foundry V2 | Intermediate Deep Dive
Cloud Foundry V2 | Intermediate Deep DiveCloud Foundry V2 | Intermediate Deep Dive
Cloud Foundry V2 | Intermediate Deep Dive
 
Docker and Windows: The State of the Union
Docker and Windows: The State of the UnionDocker and Windows: The State of the Union
Docker and Windows: The State of the Union
 
"On-premises" FaaS on Kubernetes
"On-premises" FaaS on Kubernetes"On-premises" FaaS on Kubernetes
"On-premises" FaaS on Kubernetes
 
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...
Orchestration tool roundup   kubernetes vs. docker vs. heat vs. terra form vs...Orchestration tool roundup   kubernetes vs. docker vs. heat vs. terra form vs...
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...
 
Adventures in docker compose
Adventures in docker composeAdventures in docker compose
Adventures in docker compose
 
Messaging with the Docker
Messaging with the DockerMessaging with the Docker
Messaging with the Docker
 
CloudFoundry@home
CloudFoundry@homeCloudFoundry@home
CloudFoundry@home
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 intro
 
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...
 
Docker and CloudStack
Docker and CloudStackDocker and CloudStack
Docker and CloudStack
 
Continuous integration with Docker and Ansible
Continuous integration with Docker and AnsibleContinuous integration with Docker and Ansible
Continuous integration with Docker and Ansible
 
Serverless technologies with Kubernetes
Serverless technologies with KubernetesServerless technologies with Kubernetes
Serverless technologies with Kubernetes
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
 
Container Days Boston - Kubernetes in production
Container Days Boston - Kubernetes in productionContainer Days Boston - Kubernetes in production
Container Days Boston - Kubernetes in production
 
IPC16: A Practical Introduction to Kubernetes
IPC16: A Practical Introduction to Kubernetes IPC16: A Practical Introduction to Kubernetes
IPC16: A Practical Introduction to Kubernetes
 
Introduction to CircleCI
Introduction to CircleCIIntroduction to CircleCI
Introduction to CircleCI
 

Ähnlich wie Taking Docker to Dance: Continuous Delivery on AWS

'DOCKER' & CLOUD: ENABLERS For DEVOPS
'DOCKER' & CLOUD:  ENABLERS For DEVOPS'DOCKER' & CLOUD:  ENABLERS For DEVOPS
'DOCKER' & CLOUD: ENABLERS For DEVOPSACA IT-Solutions
 
Docker and Cloud - Enables for DevOps - by ACA-IT
Docker and Cloud - Enables for DevOps - by ACA-ITDocker and Cloud - Enables for DevOps - by ACA-IT
Docker and Cloud - Enables for DevOps - by ACA-ITStijn Wijndaele
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windowsDocker, Inc.
 
Kube Your Enthusiasm
Kube Your EnthusiasmKube Your Enthusiasm
Kube Your EnthusiasmVMware Tanzu
 
Kube Your Enthusiasm - Paul Czarkowski
Kube Your Enthusiasm - Paul CzarkowskiKube Your Enthusiasm - Paul Czarkowski
Kube Your Enthusiasm - Paul CzarkowskiVMware Tanzu
 
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
 
Containers as a Service with Docker
Containers as a Service with DockerContainers as a Service with Docker
Containers as a Service with DockerDocker, Inc.
 
Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Patrick Chanezon
 
Docker Container As A Service - Mix-IT 2016
Docker Container As A Service - Mix-IT 2016Docker Container As A Service - Mix-IT 2016
Docker Container As A Service - Mix-IT 2016Patrick Chanezon
 
Running Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic BeanstalkRunning Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic BeanstalkAmazon Web Services
 
Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016Patrick Chanezon
 
Node Summit 2018: Cloud Native Node.js
Node Summit 2018: Cloud Native Node.jsNode Summit 2018: Cloud Native Node.js
Node Summit 2018: Cloud Native Node.jsChris Bailey
 
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Amazon Web Services
 

Ähnlich wie Taking Docker to Dance: Continuous Delivery on AWS (20)

Demystifying Docker101
Demystifying Docker101Demystifying Docker101
Demystifying Docker101
 
Demystifying Docker
Demystifying DockerDemystifying Docker
Demystifying Docker
 
'DOCKER' & CLOUD: ENABLERS For DEVOPS
'DOCKER' & CLOUD:  ENABLERS For DEVOPS'DOCKER' & CLOUD:  ENABLERS For DEVOPS
'DOCKER' & CLOUD: ENABLERS For DEVOPS
 
Docker and Cloud - Enables for DevOps - by ACA-IT
Docker and Cloud - Enables for DevOps - by ACA-ITDocker and Cloud - Enables for DevOps - by ACA-IT
Docker and Cloud - Enables for DevOps - by ACA-IT
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windows
 
Kube Your Enthusiasm
Kube Your EnthusiasmKube Your Enthusiasm
Kube Your Enthusiasm
 
Kube Your Enthusiasm - Paul Czarkowski
Kube Your Enthusiasm - Paul CzarkowskiKube Your Enthusiasm - Paul Czarkowski
Kube Your Enthusiasm - Paul Czarkowski
 
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
 
Docker Starter Pack
Docker Starter PackDocker Starter Pack
Docker Starter Pack
 
Containers as a Service with Docker
Containers as a Service with DockerContainers as a Service with Docker
Containers as a Service with Docker
 
Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016
 
Docker Container As A Service - Mix-IT 2016
Docker Container As A Service - Mix-IT 2016Docker Container As A Service - Mix-IT 2016
Docker Container As A Service - Mix-IT 2016
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Running Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic BeanstalkRunning Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic Beanstalk
 
0507 057 01 98 * Adana Klima Tamir Servisi
0507 057 01 98 * Adana Klima Tamir Servisi0507 057 01 98 * Adana Klima Tamir Servisi
0507 057 01 98 * Adana Klima Tamir Servisi
 
Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016
 
Node Summit 2018: Cloud Native Node.js
Node Summit 2018: Cloud Native Node.jsNode Summit 2018: Cloud Native Node.js
Node Summit 2018: Cloud Native Node.js
 
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
 
Introduction Into Docker Ecosystem
Introduction Into Docker EcosystemIntroduction Into Docker Ecosystem
Introduction Into Docker Ecosystem
 
Docker In Brief
Docker In BriefDocker In Brief
Docker In Brief
 

Kürzlich hochgeladen

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Taking Docker to Dance: Continuous Delivery on AWS

  • 1. Jessie Wei Seek Taking Docker to Dance: Continuous Delivery on AWSTwitter: @jessieweiyi
  • 2. Twitter: @jessieweiyi Why Dance? Continuous delivery requires a lot of moving parts to work with in a coordinated and smooth manner. In the container world, this translates into juggling with several containers at once… Therefore, let’s take Docker to dance!
  • 3. Twitter: @jessieweiyi Objective Show how application containerization and current cloud offerings can greatly streamline the delivery of new features from inception to production. Tools & Tech Focus on Docker and AWS (Some knowledge required). Demo App Demonstrate these concepts with a demo application.
  • 4. Twitter: @jessieweiyi How to setup a AWS-like local development environment? How to optimize the CI process to build better docker images more quickly? How to seamlessly migrate changes into production without service interruption? More specifically…. we will answer these questions:
  • 5. Twitter: @jessieweiyi application Source code: https://github.com/jessieweiyi/aws-demo-app-2019-infra A simple image processing service…
  • 6. UI API Worker Twitter: @jessieweiyi S3 SQS DynamoDB S3: Simple Storage Service SQS: Simple Queue Service
  • 8. LocalStack: https://github.com/localstack/localstack Twitter: @jessieweiyi AWS service compliant interface:  from cli: -endpoint-url http://localhost:4572  compatible with AWS SDK, no additional tooling Web console for user-friendly managementThe good …. No capabilities for services configuration on startupthe bad …. Workaround: local nc ping for service ready, and use AWS cli to setup the services needed. and the ugly! Local implementation of a wide range of AWS Services (e.g. S3, DynamoDB, SQS, SNS, Lambda, API Gateway, SES…)
  • 9. continuous integration deploy to staging deploy to prod Twitter: @jessieweiyi source Install Dependencies Unit Test Code Quality Testing Coverage Build Docker Image Security Test Publish Sanity CheckSmoke Test
  • 11. Docker Image Size Twitter: @jessieweiyi Docker image size has a considerable impact on the build (and the deployment) process, as it influences download and upload times. Keeping docker image size small has several benefits:  reduces download/upload times  reduces the attack surface  reduces the potential of incompatibilities Tips  use slim base images (-alpine, -slim, or scratch)  install only essential dependencies/packages  remove build dependencies
  • 12. Docker Build Context Twitter: @jessieweiyi With ..dockerignore file Clean checkout and without ..dockerignore file Local Dev and without ..dockerignore file docker build -t $(APP_IMAGE) . .dockerignore
  • 13. Multi-Stage Build Twitter: @jessieweiyi FROM node:10.15.3-alpine ENV usernode WORKDIR /opt/app COPY ./package.json/opt/app/package.json COPY ./yarn.lock /opt/app/yarn.lock RUN chown $user–R /opt/app USER $user RUN yarn COPY ./ /opt/app RUN yarnbuild ENTRYPOINT ["yarn"] CMD["start"] Without Multi-Stage Builds With Multi-Stage Builds 378MB 161MB
  • 14. Speed-up with Caching Twitter: @jessieweiyi Docker images are built of layers, which are incremental file-system portions, and the main contributors to the overall image size. Layer caching reduces the need to download layers during the build process, thus speeding up the build. Layer caching is the default behavior on your local environment, while it may need to be explicitly configured in your CI/CD environment.
  • 15. Enable Layer Caching in AWS Twitter: @jessieweiyi AWS CodeBuild supports caching in Local and S3, and this can be easily configured by accessing the configuration options.
  • 16. Use Cached Docker Image version: 0.2 phases: pre_build: commands: - `aws ecr get-login --region $(AWS_REGION) --no-include-email` - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) - VERSION=${COMMIT_HASH:=latest} - docker pull $(REGISTRY)/aws-demo-app-2019-api-build:latest || exit 0 build: commands: - docker build --cache-from $REGISTRY/aws-demo-app-2019-api-build:latest -t aws-demo-app-2019-api:$VERSION . post_build: commands: - docker tag aws-demo-app-2019-api:$VERSION $REGISTRY/aws-demo-app-2019-api:$VERSION - docker push $REGISTRY/aws-demo-app-2019-api:$VERSION - docker tag aws-demo-app-2019-api:$VERSION $REGISTRY/aws-demo-app-2019-api:latest - docker push $(REGISTRY)/aws-demo-app-2019-api:latest - docker build --target dependencies --cache-from $REGISTRY/aws-demo-app-2019-api-build:latest -t $REGISTRY/aws-demo-app-2019-api-build:latest . - docker push $REGISTRY/aws-demo-app-2019-api-build:latest artifacts: files: imagedefinitions.json Twitter: @jessieweiyi
  • 17. Docker Hosting Twitter: @jessieweiyi Docker and Docker Compose are a good solution for a local environment, but in production we need something more…. … in short, we need a “much bigger boat”! rolling updates for uninterrupted service container orchestration elastic scalability, to serve varying demand
  • 18. AWS Offerings Twitter: @jessieweiyi “AWS ECS is for you if you like using Docker!” “AWS EKS is for you if you love Kubernetes!” “AWS Fargate is for you if do not want the grunt work of managing either Docker or Kubernetes!” AWS Fargate - AWS ECS Fargate Launch Mode AWS EC2 - AWS ECS EC2 Launch Mode AWS EKS - Amazon Elastic Container Service for Kubernetes ECS Vs. EKS Vs. Fargate: The Good, the Bad, the Ugly http://blog.totalcloud.io/ecs-vs-eks-vs-fargate-good-bad-ugly/
  • 19. AWS ECS Fargate Twitter: @jessieweiyi Run containers without having to manage EC2 instances Serverless Pay-as-you-go (vCPUs and memory used): ☹ more expensive than running on ECS EC2 � cheaper considering maintenance costs
  • 21. Environment Provisioning Network VPC, Subnets, Security Groups, Internet Gateway AWS Services SQS, S3, DynamoDB Table ECS Cluster ECS, Load Balancer Export-Name Fn::ImportValue ECS Service Service, Task Definition, LoadBalancerListener, Rout53RecordSet , TaskIAMRole Tip: by structuring your deployment in layers, you can make reusable components of infrastructure for other deployments! AWS CloudFormation “Infrastructure as Code” approach for your deployment topology
  • 22. Deployment Process Objective: Zero Downtime Deployments! AWS Fargate Deployment Types  Rolling updates  Blue-Green deployments
  • 23. Rolling Update  Default ECS Deployment Type  Does not require a load balancer (health check can be shell command)  Great for background tasks (e.g. demo-worker) T0 T1 Both versions exist, until connections to old version are completed. T2 After a while, only new versions exist Update!
  • 24. Blue-Green Deployments  Reduces risk  Adds complexities at scale  Great for public APIs (e.g. demo-api) T0 T1 A twin deployment with the new version is added to the load balancer, and the previous one removed Listener (port 80) Listener (port 80) Listener (port 8080) T2 Listener (port 80)
  • 25. Rolling Updates vs Blue-Green Deployments GET /hello_world { "message" :"hello worldv1" } { "message" :"hello worldv2" } from: to: Rolling Updates { "message": "helloworldv1"} { "message": "helloworldv1"} { "message": "helloworldv2"} { "message": "helloworldv1"} { "message": "helloworldv2"} { "message": "helloworldv1"} { "message": "helloworldv2"} { "message": "helloworldv2"} { "message": "helloworldv2"} { "message": "helloworldv1"} { "message": "helloworldv1"} { "message": "helloworldv1" }{ "message": "helloworldv1" } { "message": "helloworldv2"} { "message": "helloworldv2"} { "message": "helloworldv2"} { "message": "helloworldv2"} { "message": "helloworldv2"} Blue-Green DeploymentsTime
  • 26. Service Auto Scaling Twitter: @jessieweiyi  Scale up to deal with high demand during peak times  Scale down to reduce costs during periods of low utilizations  Choose the right auto-scaling metrics  Service Utilization (% of CPU, Memory)  # active connections  # jobs in the SQS queue
  • 28. Twitter: @jessieweiyi What did we cover? Setup of a local dev environment that mimics AWS services Techniques for optimizing the build process of containerized applications Overview of AWS offerings for running Docker containers Deployment updates techniques for uninterrupted service operation