SlideShare ist ein Scribd-Unternehmen logo
1 von 70
Downloaden Sie, um offline zu lesen
Play Framework + 

Docker + CircleCI + AWS =
An Automated Microservice 

Build Pipeline
Josh Padnick
Wednesday, November 11, 2015
josh@PhoenixDevOps.com
@OhMyGoshJosh
What do I want out of a
Java-based microservices
infrastructure?
Java-Based
• Java-based (or modern hipster JVM language)
• No Java EE
• Reload without compile (e.g. refresh the browser)
• Native support for JSON, REST, and Websockets
• Supports “reactive” mindset (async, non-blocking, etc.)
Microservices Infrastructure
• A Universal unit of deployment (i.e. Docker)
• Continuous integration
• Continuous deployment
• Ability to run multiple containerized services on the same VM
• Simple setup
• Long-term scalability
• Minimal “undifferentiated heavy lifting”
Does this mythical
beast exist?
Actually, it’s increasingly
less mythical.
Padnick
Josh
• Full-stack engineer for 12+ years
• Professional AWS & DevOps Guy via Phoenix DevOps
• Experienced Java programmer

Lover of Scala

Favorite Web Framework is Play Framework
• josh@PhoenixDevOps.com

@OhMyGoshJosh
DevOps & AWS
• I wrote a 12,000+ word article on building
scalable web apps on AWS at https://goo.gl/
aD6gNC
• See JoshPadnick.com for prior DevOps & AWS
presentations.
• Interested in getting in touch? Contact me via
PhoenixDevOps.com.
Today’s talk is about
putting together a quick
but scalable solution for
this problem.
First we’ll cover the 

big picture concepts.
Then we’ll show it working.
We’ll end by talking about how it
could be even better.
Let’s start with
the world’s most generic
build pipeline
VCS
Developer commits code to Version Control System.
VCS
VCS notifies Build Server we have a new build.
Build Server
VCS
Build Server
- build/compile
- run the “fast” automated tests
- prepare a deployment artifact
Build Server
VCS Build Server
Build server pushes deployment artifact to artifact
repository.
Artifact
Repository
VCS Build Server
We’d like to do Continuous Deployment.
So let’s assume this was a deployable commit.
We immediately deploy the artifact.
Artifact
Repository
VCS Build Server
Artifact
Repository
Deploy to infrastructure.
Now let’s pick our
technologies.
Docker Hub
Developer commits code to GitHub.
Options
• GitHub

De facto source control system.
• BitBucket

Hosted but more enterprisey. Theoretical tighter
integration with other Atlasssian tools.
• AWS CodeCommit

No fancy UI but fully hosted git repo in AWS.
GitHub uses web hooks to automatically kick
off a build in CircleCI.
Options
• CircleCI

Hosted build tool. Awesome UI. Get up and running in an hour or
less. But no first-class support for Docker.
• Travis

Hosted build tool. Built on Jenkins behind the scenes. Comparable
to Circle. More expensive.
• Shippable

First-class Docker support, but clunky UI. Fast and customizable.
Use your own Docker container for your build environment!
• Jenkins

The self-hosted stalwart. Medium overhead in exchange for
maximum customizability.
Docker Hub
Circle will:
- build/compile
- run automated tests
- build a docker image
- push image to Docker Hub
Options
• Docker Hub

The “official” place to house Docker registries. Free for public repos; paid for
private. Poor UI, sometimes goes down. Easiest integration with rest of Docker
ecosystem, but easy to switch to another repo.
• Amazon EC2 Container Registry (ECR)

AWS’s private container registry service. Looks like a winner. Coming out by
end of year. Unless Amazon really screws up, obvious alternative to Docker
Hub.
• Google Cloud Registry (GCR)

Mature, solid solution. Lowest pull latencies with Google Cloud Engine, but
usable anywhere.
• Quay

