SlideShare ist ein Scribd-Unternehmen logo
1 von 91
Downloaden Sie, um offline zu lesen
Easing Your Way Into Docker
Lessons From a Journey to Production
ContainerDays NYC
October 30, 2015
Who are we?
Steve Woodruff
❏ DevOps Engineer at SpareFoot
implementing CI/CD
❏ Spent 10+ years at Motorola doing
embedded development (C, C++)
❏ Spent 5 years at IBM as a sys admin in a
large server farm (Linux, AIX, Solaris)
swoodruff@sparefoot.com
Twitter: @sjwoodr
GitHub: sjwoodr
Patrick Mizer
❏ Software Engineer at SpareFoot (6
years)
❏ 12 years as a developer in
consumer web
❏ Convinced Steve to keep letting us
play w/ containers even after we
messed it up countless times
patrick@sparefoot.com
GitHub: maximizer
● Think Hotels.com for self storage*
● All infrastructure in AWS
● 40 Developers on 7 Teams
○ Continuous Delivery
● Docker in production since 2014
*This kind of storage:
What We Will Talk About
● We solved some problems with
Docker Containers
● We started small and eventually
got to production
● We ffff...messed up a lot along
the way
This is the talk that we would have
liked to see before we learned these
lessons the hard way...
Chapter 1 - Hackathons and Docker
The Beginning: SpareFoot + Docker
Hackathon! Docker + Fig
(now compose) allowed us to
run production architecture
locally.
The Development Environment
● We want to be as close as possible to
production
● We want the development environment to be
as fast as possible for interactive use.
Developing Locally
% apt-get install...
% brew install…
% make && make install…
Developing Locally
Virtual
Machine
% vagrant up
Complexity ++
App
Service
Data
[ JSON / REST API ]
Aha: Vagrant + Docker?
Virtual
Machine
% vagrant up
App 1
Redis
Solr Search
MySQL DB
Containers
App 2
Putting it together with Compose
Virtual
Machine
% vagrant up
App 1
Redis
Solr Search
MySQL DB
Containers
App 2
% fig up
Lessons Learned
● Docker creates application isolation in a super lightweight way
○ We can model our production infrastructure locally
● Compose is fantastic for the local dev environment
● Vagrant + Docker gets us an interactive local dev environment via synced
folders and volumes
● We got to cut our teeth on Docker
Chapter 2 - Docker in Production (kind of)
Sparephone
(512)921-5050
Sparephone
Sparephone
Yim - Call Center Application
● Used exclusively by
our call center
○ Chrome ONLY
● Node version n+1
● React + Flux
Vers. n+1
Yim - Call Center Application
● Used exclusively by
our call center
○ Chrome ONLY
● Node version n+1
● React + Flux
Vers. n+1
Vers. n+1
Yim - Call Center Application
● Used exclusively by
our call center
○ Chrome ONLY
● Node version n+1
● React + Flux
Vers. n+1
Vers. n+1
Vers. n
Yim - Call Center Application
● Used exclusively by
our call center
○ Chrome ONLY
● Node version n+1
● React + Flux
Vers. n+1
Vers. n+1
Vers. n
Separation of concerns
Encapsulation
Inside of the container
● Code
● Libraries
● Package Manager
Interface
Outside of the container
● Orchestration
● Logging
● Monitoring
● Configuration Management
Docker?
App 1
Ok, so Docker feels like the a solution
… and we kind of know how to do this. But....
● Continuous Integration / Delivery?
○ Docker Registry
○ Bamboo
○ Deployments
● Host Volumes and Port Forwarding rules?
○ Not saved with the source code
● Get Docker to run in local, dev, staging, and production environments?
○ Configuration?
CI and deployments
Janky shell scripts… slow builds, etc…
● Used Bamboo to build images
○ feature branches were built/deployed to Dev
○ master branch was built/deployed to Staging
● Dynamically created custom container start script
● Tried to auto-detect when the containers started to begin post-deploy test
● Build times were rather long
● Spent an awful long time doing docker push (to our registry) and docker pull
(on the target hosts)
Host Volumes and port forwarding rules
● Exposed / Published ports were handled via a text file we parsed at build time
● Tried to accommodate the future when we’d have more apps/containers
● Host volumes that had to be mounted were hard coded in the Bamboo build
plan for the app so they could be added to that dynamically created container
start script
Get Docker running
Supporting multiple environments
● Bamboo would deploy rather well to DEV and STAGE using these
dynamically created scripts.
● Felt rather fragile and could break at any time
● Production deploys were scripts that would do a docker pull on several hosts
and then kill the old containers on a host, start the new containers on that
host, and then move on to the next host.
● Wasn’t always a zero-downtime deployment
Docker in Production (technically)!
We had 2 load balanced
EC2 instances running a
node app.
ELB
443
3000 3000
Docker in Production (technically)!
We had 2 load balanced
EC2 instances running a
node app.
Now we have 2 load
balanced EC2 instances
running docker containers
that run a node app!
ELB
443
3000 3000
ELB
App 1 App 1
3000 3000
443
Docker in Production (technically)!
ELB ELB
App 1 App 1
We had 2 load balanced
EC2 instances running a
node app.
Now we have 2 load
balanced EC2 instances
running docker containers
that run a node app!
NEW443
3000 3000 3000 3000
443
Yim: Trouble in Docker Paradise
● Hosting our own Docker registry was a bad idea
○ Stability was a problem
○ No level of access control on the registry itself
● Mimicking servers - 1 container per host. Need orchestration please!
● Amazon Linux AMI -> old version of Docker… doh!
● Docker push/pull to/from registry was very slow
○ build - push to registry
○ deploy - pull from registry to each host, serially
● Performance was fine….
○ But stability was the issue
○ This internal-facing nodejs app was moved to a pair of EC2 instances and out of Docker after
about 4 months of pain and suffering
Yim: Lessons Learned
● We need orchestration
○ Rolling our own docker deployments was confusing to OPS and to the
Dev team
● Our own docker registry is a bad idea
○ Stability was a problem
○ No level of access control on the registry itself
○ Our S3 backend would grow by several GB per month with no automated
cleanup
● No easy way to rollback failed deploys
○ Just fix it and deploy again...
● All this culminated in a poor build process and affected CI velocity
○ Longer builds, longer deploys, no real gain
Chapter 3 - Microservices
Like everyone else....
...we are “deconstructing the monolith”
Application
Monolithic Library
Data
Like everyone else....
...we are “deconstructing the monolith”
Application
Monolithic Library
Data
REST API
Like everyone else....
...we are “deconstructing the monolith”
Application
Monolithic Library
Data
REST API
Data
Microservice
Like everyone else....
...we are “deconstructing the monolith”
Application
REST API
Data
Microservice
REST API
Data
Microservice
REST API
Data
Microservice
REST API
Data
Microservice
API Gateway
Revisiting The Development Environment
● We want to be as close as possible to
production
● We want the development environment to be
as fast as possible for interactive use
● We want our microservices isolated
Revisiting The Development Environment
App1 App2
MySQL
Revisiting The Development Environment
Service1
MySQL
Service2
Service3
App1 App2
MySQL
Revisiting The Development Environment
Service1
MySQL
Service2
Service3
????
App1 App2
MySQL
Revisiting The Development Environment
Service1
MySQL
Service2
Service3
App1 App2
MySQL
Revisiting The Development Environment
HTTP
App1 App2
MySQL
Revisiting The Development Environment
Service1
Service2
Service3
HTTP
App1 App2
MySQL
“Tres Vagrantres”
Service1
Service2
Service3
MySQL
HTTP
App1 App2
“Tres Vagrantres”
Service1
Service2
Service3
MySQL
App1 App2
HTTP
● We want to be as close as possible to production
● We want the development environment to be as fast
as possible for interactive use.
We want our microservices
isolated.
Bonus: Ownership
Service1
Service2
Service3
MySQL
App1 App2
Consumer Services
Operations / DBA
Feature Team
HTTP
Slinging images
Service1
Service2
Service3
Consumer Services
Microservice developers
push images to registry.
Vagrant pulls images by
tag. Access controlled
hopefully.
???
A Better Docker Registry
With Yim we learned that rolling our own Registry was a bad idea.
● Limited Access Control
● We have to maintain it
Let’s try Quay...
● Has Access Control
○ Robots, yusss!
● We don’t have to
maintain it
MASTER
BRANCH A
Dev Staging Production
MASTER
BRANCH A
Dev Staging Production
MASTER
BRANCH A
Dev Staging
Service1
service1:prod
Production
Service1
service1:stage
Service1
service1:dev-branch-name
MASTER
BRANCH A
Service1
service1:prod
Service1
service1:stage
Service1
service1:dev-branch-name
MASTER
BRANCH A
Service1
service1:prod
Service1
service1:stage
Service1
service1:dev-branch-name
Service1
Service2
Service3
App1 App2
HTTP
We’ve learned some things...
● Easier than we thought
● Quay was the glue we needed
○ Use an off the shelf solution.
○ We like Quay.io
● Bolting on to our existing CI pipeline worked really well.
○ Developers didn’t have to learn new process
○ Microservice consumers can pull tagged versions
○ We can automate tests against all versions
Now we talk containers from local -> dev -> staging but NOT
in production.
Chapter 4 - To Production! (seriously this time)
Production - What is still needed
● Orchestration
○ Yim sucked because we tried to do this ourselves
● Better Deployments
○ With rollbacks
● Configuration Management
○ We have things to hide
Production - Orchestration
Production - Orchestration
Production - Software Selection
● Choosing orchestration software / container service
○ StackEngine
■ Lacked docker-compose support
○ Kubernetes
■ PhD Required
○ Mesosphere
■ Nice, but slow to deploy
○ EC2 Container Service
■ Lacked docker-compose support and custom AMIs
○ Tutum
○ Rancher
Production - Enter Rancher
After running proof-of-concepts of both Tutum and Rancher, we decided to
continue down our path to production deploys with Rancher.
● Had more mature support for docker-compose files.
○ Tutum added this after our evaluation had ended
● Did not require us to orchestrate the deployments through their remote
endpoint
○ Rancher server runs on our EC2 instances and we are in full control of all the things
● Had a full API we can work with in addition to the custom rancher-compose cli
● Had a very-active user community and a beta-forum where the Rancher
development team was active in answering questions and even
troubleshooting configuration problems.
Overlaying Docker on AWS
● ELB as a front-end to each service
● ELB load balances to haproxy containers
● HAProxy containers load balance to the service containers
Overlaying Docker on AWS
ELB
EC2
Overlaying Docker on AWS
ELB
EC2
Containers
Overlaying Docker on AWS
● Why the extra HAProxy layer?
○ Allows us to create the ELB and leave them alone
○ When we deploy new versioned services we update the service alias / haproxy links
○ Allows for fast rollback to previous version of the service
Deployments and Rollbacks
● Developers can deploy to production whenever they want
○ HipChat bot commands to deploy and rollback/revert
● Deployments to each of the 3 environments use rancher-compose to
○ Deploy new versioned services / containers
○ Create or update service aliases / haproxy links
○ Delete previous versioned services except for current and previous
● When things go haywire…
○ We simply rollback
○ Production deploy creates a docker-compose-rollback.yml file
■ Query Rancher API to get list of running services
■ Allows us to change haproxy and service alias links back to the previous version
■ Super fast to rollback, no containers need to be spun up!
Overlaying Docker on AWS
ELB
EC2
Containers
Overlaying Docker on AWS
ELB
EC2
Containers
Overlaying Docker on AWS
ELB
EC2
Containers
Overlaying Docker on AWS
ELB
EC2
Containers
Rollback!
Technical Challenge - docker-compose
● We needed to support a single docker-compose.yml file, maintained by
developers of an app or service
○ They don’t want to maintain local, dev, stage, and prod versions of this file
○ Changes to multiple files would be error-prone
○ Must support differences in the architecture or configuration of services across environments
○ Secret Secret, I’ve got a Secret
Secret Management
We’re already using SaltStack to manage our EC2 minions (VMs)
● Salt Grains are used for some common variables used in salt states
● Salt Pillar Data exists which is configuration data available only to certain
minions
● This Salt Pillar Data is already broken down by environment (dev/stage/prod)
● We should just use this data to dynamically create the docker-compose and
rancher-compose files!
A templated rancher-compose file
{% set sf_env = grains['bookingservice-env'] %}
{% set version = grains['bookingservice-version'] %}
bookingservice-{{ sf_env }}-{{ version }}:
scale: 1
We use a scale of 1 because we use global host scheduling combined with host affinity so that one
container of this service is deployed to each VM of the specified environment (dev/stage/prod). This
allows us to spin up a new Rancher host and easily deploy to the new host VM.
A templated docker-compose file
A Closer Look
MYSQL_SPAREFOOT_HOST: {{ salt['pillar.get']('bookingservice-dev:MYSQL_SPAREFOOT_HOST') }}
MYSQL_SPAREFOOT_DB: {{ salt['pillar.get']('bookingservice-dev:MYSQL_SPAREFOOT_DB') }}
MYSQL_SPAREFOOT_USER: {{ salt['pillar.get']('bookingservice-dev:MYSQL_SPAREFOOT_USER') }}
MYSQL_SPAREFOOT_PASS: {{ salt['pillar.get']('bookingservice-dev:MYSQL_SPAREFOOT_PASS') }}
MYSQL_SPAREFOOT_PORT: {{ salt['pillar.get']('bookingservice-dev:MYSQL_SPAREFOOT_PORT') }}
APP_LOG_FILE: {{ salt['pillar.get']('bookingservice-dev:APP_LOG_FILE') }}
REDIS_HOST: {{ salt['pillar.get']('bookingservice-dev:REDIS_HOST') }}
REDIS_PORT: {{ salt['pillar.get']('bookingservice-dev:REDIS_PORT') }}
Deployments with rancher-compose
● Deployments to Dev and Staging are done via Bamboo
● Deployments to Production are done by developers via HipChat commands
● In the end, everything is invoking our salt-deploy.py script
○ Set some salt grains for target env, version, buildid, image tag in quay.io
○ Services get versioned with a timestamp and bamboo build id
○ Render jinja2 / Inject Salt grains and pillar data via salt minion python code
■ caller.sminion.functions['cp.get_template'](cwd +
'/docker-compose.yml', cwd + '/docker-compose-salt.yml')
■ caller.sminion.functions['cp.get_template'](cwd +
'/rancher-compose.yml', cwd + '/rancher-compose-salt.yml')
○ Invokes rancher-compose create / up
○ Cleanup to keep the live verison of a service and live-1 version. The rest are purged.
Surprise! Rancher Adds Variable Support
Does the support for interpolating variables, added in Rancher 0.41, deprecate the
work we've done with Salt and rendering jinja2 templates?
● No. We already maintain data in grains and pillars so we just reuse that data.
● Rancher implementation uses the environment variables on the host running
rancher-compose to fill in the blanks
● It would require logic to load those env variables based on the target env
(dev/stage/prod) so might as well get the data out of salt pillar which has
separate pillars for each service and then broken down by target environment.
So we deployed our first microservice and...
So we deployed our first microservice and...
...Everything worked...
So we deployed our first microservice and...
...Everything worked...
… Until it didn’t.
The Day Rancher Died
ELB
EC2
Containers
The Day Rancher Died
ELB
EC2
Containers
The Day Rancher Died
ELB
EC2
Containers
Where are we now?
● 10 Microservices in production with Rancher + Docker
○ 5-10 Deployments per day on average
○ Busiest services handling around 50 requests / second
● Consumer facing applications being containerized in
development
○ New teams cutting their teeth
○ Keep on “Strangling”*
* DO NOT: google image search for “strangling hands”
Finally
● Start small
● Fail (a lot)
● Move on and apply
what you learned
Thank you!
Slides: http://bit.ly/1S88LBX
Reach out:
● Patrick (patrick@sparefoot.com)
● Steve (swoodruff@sparefoot.com, Twitter @sjwoodr)
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Modernizing Java Apps with Docker
Modernizing Java Apps with DockerModernizing Java Apps with Docker
Modernizing Java Apps with DockerDocker, Inc.
 
