(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
-
Upload
amazon-web-services -
Category
Technology
-
view
1.648 -
download
2
Transcript of (DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Dan Sommerfield, Sr. Manager
Daniele Stroppa, Solutions Architect
October 2015
DVO305
Turbo Charge Your Continuous
Deployment Pipeline with Containers
What to expect from the session
• Best practices for containers in continuous delivery
solutions
• Toolset to implement such solutions
• Demos
Why use containers for continuous delivery?
• Roll out features as quickly as possible
• Predictable and reproducible environment
• Fast feedback
Amazon EC2 Container Service
• Highly scalable container management service
• Easily manage clusters for any scale
• Flexible container placement
• Integrated with other AWS services
• Extensible
• Amazon ECS concepts
• Cluster and container instances
• Task definition and task
Development and deployment workflow
Orchestration
layer
Code
repository
Build
environment
Test
environmentDeployment
environment
Source
AWS CodeCommit
• Private Git repository
• Fully managed
• Secure
• Highly available and scalable
• Alternatives
• GitHub
• Bitbucket
Docker and Docker Toolbox
• Docker (Linux > 3.10) or Docker Toolbox (OS X,
Windows)
• Define app environment with Dockerfile
Dockerfile
FROM ruby:2.2.2
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
RUN mkdir -p /opt/web
WORKDIR /tmp
ADD Gemfile /tmp/
ADD Gemfile.lock /tmp/
RUN bundle install
ADD . /opt/web
WORKDIR /opt/web
Docker Compose
Define and run multi-container applications:
1. Define app environment with Dockerfile
2. Define services that make up your app in docker-
compose.yml
3. Run docker-compose up to start and run entire app
docker-compose.yml
proxy:
build: ./proxy
ports:
- "80:80"
links:
- web
web:
build: ./web
command: bundle exec rails server -b 0.0.0.0
environment:
- SECRET_KEY_BASE=secretkey
expose:
- "3000"
Amazon ECS CLI
• Easily create Amazon ECS clusters & supporting
resources such as EC2 instances
• Run Docker Compose configuration files on Amazon
ECS
• Available today – http://amzn.to/1jBf45a
Jenkins
• Extensible
• Flexible builds
• Ant or Maven based projects
• Docker images
• Optionally runs in Docker container
Amazon EC2 Container Registry
• Private Docker Repository
• v2 Docker Registry
• AWS Identity and Access Management (IAM) and AWS Auth
integration
• Low latency push, pulls, and inspection
• Alternatives:
• DockerHub
• Docker Trusted Registry
rspec and capybara-webkit
require 'rails_helper.rb'
feature 'Signing in' do
scenario 'can sign in' do
visit '/users/sign_in'
within("#new_user") do
fill_in 'Email', :with => '[email protected]'
fill_in 'Password', :with => 'password'
end
click_button 'Log in'
expect(page).to have_content('Signed in successfully.')
end
end
Jenkins slave Dockerfile
FROM jenkinsci/jnlp-slave
USER root
RUN apt-get update -qq && \
apt-get install -y -qq git curl wget build-essential […]
RUN apt-get install -y qt5-default libqt5webkit5-dev
RUN apt-get install -y xvfb x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps
ENV RUBY_VERSION 2.2.2
RUN echo 'gem: --no-document' >> /usr/local/etc/gemrc &&\
mkdir /src && cd /src && git clone https://github.com/sstephenson/ruby-build.git &&\
cd /src/ruby-build && ./install.sh &&\
cd / && rm -rf /src/ruby-build && ruby-build $RUBY_VERSION /usr/local
Jenkins slave Dockerfile
RUN gem update --system && gem install bundler
# Install Gems
WORKDIR /tmp
ADD Gemfile /tmp/
ADD Gemfile.lock /tmp/
RUN bundle install
USER jenkins
AWS Elastic Beanstalk
• Deploy and manage applications without worrying about
the infrastructure
• AWS Elastic Beanstalk manages your database, Elastic
Load Balancing (ELB), Amazon ECS cluster, monitoring,
and logging
• Docker support
• Single container (on Amazon EC2)
• Multi container (on Amazon ECS)
AWS CodePipeline
Model and automate your software release processes
• Rapid delivery
• Configurable workflow
• Customizable
• Highly integrated
Takeaways
• Use Amazon ECS CLI to run application
• Run Jenkins jobs in containers
• Let AWS CodePipeline orchestrate your pipeline
Related Sessions
• CMP302 - Amazon EC2 Container Service: Distributed
Applications at Scale - Thursday, Oct 8, 2:45 PM
• DVO202 - DevOps at Amazon: A Look at Our Tools and
Processes - Wednesday, Oct 7, 12:15 PM
• DVO317 - From Local Docker Development to
Production Deployments - Wednesday, Oct 7, 4:15 PM
Additional resources
• Amazon ECS CLI GitHub - http://bit.ly/1FJfWyQ
• CloudBees Docker Build and Publish plugin -
http://bit.ly/1LUryzZ
• CloudBees Jenkins ECS plugin - http://bit.ly/1RiMpNK