Early docker registry upstart with superior UX. Acquired by CoreOS. Solid
solution, but probably not as compelling as AWS ECR.
Docker Hub
Docker Hub
Deploy to AWS.
Options
• Let’s just assume all AWS for now.
Options within AWS
• AWS EC2 Container Service (ECS)

Amazon’s solution for running multiple services on a single VM in docker. Not
perfect, but does an excellent job of being easy to setup and start using right away.
• AWS Elastic Beanstalk 

AWS’s equivalent of Platform-as-a-Service. Works great when using one Docker
container per VM, and meant to be scalable, but eventually you’ll want more control
over your infrastructure.
• Roll Your Own

Use a custom method to get containers deployed on your VMs.
• Container Framework

Use a framework like CoreOS+Fleet, Swarm, Mesos, Kubernetes or Nomad.
• Container Framework PaaS

Use a pre-baked solution like Deis or Flynn. Or a tool like Empire that sits on top of
ECS.
What about our 

app code?
Let’s talk about it.
• Re-architected the web framework from scratch.
• Nice dev workflow
• Young enough to be hipster; mature enough to be
stable
• Solid IDE support (IntelliJ)
• Non-blocking / async
• Outstanding performance
• Designed for RESTful APIs
Live Demo
Now let’s build up our
build pipeline live.
Step #1:
Create a base 

docker image
• We may have many different microservices using
Docker.
• A common base image = standardization
• See my base docker image at:

https://github.com/PhoenixDevOps/phxjug-ctr-base
• # BUILD THE BASE CONTAINER

cd /repos/phxdevops/phxjug-ctr-base

docker build -t "phxdevops/phxjug-ctr-base:3.2" .

docker push “phxdevops/phxjug-ctr-base:3.2"
• NOTE: You won’t have rights to push to my repo. So
replace this with your own Docker Hub repo.
Step #2:
Create a base Play
Framework docker image
• We may have many different microservices using Play.
• Also, one of Play’s downsides is that Activator (which is
really just a wrapper around SBT) uses Ivy for
dependencies, and it is painfully slow on initial downloads.
• If we create a Docker image with all our dependencies pre-
downloaded, our docker build times will be MUCH faster.
• Even if some of our dependencies are off, it’s not a big
deal. The point is that we’ll get most of them here.
• See my base docker image at:

https://github.com/PhoenixDevOps/phxjug-ctr-base-play
• # BUILD THE BASE PLAY CONTAINER

cd /repos/phxdevops/phxjug-ctr-base-play

docker build -t "phxdevops/phxjug-ctr-base-play:2.4.3" .

docker push "phxdevops/phxjug-ctr-base-play:2.4.3"
• NOTE: You won’t have rights to push to my repo. So
replace this with your own Docker Hub repo.
Step #3:
Take our Play app and build
a Docker image out of it.
• SBT includes a “dist” plugin that will create an
executable binary for our entire Play app!
• We’ll run that and make that the process around
which the Docker container executes.
• See my image at:

https://github.com/PhoenixDevOps/phxjug-play-
framework-demo
• Note that this is a standard Play app with a Dockerfile
in the root directory. “docker build” takes care of the
rest.
• # BUILD A PLAY APP IN A CONTAINER

cd /repos/phxdevops/phxjug-play-framework-demo

docker build -t "phxdevops/phxjug-play-framework-demo:demo"

docker push "phxdevops/phxjug-play-framework-demo:demo"
• NOTE: You won’t have rights to push to my repo. So
replace this with your own Docker Hub repo.
Step #4:
Define our ECS
Infrastructure in AWS.
Options
• Point and click around the AWS Web Console

Good for learning. Bad for long-term maintainability
• AWS CloudFormation

AWS’s official “infrastructure as code” tool. Pretty stable and mature,
but painfully slow to work with, and JSON format gets too verbose.
• Terraform

A brilliant achievement of infrastructure as code tooling! But still
suffers from some bugs. You can work around them once you get
the hang of it, or with guidance from experienced hands.
• Ansible