Taking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and DecideTaking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and DecideDocker, Inc.
 
Containerised Testing at Demonware : PyCon Ireland 2016
Containerised Testing at Demonware : PyCon Ireland 2016Containerised Testing at Demonware : PyCon Ireland 2016
Containerised Testing at Demonware : PyCon Ireland 2016Thomas Shaw
 
Use the Source or Join the Dark Side: differences between Docker Community an...
Use the Source or Join the Dark Side: differences between Docker Community an...Use the Source or Join the Dark Side: differences between Docker Community an...
Use the Source or Join the Dark Side: differences between Docker Community an...Jérôme Petazzoni
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...Jérôme Petazzoni
 
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...Simplilearn
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopJirayut Nimsaeng
 
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...Docker, Inc.
 
Docker Bday #5, SF Edition: Introduction to Docker
Docker Bday #5, SF Edition: Introduction to DockerDocker Bday #5, SF Edition: Introduction to Docker
Docker Bday #5, SF Edition: Introduction to DockerDocker, Inc.
 
LinuxKit Deep Dive
LinuxKit Deep DiveLinuxKit Deep Dive
LinuxKit Deep DiveDocker, Inc.
 
create auto scale jboss cluster with openshift
create auto scale jboss cluster with openshiftcreate auto scale jboss cluster with openshift
create auto scale jboss cluster with openshiftYusuf Hadiwinata Sutandar
 