Offers similar tool, but doesn’t compare in sophistication to
CloudFormation or Terraform.
Our Choice
• We’ll use terraform.
• To save time, I’ve already provisioned the
infrastructure for today.
• But you can see the entire set of Terraform
templates I used to create my ECS cluster at
https://github.com/PhoenixDevOps/phxjug-ecs-
cluster
Wait, how does 

ECS work?
Key ECS Concepts
• Cluster
• Container Instances
Cluster
Container
Instance
Container
Instance
Container
Instance
Key Concepts
• Task Definitions
Task Definitions
• JSON object
• Describes how 1 or more containers should be
run and possibly links Container A to Container B.
• You can also use Docker Compose yml files as
an alternative to the proprietary ECS JSON
format.
Components of a 

Task Definition
• Task Family Name (e.g. “MyApp”)
• 1 or more container definitions:
• docker run command + args
• Resource requirements (CPU, Memory)
Deploying new versions of
your app
• All your app’s versions are individual “Task
Definitions” within a “Task Definition Family”
• Each time you need to deploy a new version of
your app, you’ll need a new Docker image with a
new tag. Then just create a new Task Definition
that points to the new Docker image.
• ECS handles deployment for you, but there are
some pitfalls here.
Key Concepts
• Task Definitions
• Task Definition Families
• Tasks
• Services
Task Definition
Task
Task
Task
Task
Tasks
• An “instance” of a Task Definition is a Task.
• Really, this just means a single Docker container
(or a “group” of Docker containers if the Task
Definition specified more than one Docker image).
Tasks as Services
• Should your task always remain running?
• Should it be auto-restarted if it fails?
• Might it need an ELB?
• Then you want to run your Task Definition as a
Service!
Tasks and Services
• Note that the same Task Definition…
• …can be used to run as a one-time Task
• …or a long-running Service.
• That’s because Task Definitions are really just
definitions of Docker containers and how they
should run. It doesn’t “know” anything else about
the container itself.
Task
Task
Task
Task
Task
ECS Pro’s
• Very little to manage.
• Built-in service discovery, cluster state management, and container
scheduler.
• Allows for resource-aware container placement.
• Container scheduling is pluggable.
• Fully baked GUI that allows you to learn/do most anything.
• Tolerable learning curve.
• Supported by Amazon.
• Feel free to build your own service discovery!
ECS Con’s
• Default Service Discovery:

One ELB per service = $18/service per month
—> potentially expensive
• Less flexible on deployments than you’d like.
• Lacks the power of a more general purpose
“data center operating system” such as Mesos
or Kubernetes.
Live Clickthrough
Step #5:
Configure our Play app
for circle.yml
• See https://github.com/PhoenixDevOps/phxjug-
play-framework-demo/blob/master/circle.yml
Now let’s see it all live
in action!
Q&A

Weitere ähnliche Inhalte

Was ist angesagt?

AWS re:Invent 2016: Amazon ECR Deep Dive on Image Optimization (CON401)
AWS re:Invent 2016: Amazon ECR Deep Dive on Image Optimization (CON401)AWS re:Invent 2016: Amazon ECR Deep Dive on Image Optimization (CON401)
AWS re:Invent 2016: Amazon ECR Deep Dive on Image Optimization (CON401)Amazon Web Services
 
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeployAmazon Web Services
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSDanilo Poccia
 
(CMP302) Amazon ECS: Distributed Applications at Scale
(CMP302) Amazon ECS: Distributed Applications at Scale(CMP302) Amazon ECS: Distributed Applications at Scale
(CMP302) Amazon ECS: Distributed Applications at ScaleAmazon Web Services
 
To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…Sergey Dzyuban
 
[AWS Dev Day] 앱 현대화 | AWS Fargate를 사용한 서버리스 컨테이너 활용 하기 - 삼성전자 개발자 포털 사례 - 정영준...
[AWS Dev Day] 앱 현대화 | AWS Fargate를 사용한 서버리스 컨테이너 활용 하기 - 삼성전자 개발자 포털 사례 - 정영준...[AWS Dev Day] 앱 현대화 | AWS Fargate를 사용한 서버리스 컨테이너 활용 하기 - 삼성전자 개발자 포털 사례 - 정영준...
[AWS Dev Day] 앱 현대화 | AWS Fargate를 사용한 서버리스 컨테이너 활용 하기 - 삼성전자 개발자 포털 사례 - 정영준...Amazon Web Services Korea
 
Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECSContinuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECSAmazon Web Services
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSAmazon Web Services
 