Rami Sayar - Node microservices with Docker
Rami Sayar - Node microservices with DockerRami Sayar - Node microservices with Docker
Rami Sayar - Node microservices with DockerWeb à Québec
 
Intro to Docker and clustering with Rancher from scratch
Intro to Docker and clustering with Rancher from scratchIntro to Docker and clustering with Rancher from scratch
Intro to Docker and clustering with Rancher from scratchJohn Culviner
 
PHPIDOL#80: Kubernetes 101 for PHP Developer. Yusuf Hadiwinata - VP Operation...
PHPIDOL#80: Kubernetes 101 for PHP Developer. Yusuf Hadiwinata - VP Operation...PHPIDOL#80: Kubernetes 101 for PHP Developer. Yusuf Hadiwinata - VP Operation...
PHPIDOL#80: Kubernetes 101 for PHP Developer. Yusuf Hadiwinata - VP Operation...Yusuf Hadiwinata Sutandar
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerAdam Štipák
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerJames Turnbull
 

Was ist angesagt? (20)

Modernizing Java Apps with Docker
Modernizing Java Apps with DockerModernizing Java Apps with Docker
Modernizing Java Apps with Docker
 
Taking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and DecideTaking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and Decide
 
Containerised Testing at Demonware : PyCon Ireland 2016
Containerised Testing at Demonware : PyCon Ireland 2016Containerised Testing at Demonware : PyCon Ireland 2016
Containerised Testing at Demonware : PyCon Ireland 2016
 
Use the Source or Join the Dark Side: differences between Docker Community an...
Use the Source or Join the Dark Side: differences between Docker Community an...Use the Source or Join the Dark Side: differences between Docker Community an...
Use the Source or Join the Dark Side: differences between Docker Community an...
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
 
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery Workshop
 
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
 
Docker Bday #5, SF Edition: Introduction to Docker
Docker Bday #5, SF Edition: Introduction to DockerDocker Bday #5, SF Edition: Introduction to Docker
Docker Bday #5, SF Edition: Introduction to Docker
 
I3 docker-intro-yusuf
I3 docker-intro-yusufI3 docker-intro-yusuf
I3 docker-intro-yusuf
 
LinuxKit Deep Dive
LinuxKit Deep DiveLinuxKit Deep Dive
LinuxKit Deep Dive
 
create auto scale jboss cluster with openshift
create auto scale jboss cluster with openshiftcreate auto scale jboss cluster with openshift
create auto scale jboss cluster with openshift
 
Rami Sayar - Node microservices with Docker
Rami Sayar - Node microservices with DockerRami Sayar - Node microservices with Docker
Rami Sayar - Node microservices with Docker
 
Virtual Container - Docker
Virtual Container - Docker Virtual Container - Docker
Virtual Container - Docker
 
Intro to Docker and clustering with Rancher from scratch
Intro to Docker and clustering with Rancher from scratchIntro to Docker and clustering with Rancher from scratch
Intro to Docker and clustering with Rancher from scratch
 
PHPIDOL#80: Kubernetes 101 for PHP Developer. Yusuf Hadiwinata - VP Operation...
PHPIDOL#80: Kubernetes 101 for PHP Developer. Yusuf Hadiwinata - VP Operation...PHPIDOL#80: Kubernetes 101 for PHP Developer. Yusuf Hadiwinata - VP Operation...
PHPIDOL#80: Kubernetes 101 for PHP Developer. Yusuf Hadiwinata - VP Operation...
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker, what's next ?
Docker, what's next ?Docker, what's next ?
Docker, what's next ?
 

Andere mochten auch

Comprehensive Support for Self Management of Medications by a Networked Robot...
Comprehensive Support for Self Management of Medications by a Networked Robot...Comprehensive Support for Self Management of Medications by a Networked Robot...
Comprehensive Support for Self Management of Medications by a Networked Robot...Health Informatics New Zealand
 
WordPress Visual Editor Mastery
WordPress Visual Editor MasteryWordPress Visual Editor Mastery
WordPress Visual Editor MasteryAnthony Hortin
 
101 Ways to Elevate Yourself and Demand Higher Fees
101 Ways to Elevate Yourself and Demand Higher Fees101 Ways to Elevate Yourself and Demand Higher Fees
101 Ways to Elevate Yourself and Demand Higher FeesTroy Dean
 
Direct Purposeful Experience
Direct Purposeful ExperienceDirect Purposeful Experience
Direct Purposeful ExperienceRenalyn Advincola
 
Have you been vaccinated
Have you been vaccinatedHave you been vaccinated
Have you been vaccinatedoakke01
 
PayPal on iOS + 9 great free app ideas
PayPal on iOS + 9 great free app ideasPayPal on iOS + 9 great free app ideas
PayPal on iOS + 9 great free app ideasCristiano Betta
 
FinalPresentation_FINAL
FinalPresentation_FINALFinalPresentation_FINAL
FinalPresentation_FINALJames McKenna
 
Building a Dream Team
Building a Dream TeamBuilding a Dream Team
Building a Dream TeamMike Aparicio
 
Have you been vaccinated
Have you been vaccinatedHave you been vaccinated
Have you been vaccinatedoakke01
 
The Future of Identification
The Future of IdentificationThe Future of Identification
The Future of IdentificationJonathan LeBlanc
 