Installing WordPress on AWS
Installing WordPress on AWSInstalling WordPress on AWS
Installing WordPress on AWSManish Jain
 
DCEU 18: Automating Docker Enterprise: Hands-off Install and Upgrade
DCEU 18: Automating Docker Enterprise: Hands-off Install and UpgradeDCEU 18: Automating Docker Enterprise: Hands-off Install and Upgrade
DCEU 18: Automating Docker Enterprise: Hands-off Install and UpgradeDocker, Inc.
 
AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...
AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...
AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...Amazon Web Services
 
Raffaele Rialdi
Raffaele RialdiRaffaele Rialdi
Raffaele RialdiCodeFest
 
Transforming Infrastructure into Code - Importing existing cloud resources u...
Transforming Infrastructure into Code  - Importing existing cloud resources u...Transforming Infrastructure into Code  - Importing existing cloud resources u...
Transforming Infrastructure into Code - Importing existing cloud resources u...Shih Oon Liong
 
Angular2, Spring Boot, Docker Swarm
Angular2, Spring Boot, Docker SwarmAngular2, Spring Boot, Docker Swarm
Angular2, Spring Boot, Docker Swarm🐊 Erwin Alberto
 
Clocker - The Docker Cloud Maker
Clocker - The Docker Cloud MakerClocker - The Docker Cloud Maker
Clocker - The Docker Cloud MakerAndrew Kennedy
 
DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...
DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...
DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...Docker, Inc.
 
Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Jennifer Davis
 
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Ryan Cuprak
 

Was ist angesagt? (20)

AWS re:Invent 2016: Amazon ECR Deep Dive on Image Optimization (CON401)
AWS re:Invent 2016: Amazon ECR Deep Dive on Image Optimization (CON401)AWS re:Invent 2016: Amazon ECR Deep Dive on Image Optimization (CON401)
AWS re:Invent 2016: Amazon ECR Deep Dive on Image Optimization (CON401)
 
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
 
TIAD : Automating the aplication lifecycle
TIAD : Automating the aplication lifecycleTIAD : Automating the aplication lifecycle
TIAD : Automating the aplication lifecycle
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS
 
(CMP302) Amazon ECS: Distributed Applications at Scale
(CMP302) Amazon ECS: Distributed Applications at Scale(CMP302) Amazon ECS: Distributed Applications at Scale
(CMP302) Amazon ECS: Distributed Applications at Scale
 
To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…
 
[AWS Dev Day] 앱 현대화 | AWS Fargate를 사용한 서버리스 컨테이너 활용 하기 - 삼성전자 개발자 포털 사례 - 정영준...
[AWS Dev Day] 앱 현대화 | AWS Fargate를 사용한 서버리스 컨테이너 활용 하기 - 삼성전자 개발자 포털 사례 - 정영준...[AWS Dev Day] 앱 현대화 | AWS Fargate를 사용한 서버리스 컨테이너 활용 하기 - 삼성전자 개발자 포털 사례 - 정영준...
[AWS Dev Day] 앱 현대화 | AWS Fargate를 사용한 서버리스 컨테이너 활용 하기 - 삼성전자 개발자 포털 사례 - 정영준...
 
Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECSContinuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS
 
Installing WordPress on AWS
Installing WordPress on AWSInstalling WordPress on AWS
Installing WordPress on AWS
 
DCEU 18: Automating Docker Enterprise: Hands-off Install and Upgrade
DCEU 18: Automating Docker Enterprise: Hands-off Install and UpgradeDCEU 18: Automating Docker Enterprise: Hands-off Install and Upgrade
DCEU 18: Automating Docker Enterprise: Hands-off Install and Upgrade
 
AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...
AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...
AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...
 
Raffaele Rialdi
Raffaele RialdiRaffaele Rialdi
Raffaele Rialdi
 
TIAD : Automating the modern datacenter
TIAD : Automating the modern datacenterTIAD : Automating the modern datacenter
TIAD : Automating the modern datacenter
 
Transforming Infrastructure into Code - Importing existing cloud resources u...
Transforming Infrastructure into Code  - Importing existing cloud resources u...Transforming Infrastructure into Code  - Importing existing cloud resources u...
Transforming Infrastructure into Code - Importing existing cloud resources u...
 
Angular2, Spring Boot, Docker Swarm
Angular2, Spring Boot, Docker SwarmAngular2, Spring Boot, Docker Swarm
Angular2, Spring Boot, Docker Swarm
 
Clocker - The Docker Cloud Maker
Clocker - The Docker Cloud MakerClocker - The Docker Cloud Maker
Clocker - The Docker Cloud Maker
 
DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...
DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...
DCEU 18: Use Cases and Practical Solutions for Docker Container Storage on Sw...
 
Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015
 
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
 

Ähnlich wie Play Framework + Docker + CircleCI + AWS + EC2 Container Service

CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...E. Camden Fisher
 
Containers, Serverless and Functions in a nutshell
Containers, Serverless and Functions in a nutshellContainers, Serverless and Functions in a nutshell
Containers, Serverless and Functions in a nutshellEugene Fedorenko
 
Fits docker into devops
Fits docker into devopsFits docker into devops
Fits docker into devopsEvans Ye
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerAlan Forbes
 
Introduction to Containers & Diving a little deeper into the benefits of Con...
 Introduction to Containers & Diving a little deeper into the benefits of Con... Introduction to Containers & Diving a little deeper into the benefits of Con...
Introduction to Containers & Diving a little deeper into the benefits of Con...Synergetics Learning and Cloud Consulting
 
Docker Oxford launch - Introduction to Docker
Docker Oxford launch - Introduction to DockerDocker Oxford launch - Introduction to Docker
Docker Oxford launch - Introduction to Dockerjonatanblue
 
Head first docker
Head first dockerHead first docker
Head first dockerHan Qin
 
Dockerize the World
Dockerize the WorldDockerize the World
Dockerize the Worlddamovsky
 
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
Cloudsolutionday 2016: DevOps workflow with Docker on AWSCloudsolutionday 2016: DevOps workflow with Docker on AWS
Cloudsolutionday 2016: DevOps workflow with Docker on AWSAWS Vietnam Community
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerAditya Konarde
 
Shipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOSShipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOSRoss Kukulinski
 
Docker - Portable Deployment
Docker - Portable DeploymentDocker - Portable Deployment
Docker - Portable Deploymentjavaonfly
 
From VMs to Containers: Introducing Docker Containers for Linux and Windows S...
From VMs to Containers: Introducing Docker Containers for Linux and Windows S...From VMs to Containers: Introducing Docker Containers for Linux and Windows S...
From VMs to Containers: Introducing Docker Containers for Linux and Windows S...Ido Flatow
 
Intro to Docker November 2013
Intro to Docker November 2013Intro to Docker November 2013
Intro to Docker November 2013Docker, Inc.
 
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013dotCloud
 
Virtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesVirtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesabhishek chawla
 

Ähnlich wie Play Framework + Docker + CircleCI + AWS + EC2 Container Service (20)

CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
 
Containers, Serverless and Functions in a nutshell
Containers, Serverless and Functions in a nutshellContainers, Serverless and Functions in a nutshell
Containers, Serverless and Functions in a nutshell
 
Fits docker into devops
Fits docker into devopsFits docker into devops
Fits docker into devops
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Introduction to Containers & Diving a little deeper into the benefits of Con...
 Introduction to Containers & Diving a little deeper into the benefits of Con... Introduction to Containers & Diving a little deeper into the benefits of Con...