IoT Commerce using Ruby, PHP and Arduino
IoT Commerce using Ruby, PHP and Arduino IoT Commerce using Ruby, PHP and Arduino
IoT Commerce using Ruby, PHP and Arduino Steven Cooper
 
Rapyuta a cloud robotics platform
Rapyuta a cloud robotics platformRapyuta a cloud robotics platform
Rapyuta a cloud robotics platformieeepondy
 
Internet of Things With PHP
Internet of Things With PHPInternet of Things With PHP
Internet of Things With PHPAdam Englander
 
Teaching with Visual Symbols
Teaching with Visual SymbolsTeaching with Visual Symbols
Teaching with Visual SymbolsRenalyn Advincola
 
Getting into WordPress Front End Development
Getting into WordPress Front End DevelopmentGetting into WordPress Front End Development
Getting into WordPress Front End DevelopmentDenise (Dee) Teal
 
Timo Sirainen - Dovecot Story - Mindtrek 2016
Timo Sirainen - Dovecot Story - Mindtrek 2016Timo Sirainen - Dovecot Story - Mindtrek 2016
Timo Sirainen - Dovecot Story - Mindtrek 2016Mindtrek
 

Andere mochten auch (20)

Comprehensive Support for Self Management of Medications by a Networked Robot...
Comprehensive Support for Self Management of Medications by a Networked Robot...Comprehensive Support for Self Management of Medications by a Networked Robot...
Comprehensive Support for Self Management of Medications by a Networked Robot...
 
WordPress Visual Editor Mastery
WordPress Visual Editor MasteryWordPress Visual Editor Mastery
WordPress Visual Editor Mastery
 
101 Ways to Elevate Yourself and Demand Higher Fees
101 Ways to Elevate Yourself and Demand Higher Fees101 Ways to Elevate Yourself and Demand Higher Fees
101 Ways to Elevate Yourself and Demand Higher Fees
 
Direct Purposeful Experience
Direct Purposeful ExperienceDirect Purposeful Experience
Direct Purposeful Experience
 
Unihack2016 closing
Unihack2016 closingUnihack2016 closing
Unihack2016 closing
 
Securing API data models
Securing API data modelsSecuring API data models
Securing API data models
 
Have you been vaccinated
Have you been vaccinatedHave you been vaccinated
Have you been vaccinated
 
PayPal on iOS + 9 great free app ideas
PayPal on iOS + 9 great free app ideasPayPal on iOS + 9 great free app ideas
PayPal on iOS + 9 great free app ideas
 
FinalPresentation_FINAL
FinalPresentation_FINALFinalPresentation_FINAL
FinalPresentation_FINAL
 
IoTMelb
IoTMelbIoTMelb
IoTMelb
 
Building a Dream Team
Building a Dream TeamBuilding a Dream Team
Building a Dream Team
 
Have you been vaccinated
Have you been vaccinatedHave you been vaccinated
Have you been vaccinated
 
The Future of Identification
The Future of IdentificationThe Future of Identification
The Future of Identification
 
IoT Commerce using Ruby, PHP and Arduino
IoT Commerce using Ruby, PHP and Arduino IoT Commerce using Ruby, PHP and Arduino
IoT Commerce using Ruby, PHP and Arduino
 
Rapyuta a cloud robotics platform
Rapyuta a cloud robotics platformRapyuta a cloud robotics platform
Rapyuta a cloud robotics platform
 
Internet of Things With PHP
Internet of Things With PHPInternet of Things With PHP
Internet of Things With PHP
 
Teaching with Visual Symbols
Teaching with Visual SymbolsTeaching with Visual Symbols
Teaching with Visual Symbols
 
Getting into WordPress Front End Development
Getting into WordPress Front End DevelopmentGetting into WordPress Front End Development
Getting into WordPress Front End Development
 
Timo Sirainen - Dovecot Story - Mindtrek 2016
Timo Sirainen - Dovecot Story - Mindtrek 2016Timo Sirainen - Dovecot Story - Mindtrek 2016
Timo Sirainen - Dovecot Story - Mindtrek 2016
 
Unihack2016 opening
Unihack2016 openingUnihack2016 opening
Unihack2016 opening
 

Ähnlich wie Container Days

2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Productiondevopsdaysaustin
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tipsSamuel Chow
 
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...Ambassador Labs
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDocker, Inc.
 
Taking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and DecideTaking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and DecideBret Fisher
 
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...Ambassador Labs
 
Introduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Introduction to Docker and Linux Containers @ Cloud Computing Rhein MainIntroduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Introduction to Docker and Linux Containers @ Cloud Computing Rhein MainPuja Abbassi
 
Azure ai on premises with docker
Azure ai on premises with  dockerAzure ai on premises with  docker
Azure ai on premises with dockerVishwas N
 
Docker + Microservices in Production
Docker + Microservices in ProductionDocker + Microservices in Production
Docker + Microservices in ProductionPatrick Mizer
 
Docker up and Running For Web Developers
Docker up and Running For Web DevelopersDocker up and Running For Web Developers
Docker up and Running For Web DevelopersBADR
 
Docker Up and Running for Web Developers
Docker Up and Running for Web DevelopersDocker Up and Running for Web Developers
Docker Up and Running for Web DevelopersAmr Fawzy
 
Container on azure
Container on azureContainer on azure
Container on azureVishwas N
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned RightScale
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline Docker, Inc.
 
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOpsDevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOpsAmbassador Labs
 
Journey to the devops automation with docker kubernetes and openshift
Journey to the devops automation with docker kubernetes and openshiftJourney to the devops automation with docker kubernetes and openshift
Journey to the devops automation with docker kubernetes and openshiftYusuf Hadiwinata Sutandar
 