Introduction to Containers & Diving a little deeper into the benefits of Con...
 
Docker Oxford launch - Introduction to Docker
Docker Oxford launch - Introduction to DockerDocker Oxford launch - Introduction to Docker
Docker Oxford launch - Introduction to Docker
 
Head first docker
Head first dockerHead first docker
Head first docker
 
Dockerize the World
Dockerize the WorldDockerize the World
Dockerize the World
 
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
Cloudsolutionday 2016: DevOps workflow with Docker on AWSCloudsolutionday 2016: DevOps workflow with Docker on AWS
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Shipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOSShipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOS
 
Docker - Portable Deployment
Docker - Portable DeploymentDocker - Portable Deployment
Docker - Portable Deployment
 
From VMs to Containers: Introducing Docker Containers for Linux and Windows S...
From VMs to Containers: Introducing Docker Containers for Linux and Windows S...From VMs to Containers: Introducing Docker Containers for Linux and Windows S...
From VMs to Containers: Introducing Docker Containers for Linux and Windows S...
 
Adf with docker
Adf with dockerAdf with docker
Adf with docker
 
Intro to Docker November 2013
Intro to Docker November 2013Intro to Docker November 2013
Intro to Docker November 2013
 
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
 
Virtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesVirtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management services
 
OpenStack Summit
OpenStack SummitOpenStack Summit
OpenStack Summit
 
Docker slides
Docker slidesDocker slides
Docker slides
 
Dockerize or die
Dockerize or dieDockerize or die
Dockerize or die
 

Kürzlich hochgeladen

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 

Kürzlich hochgeladen (20)

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 

Play Framework + Docker + CircleCI + AWS + EC2 Container Service

  • 1. Play Framework + 
 Docker + CircleCI + AWS = An Automated Microservice 
 Build Pipeline Josh Padnick Wednesday, November 11, 2015 josh@PhoenixDevOps.com @OhMyGoshJosh
  • 2. What do I want out of a Java-based microservices infrastructure?
  • 3. Java-Based • Java-based (or modern hipster JVM language) • No Java EE • Reload without compile (e.g. refresh the browser) • Native support for JSON, REST, and Websockets • Supports “reactive” mindset (async, non-blocking, etc.)
  • 4. Microservices Infrastructure • A Universal unit of deployment (i.e. Docker) • Continuous integration • Continuous deployment • Ability to run multiple containerized services on the same VM • Simple setup • Long-term scalability • Minimal “undifferentiated heavy lifting”
  • 7. Padnick Josh • Full-stack engineer for 12+ years • Professional AWS & DevOps Guy via Phoenix DevOps • Experienced Java programmer
 Lover of Scala
 Favorite Web Framework is Play Framework • josh@PhoenixDevOps.com
 @OhMyGoshJosh
  • 8. DevOps & AWS • I wrote a 12,000+ word article on building scalable web apps on AWS at https://goo.gl/ aD6gNC • See JoshPadnick.com for prior DevOps & AWS presentations. • Interested in getting in touch? Contact me via PhoenixDevOps.com.
  • 9. Today’s talk is about putting together a quick but scalable solution for this problem.
  • 10. First we’ll cover the 
 big picture concepts. Then we’ll show it working. We’ll end by talking about how it could be even better.
  • 11. Let’s start with the world’s most generic build pipeline
  • 12. VCS Developer commits code to Version Control System.
  • 13. VCS VCS notifies Build Server we have a new build. Build Server
  • 14. VCS Build Server - build/compile - run the “fast” automated tests - prepare a deployment artifact Build Server
  • 15. VCS Build Server Build server pushes deployment artifact to artifact repository. Artifact Repository
  • 16. VCS Build Server We’d like to do Continuous Deployment. So let’s assume this was a deployable commit. We immediately deploy the artifact. Artifact Repository
  • 18. Now let’s pick our technologies.
  • 21. Options • GitHub
 De facto source control system. • BitBucket
 Hosted but more enterprisey. Theoretical tighter integration with other Atlasssian tools. • AWS CodeCommit
 No fancy UI but fully hosted git repo in AWS.
  • 22.
  • 23. GitHub uses web hooks to automatically kick off a build in CircleCI.
  • 24. Options • CircleCI
 Hosted build tool. Awesome UI. Get up and running in an hour or less. But no first-class support for Docker. • Travis
 Hosted build tool. Built on Jenkins behind the scenes. Comparable to Circle. More expensive. • Shippable
 First-class Docker support, but clunky UI. Fast and customizable. Use your own Docker container for your build environment! • Jenkins
 The self-hosted stalwart. Medium overhead in exchange for maximum customizability.
  • 25.
  • 26. Docker Hub Circle will: - build/compile - run automated tests - build a docker image - push image to Docker Hub
  • 27. Options • Docker Hub
 The “official” place to house Docker registries. Free for public repos; paid for private. Poor UI, sometimes goes down. Easiest integration with rest of Docker ecosystem, but easy to switch to another repo. • Amazon EC2 Container Registry (ECR)
 AWS’s private container registry service. Looks like a winner. Coming out by end of year. Unless Amazon really screws up, obvious alternative to Docker Hub. • Google Cloud Registry (GCR)
 Mature, solid solution. Lowest pull latencies with Google Cloud Engine, but usable anywhere. • Quay
 Early docker registry upstart with superior UX. Acquired by CoreOS. Solid solution, but probably not as compelling as AWS ECR.
  • 30. Options • Let’s just assume all AWS for now.
  • 31. Options within AWS • AWS EC2 Container Service (ECS)
 Amazon’s solution for running multiple services on a single VM in docker. Not perfect, but does an excellent job of being easy to setup and start using right away. • AWS Elastic Beanstalk 
 AWS’s equivalent of Platform-as-a-Service. Works great when using one Docker container per VM, and meant to be scalable, but eventually you’ll want more control over your infrastructure. • Roll Your Own
 Use a custom method to get containers deployed on your VMs. • Container Framework
 Use a framework like CoreOS+Fleet, Swarm, Mesos, Kubernetes or Nomad. • Container Framework PaaS
 Use a pre-baked solution like Deis or Flynn. Or a tool like Empire that sits on top of ECS.
  • 32. What about our 
 app code?
  • 34. • Re-architected the web framework from scratch. • Nice dev workflow • Young enough to be hipster; mature enough to be stable • Solid IDE support (IntelliJ) • Non-blocking / async • Outstanding performance • Designed for RESTful APIs
  • 36. Now let’s build up our build pipeline live.
  • 37. Step #1: Create a base 
 docker image
  • 38. • We may have many different microservices using Docker. • A common base image = standardization • See my base docker image at:
 https://github.com/PhoenixDevOps/phxjug-ctr-base
  • 39. • # BUILD THE BASE CONTAINER
 cd /repos/phxdevops/phxjug-ctr-base
 docker build -t "phxdevops/phxjug-ctr-base:3.2" .
 docker push “phxdevops/phxjug-ctr-base:3.2" • NOTE: You won’t have rights to push to my repo. So replace this with your own Docker Hub repo.
  • 40. Step #2: Create a base Play Framework docker image
  • 41. • We may have many different microservices using Play. • Also, one of Play’s downsides is that Activator (which is really just a wrapper around SBT) uses Ivy for dependencies, and it is painfully slow on initial downloads. • If we create a Docker image with all our dependencies pre- downloaded, our docker build times will be MUCH faster. • Even if some of our dependencies are off, it’s not a big deal. The point is that we’ll get most of them here. • See my base docker image at:
 https://github.com/PhoenixDevOps/phxjug-ctr-base-play
  • 42. • # BUILD THE BASE PLAY CONTAINER
 cd /repos/phxdevops/phxjug-ctr-base-play
 docker build -t "phxdevops/phxjug-ctr-base-play:2.4.3" .
 docker push "phxdevops/phxjug-ctr-base-play:2.4.3" • NOTE: You won’t have rights to push to my repo. So replace this with your own Docker Hub repo.
  • 43. Step #3: Take our Play app and build a Docker image out of it.
  • 44. • SBT includes a “dist” plugin that will create an executable binary for our entire Play app! • We’ll run that and make that the process around which the Docker container executes. • See my image at:
 https://github.com/PhoenixDevOps/phxjug-play- framework-demo • Note that this is a standard Play app with a Dockerfile in the root directory. “docker build” takes care of the rest.
  • 45. • # BUILD A PLAY APP IN A CONTAINER
 cd /repos/phxdevops/phxjug-play-framework-demo
 docker build -t "phxdevops/phxjug-play-framework-demo:demo"
 docker push "phxdevops/phxjug-play-framework-demo:demo" • NOTE: You won’t have rights to push to my repo. So replace this with your own Docker Hub repo.
  • 46. Step #4: Define our ECS Infrastructure in AWS.
  • 47. Options • Point and click around the AWS Web Console
 Good for learning. Bad for long-term maintainability • AWS CloudFormation
 AWS’s official “infrastructure as code” tool. Pretty stable and mature, but painfully slow to work with, and JSON format gets too verbose. • Terraform
 A brilliant achievement of infrastructure as code tooling! But still suffers from some bugs. You can work around them once you get the hang of it, or with guidance from experienced hands. • Ansible
 Offers similar tool, but doesn’t compare in sophistication to CloudFormation or Terraform.
  • 48. Our Choice • We’ll use terraform. • To save time, I’ve already provisioned the infrastructure for today. • But you can see the entire set of Terraform templates I used to create my ECS cluster at https://github.com/PhoenixDevOps/phxjug-ecs- cluster
  • 49. Wait, how does 
 ECS work?
  • 50. Key ECS Concepts • Cluster • Container Instances
  • 53. Key Concepts • Task Definitions
  • 54. Task Definitions • JSON object • Describes how 1 or more containers should be run and possibly links Container A to Container B. • You can also use Docker Compose yml files as an alternative to the proprietary ECS JSON format.
  • 55. Components of a 
 Task Definition • Task Family Name (e.g. “MyApp”) • 1 or more container definitions: • docker run command + args • Resource requirements (CPU, Memory)
  • 56. Deploying new versions of your app • All your app’s versions are individual “Task Definitions” within a “Task Definition Family” • Each time you need to deploy a new version of your app, you’ll need a new Docker image with a new tag. Then just create a new Task Definition that points to the new Docker image. • ECS handles deployment for you, but there are some pitfalls here.
  • 57.
  • 58. Key Concepts • Task Definitions • Task Definition Families • Tasks • Services
  • 60. Tasks • An “instance” of a Task Definition is a Task. • Really, this just means a single Docker container (or a “group” of Docker containers if the Task Definition specified more than one Docker image).
  • 61. Tasks as Services • Should your task always remain running? • Should it be auto-restarted if it fails? • Might it need an ELB? • Then you want to run your Task Definition as a Service!
  • 62. Tasks and Services • Note that the same Task Definition… • …can be used to run as a one-time Task • …or a long-running Service. • That’s because Task Definitions are really just definitions of Docker containers and how they should run. It doesn’t “know” anything else about the container itself.
  • 64. ECS Pro’s • Very little to manage. • Built-in service discovery, cluster state management, and container scheduler. • Allows for resource-aware container placement. • Container scheduling is pluggable. • Fully baked GUI that allows you to learn/do most anything. • Tolerable learning curve. • Supported by Amazon. • Feel free to build your own service discovery!
  • 65. ECS Con’s • Default Service Discovery:
 One ELB per service = $18/service per month —> potentially expensive • Less flexible on deployments than you’d like. • Lacks the power of a more general purpose “data center operating system” such as Mesos or Kubernetes.
  • 67. Step #5: Configure our Play app for circle.yml
  • 69. Now let’s see it all live in action!
  • 70. Q&A