Ähnlich wie Container Days (20)

2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tips
 
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
Taking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and DecideTaking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and Decide
 
Run automated tests in Docker
Run automated tests in DockerRun automated tests in Docker
Run automated tests in Docker
 
Docker for dev
Docker for devDocker for dev
Docker for dev
 
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
 
Introduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Introduction to Docker and Linux Containers @ Cloud Computing Rhein MainIntroduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Introduction to Docker and Linux Containers @ Cloud Computing Rhein Main
 
Azure ai on premises with docker
Azure ai on premises with  dockerAzure ai on premises with  docker
Azure ai on premises with docker
 
Docker + Microservices in Production
Docker + Microservices in ProductionDocker + Microservices in Production
Docker + Microservices in Production
 
JOSA TechTalks - Docker in Production
JOSA TechTalks - Docker in ProductionJOSA TechTalks - Docker in Production
JOSA TechTalks - Docker in Production
 
Docker up and Running For Web Developers
Docker up and Running For Web DevelopersDocker up and Running For Web Developers
Docker up and Running For Web Developers
 
Docker Up and Running for Web Developers
Docker Up and Running for Web DevelopersDocker Up and Running for Web Developers
Docker Up and Running for Web Developers
 
Container on azure
Container on azureContainer on azure
Container on azure
 
From Heroku to Amazon AWS
From Heroku to Amazon AWSFrom Heroku to Amazon AWS
From Heroku to Amazon AWS
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
 
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOpsDevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
 
Journey to the devops automation with docker kubernetes and openshift
Journey to the devops automation with docker kubernetes and openshiftJourney to the devops automation with docker kubernetes and openshift
Journey to the devops automation with docker kubernetes and openshift
 

Container Days

  • 1. Easing Your Way Into Docker Lessons From a Journey to Production ContainerDays NYC October 30, 2015
  • 2. Who are we? Steve Woodruff ❏ DevOps Engineer at SpareFoot implementing CI/CD ❏ Spent 10+ years at Motorola doing embedded development (C, C++) ❏ Spent 5 years at IBM as a sys admin in a large server farm (Linux, AIX, Solaris) swoodruff@sparefoot.com Twitter: @sjwoodr GitHub: sjwoodr Patrick Mizer ❏ Software Engineer at SpareFoot (6 years) ❏ 12 years as a developer in consumer web ❏ Convinced Steve to keep letting us play w/ containers even after we messed it up countless times patrick@sparefoot.com GitHub: maximizer
  • 3. ● Think Hotels.com for self storage* ● All infrastructure in AWS ● 40 Developers on 7 Teams ○ Continuous Delivery ● Docker in production since 2014 *This kind of storage:
  • 4. What We Will Talk About ● We solved some problems with Docker Containers ● We started small and eventually got to production ● We ffff...messed up a lot along the way This is the talk that we would have liked to see before we learned these lessons the hard way...
  • 5. Chapter 1 - Hackathons and Docker
  • 6. The Beginning: SpareFoot + Docker Hackathon! Docker + Fig (now compose) allowed us to run production architecture locally.
  • 7. The Development Environment ● We want to be as close as possible to production ● We want the development environment to be as fast as possible for interactive use.
  • 8. Developing Locally % apt-get install... % brew install… % make && make install…
  • 11. Aha: Vagrant + Docker? Virtual Machine % vagrant up App 1 Redis Solr Search MySQL DB Containers App 2
  • 12. Putting it together with Compose Virtual Machine % vagrant up App 1 Redis Solr Search MySQL DB Containers App 2 % fig up
  • 13. Lessons Learned ● Docker creates application isolation in a super lightweight way ○ We can model our production infrastructure locally ● Compose is fantastic for the local dev environment ● Vagrant + Docker gets us an interactive local dev environment via synced folders and volumes ● We got to cut our teeth on Docker
  • 14. Chapter 2 - Docker in Production (kind of)
  • 18. Yim - Call Center Application ● Used exclusively by our call center ○ Chrome ONLY ● Node version n+1 ● React + Flux Vers. n+1
  • 19. Yim - Call Center Application ● Used exclusively by our call center ○ Chrome ONLY ● Node version n+1 ● React + Flux Vers. n+1 Vers. n+1
  • 20. Yim - Call Center Application ● Used exclusively by our call center ○ Chrome ONLY ● Node version n+1 ● React + Flux Vers. n+1 Vers. n+1 Vers. n
  • 21. Yim - Call Center Application ● Used exclusively by our call center ○ Chrome ONLY ● Node version n+1 ● React + Flux Vers. n+1 Vers. n+1 Vers. n
  • 24. Inside of the container ● Code ● Libraries ● Package Manager
  • 26. Outside of the container ● Orchestration ● Logging ● Monitoring ● Configuration Management
  • 28. Ok, so Docker feels like the a solution … and we kind of know how to do this. But.... ● Continuous Integration / Delivery? ○ Docker Registry ○ Bamboo ○ Deployments ● Host Volumes and Port Forwarding rules? ○ Not saved with the source code ● Get Docker to run in local, dev, staging, and production environments? ○ Configuration?
  • 29. CI and deployments Janky shell scripts… slow builds, etc… ● Used Bamboo to build images ○ feature branches were built/deployed to Dev ○ master branch was built/deployed to Staging ● Dynamically created custom container start script ● Tried to auto-detect when the containers started to begin post-deploy test ● Build times were rather long ● Spent an awful long time doing docker push (to our registry) and docker pull (on the target hosts)
  • 30. Host Volumes and port forwarding rules ● Exposed / Published ports were handled via a text file we parsed at build time ● Tried to accommodate the future when we’d have more apps/containers ● Host volumes that had to be mounted were hard coded in the Bamboo build plan for the app so they could be added to that dynamically created container start script
  • 31. Get Docker running Supporting multiple environments ● Bamboo would deploy rather well to DEV and STAGE using these dynamically created scripts. ● Felt rather fragile and could break at any time ● Production deploys were scripts that would do a docker pull on several hosts and then kill the old containers on a host, start the new containers on that host, and then move on to the next host. ● Wasn’t always a zero-downtime deployment
  • 32. Docker in Production (technically)! We had 2 load balanced EC2 instances running a node app. ELB 443 3000 3000
  • 33. Docker in Production (technically)! We had 2 load balanced EC2 instances running a node app. Now we have 2 load balanced EC2 instances running docker containers that run a node app! ELB 443 3000 3000 ELB App 1 App 1 3000 3000 443
  • 34. Docker in Production (technically)! ELB ELB App 1 App 1 We had 2 load balanced EC2 instances running a node app. Now we have 2 load balanced EC2 instances running docker containers that run a node app! NEW443 3000 3000 3000 3000 443
  • 35. Yim: Trouble in Docker Paradise ● Hosting our own Docker registry was a bad idea ○ Stability was a problem ○ No level of access control on the registry itself ● Mimicking servers - 1 container per host. Need orchestration please! ● Amazon Linux AMI -> old version of Docker… doh! ● Docker push/pull to/from registry was very slow ○ build - push to registry ○ deploy - pull from registry to each host, serially ● Performance was fine…. ○ But stability was the issue ○ This internal-facing nodejs app was moved to a pair of EC2 instances and out of Docker after about 4 months of pain and suffering
  • 36. Yim: Lessons Learned ● We need orchestration ○ Rolling our own docker deployments was confusing to OPS and to the Dev team ● Our own docker registry is a bad idea ○ Stability was a problem ○ No level of access control on the registry itself ○ Our S3 backend would grow by several GB per month with no automated cleanup ● No easy way to rollback failed deploys ○ Just fix it and deploy again... ● All this culminated in a poor build process and affected CI velocity ○ Longer builds, longer deploys, no real gain
  • 37. Chapter 3 - Microservices
  • 38. Like everyone else.... ...we are “deconstructing the monolith” Application Monolithic Library Data
  • 39. Like everyone else.... ...we are “deconstructing the monolith” Application Monolithic Library Data REST API
  • 40. Like everyone else.... ...we are “deconstructing the monolith” Application Monolithic Library Data REST API Data Microservice
  • 41. Like everyone else.... ...we are “deconstructing the monolith” Application REST API Data Microservice REST API Data Microservice REST API Data Microservice REST API Data Microservice API Gateway
  • 42. Revisiting The Development Environment ● We want to be as close as possible to production ● We want the development environment to be as fast as possible for interactive use ● We want our microservices isolated
  • 43. Revisiting The Development Environment App1 App2 MySQL
  • 44. Revisiting The Development Environment Service1 MySQL Service2 Service3 App1 App2 MySQL
  • 45. Revisiting The Development Environment Service1 MySQL Service2 Service3 ???? App1 App2 MySQL
  • 46. Revisiting The Development Environment Service1 MySQL Service2 Service3 App1 App2 MySQL
  • 47. Revisiting The Development Environment HTTP App1 App2 MySQL
  • 48. Revisiting The Development Environment Service1 Service2 Service3 HTTP App1 App2 MySQL
  • 50. “Tres Vagrantres” Service1 Service2 Service3 MySQL App1 App2 HTTP ● We want to be as close as possible to production ● We want the development environment to be as fast as possible for interactive use. We want our microservices isolated.
  • 51. Bonus: Ownership Service1 Service2 Service3 MySQL App1 App2 Consumer Services Operations / DBA Feature Team HTTP
  • 52. Slinging images Service1 Service2 Service3 Consumer Services Microservice developers push images to registry. Vagrant pulls images by tag. Access controlled hopefully. ???
  • 53. A Better Docker Registry With Yim we learned that rolling our own Registry was a bad idea. ● Limited Access Control ● We have to maintain it
  • 54. Let’s try Quay... ● Has Access Control ○ Robots, yusss! ● We don’t have to maintain it
  • 60. We’ve learned some things... ● Easier than we thought ● Quay was the glue we needed ○ Use an off the shelf solution. ○ We like Quay.io ● Bolting on to our existing CI pipeline worked really well. ○ Developers didn’t have to learn new process ○ Microservice consumers can pull tagged versions ○ We can automate tests against all versions Now we talk containers from local -> dev -> staging but NOT in production.
  • 61. Chapter 4 - To Production! (seriously this time)
  • 62. Production - What is still needed ● Orchestration ○ Yim sucked because we tried to do this ourselves ● Better Deployments ○ With rollbacks ● Configuration Management ○ We have things to hide
  • 65. Production - Software Selection ● Choosing orchestration software / container service ○ StackEngine ■ Lacked docker-compose support ○ Kubernetes ■ PhD Required ○ Mesosphere ■ Nice, but slow to deploy ○ EC2 Container Service ■ Lacked docker-compose support and custom AMIs ○ Tutum ○ Rancher
  • 66. Production - Enter Rancher After running proof-of-concepts of both Tutum and Rancher, we decided to continue down our path to production deploys with Rancher. ● Had more mature support for docker-compose files. ○ Tutum added this after our evaluation had ended ● Did not require us to orchestrate the deployments through their remote endpoint ○ Rancher server runs on our EC2 instances and we are in full control of all the things ● Had a full API we can work with in addition to the custom rancher-compose cli ● Had a very-active user community and a beta-forum where the Rancher development team was active in answering questions and even troubleshooting configuration problems.
  • 67. Overlaying Docker on AWS ● ELB as a front-end to each service ● ELB load balances to haproxy containers ● HAProxy containers load balance to the service containers
  • 68. Overlaying Docker on AWS ELB EC2
  • 69. Overlaying Docker on AWS ELB EC2 Containers
  • 70. Overlaying Docker on AWS ● Why the extra HAProxy layer? ○ Allows us to create the ELB and leave them alone ○ When we deploy new versioned services we update the service alias / haproxy links ○ Allows for fast rollback to previous version of the service
  • 71. Deployments and Rollbacks ● Developers can deploy to production whenever they want ○ HipChat bot commands to deploy and rollback/revert ● Deployments to each of the 3 environments use rancher-compose to ○ Deploy new versioned services / containers ○ Create or update service aliases / haproxy links ○ Delete previous versioned services except for current and previous ● When things go haywire… ○ We simply rollback ○ Production deploy creates a docker-compose-rollback.yml file ■ Query Rancher API to get list of running services ■ Allows us to change haproxy and service alias links back to the previous version ■ Super fast to rollback, no containers need to be spun up!
  • 72. Overlaying Docker on AWS ELB EC2 Containers
  • 73. Overlaying Docker on AWS ELB EC2 Containers
  • 74. Overlaying Docker on AWS ELB EC2 Containers
  • 75. Overlaying Docker on AWS ELB EC2 Containers Rollback!
  • 76. Technical Challenge - docker-compose ● We needed to support a single docker-compose.yml file, maintained by developers of an app or service ○ They don’t want to maintain local, dev, stage, and prod versions of this file ○ Changes to multiple files would be error-prone ○ Must support differences in the architecture or configuration of services across environments ○ Secret Secret, I’ve got a Secret
  • 77. Secret Management We’re already using SaltStack to manage our EC2 minions (VMs) ● Salt Grains are used for some common variables used in salt states ● Salt Pillar Data exists which is configuration data available only to certain minions ● This Salt Pillar Data is already broken down by environment (dev/stage/prod) ● We should just use this data to dynamically create the docker-compose and rancher-compose files!
  • 78. A templated rancher-compose file {% set sf_env = grains['bookingservice-env'] %} {% set version = grains['bookingservice-version'] %} bookingservice-{{ sf_env }}-{{ version }}: scale: 1 We use a scale of 1 because we use global host scheduling combined with host affinity so that one container of this service is deployed to each VM of the specified environment (dev/stage/prod). This allows us to spin up a new Rancher host and easily deploy to the new host VM.
  • 80. A Closer Look MYSQL_SPAREFOOT_HOST: {{ salt['pillar.get']('bookingservice-dev:MYSQL_SPAREFOOT_HOST') }} MYSQL_SPAREFOOT_DB: {{ salt['pillar.get']('bookingservice-dev:MYSQL_SPAREFOOT_DB') }} MYSQL_SPAREFOOT_USER: {{ salt['pillar.get']('bookingservice-dev:MYSQL_SPAREFOOT_USER') }} MYSQL_SPAREFOOT_PASS: {{ salt['pillar.get']('bookingservice-dev:MYSQL_SPAREFOOT_PASS') }} MYSQL_SPAREFOOT_PORT: {{ salt['pillar.get']('bookingservice-dev:MYSQL_SPAREFOOT_PORT') }} APP_LOG_FILE: {{ salt['pillar.get']('bookingservice-dev:APP_LOG_FILE') }} REDIS_HOST: {{ salt['pillar.get']('bookingservice-dev:REDIS_HOST') }} REDIS_PORT: {{ salt['pillar.get']('bookingservice-dev:REDIS_PORT') }}
  • 81. Deployments with rancher-compose ● Deployments to Dev and Staging are done via Bamboo ● Deployments to Production are done by developers via HipChat commands ● In the end, everything is invoking our salt-deploy.py script ○ Set some salt grains for target env, version, buildid, image tag in quay.io ○ Services get versioned with a timestamp and bamboo build id ○ Render jinja2 / Inject Salt grains and pillar data via salt minion python code ■ caller.sminion.functions['cp.get_template'](cwd + '/docker-compose.yml', cwd + '/docker-compose-salt.yml') ■ caller.sminion.functions['cp.get_template'](cwd + '/rancher-compose.yml', cwd + '/rancher-compose-salt.yml') ○ Invokes rancher-compose create / up ○ Cleanup to keep the live verison of a service and live-1 version. The rest are purged.
  • 82. Surprise! Rancher Adds Variable Support Does the support for interpolating variables, added in Rancher 0.41, deprecate the work we've done with Salt and rendering jinja2 templates? ● No. We already maintain data in grains and pillars so we just reuse that data. ● Rancher implementation uses the environment variables on the host running rancher-compose to fill in the blanks ● It would require logic to load those env variables based on the target env (dev/stage/prod) so might as well get the data out of salt pillar which has separate pillars for each service and then broken down by target environment.
  • 83. So we deployed our first microservice and...
  • 84. So we deployed our first microservice and... ...Everything worked...
  • 85. So we deployed our first microservice and... ...Everything worked... … Until it didn’t.
  • 86. The Day Rancher Died ELB EC2 Containers
  • 87. The Day Rancher Died ELB EC2 Containers
  • 88. The Day Rancher Died ELB EC2 Containers
  • 89. Where are we now? ● 10 Microservices in production with Rancher + Docker ○ 5-10 Deployments per day on average ○ Busiest services handling around 50 requests / second ● Consumer facing applications being containerized in development ○ New teams cutting their teeth ○ Keep on “Strangling”* * DO NOT: google image search for “strangling hands”
  • 90. Finally ● Start small ● Fail (a lot) ● Move on and apply what you learned
  • 91. Thank you! Slides: http://bit.ly/1S88LBX Reach out: ● Patrick (patrick@sparefoot.com) ● Steve (swoodruff@sparefoot.com, Twitter @sjwoodr) Questions?