docker - diving in

75
Diving In See what happens when a Java developer tries to do DevOps Copper @ an Aussie Insurance Company @awilmore

Upload: awilmore

Post on 08-Jul-2015

153 views

Category:

Technology


0 download

DESCRIPTION

What happens when a simple Java developer tries to do DevOps.

TRANSCRIPT

Page 1: Docker - Diving In

Diving InSee what happens when a Java developer

tries to do DevOps

Copper @ an Aussie Insurance Company@awilmore

Page 2: Docker - Diving In

Disclaimer

Me: DevOps n00b

I’m really just here to learn (but Stephen’s making me talk!)

Page 3: Docker - Diving In

Overview

1. How Docker was introduced to the Copper team

2. The Copper build agents - Doing it Wrong!

3. New service opportunity - Doing it Right!

4. The challenges ahead

Page 4: Docker - Diving In

A short detour…

What is Copper?

Page 5: Docker - Diving In

The Copper Team• We are our company’s rapid software delivery team

• We are cross-functional,“innovative early adopters of technology”

• Grails + AngularJS, plus many other technologies

• Provide a faster speed-to-market for customers

• Provide an alternative path to production for our business

Page 6: Docker - Diving In

Leo, Pete, Mike: DevOps expert consultants from Odecee

Their research project: Docker

Meanwhile…

Build Engineering Team had a problem:

Need more servers, for more Bamboo build agents!

So… In the beginning…

Page 7: Docker - Diving In

Docker-based Build Agents!

Solution…

Went from approx. 10 to approx. 50 build agents!

Page 8: Docker - Diving In

Some Copper devs were still not happy…

“Too much job queuing in Bamboo!”

So I forked the Bamboo build agents and created…

Page 9: Docker - Diving In

Grails-Dedicated Build Agents

• Manually built, manually managed

• 3.5 GB on disk (way too big)

• Rebuilds mean re-download-the-Internet

• Too much hands on

Docker: Doing it Wrong!

…and six months on…

Page 10: Docker - Diving In

Docker: Doing it Wrong!

• Containers simply do too much!

• Stateful and Stateless concerns mixed together

• Poor use of Dockerfiles and Image Layering

• No orchestration

Page 11: Docker - Diving In

First Problem

Containers Do Too Much

Page 12: Docker - Diving In

Containers Do Too Much

… which violates…

Single Responsibility Principle

Page 13: Docker - Diving In

Single Responsibility Principle

One-Concern-Per-Container Principle

Docker refers to it in places as the:

Page 14: Docker - Diving In

So, the build agents…

Page 15: Docker - Diving In

Grails Build Agent:

Grails

Maven

Gradle

Selenium

Firefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Page 16: Docker - Diving In

Grails Build Agent:

Grails

Maven

Gradle

Selenium

Firefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Page 17: Docker - Diving In

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Doing Too Much

Page 18: Docker - Diving In

Grails Build Agent:Grails

Bamboo Remote Agent Service

Grails Build Agent:Grails

Bamboo Remote Agent Service

Java Build Agent:

Maven

Gradle

Bamboo Remote Agent Service

Selenium Build Agent:

SeleniumFirefox

Bamboo Remote Agent Service

Node Build Agent:NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Node Build Agent:NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Bamboo Remote Agent Service

Grails Build Agent:Grails

Bamboo Remote Agent Service

Grails Build Agent:Grails

Bamboo Remote Agent Service

Grails Build Agent:Grails

Bamboo Remote Agent Service

Node Build Agent:NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Node Build Agent:NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Better

Page 19: Docker - Diving In

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Grails Build Agent:Grails

Maven

Gradle

SeleniumFirefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Doing Too Much

Page 20: Docker - Diving In

Doing It Wrong

Page 21: Docker - Diving In

Mixing Stateful and Stateless Concerns

Doing It Wrong

The next problem…

Page 22: Docker - Diving In

Mixing Stateful and Stateless Concerns

Grails Build Agent:

Grails Cache

Page 23: Docker - Diving In

Mixing Stateful and Stateless Concerns

Grails Build Agent:

Grails Cache

Page 24: Docker - Diving In

Mixing Stateful and Stateless Concerns

Grails Build Agent:

Grails Cache

Page 25: Docker - Diving In

Mixing Stateful and Stateless Concerns

Grails Build Agent:

Grails Cache

Grails Build Agent:

Grails Cache

Page 26: Docker - Diving In

Mixing Stateful and Stateless Concerns

Grails Build Agent:

Grails Cache

Grails Build Agent:

Grails Cache

Page 27: Docker - Diving In

Grails Build Agent:

Grails Cache

Grails Build Agent:

Grails Cache

Page 28: Docker - Diving In

Grails Build Agent:

Grails Cache

Grails Build Agent:

Grails Cache

File System

Data Volume Data Volume

Better

Page 29: Docker - Diving In

Grails Build Agent:

Grails Cache

Grails Build Agent:

Grails Cache

Better

Page 30: Docker - Diving In

Mixing Stateful and Stateless Concerns

Grails Build Agent:

Grails Cache

Grails Build Agent:

Grails Cache

Page 31: Docker - Diving In

Not so good

Page 32: Docker - Diving In

Not so good

The next problem…

Poor use of Dockerfiles and Image Layering

Page 33: Docker - Diving In

Poor use of Dockerfiles and Image Layering

https://registry.hub.docker.com/u/maxexcloo/postgresql/dockerfile/

Simple Dockerfile example:

Page 34: Docker - Diving In

https://registry.hub.docker.com/u/maxexcloo/postgresql/dockerfile/

Poor use of Dockerfiles and Image Layering

Simple Dockerfile example:

Page 35: Docker - Diving In
Page 36: Docker - Diving In

The Grails Build Agent Project

Dockerfile

Shell ScriptShell Script

Puppet Stuff

Shell Script

Shell Script

Puppet Stuff Shell Script

Grails Build Agent:

Grails

Maven

Gradle

Selenium

Firefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Page 37: Docker - Diving In

The Grails Build Agent Project

Dockerfile

Shell Script

Shell Script Puppet Stuff

Shell Script

Shell Script

Puppet Stuff Shell Script Lots of moving parts (ie. code)

for one image

Page 38: Docker - Diving In

Dockerfile

Base OS

Image Inheritance

Java7 Image

Grails Image

Dockerfile

Dockerfile

Page 39: Docker - Diving In

Dockerfile

Base OS

Better

Java7 Image

Grails Image

Dockerfile

Dockerfile

Page 40: Docker - Diving In

Dockerfile

Shell ScriptShell Script

Puppet Stuff

Shell Script

Shell Script

Puppet Stuff Shell Script

Grails Build Agent:

Grails

Maven

Gradle

Selenium

Firefox

NPM

NodeJS

Grunt

Ruby

Compass

Bamboo Remote Agent Service

Poor use of Dockerfiles and Image Layering

Page 41: Docker - Diving In

Not so good

Page 42: Docker - Diving In

Not so good

The next problem…

No orchestration

Page 43: Docker - Diving In

No orchestration

[adam@laptop ~] ssh adam@build-server

adam@build-server:~ >> Last login: Tue Oct 28 22:13:27 2014 from 10.126.176.99

cd git/buildeng-puppet

adam@build-server:~/git/buildeng-puppet >> git checkout grails-agents-branch

adam@build-server:~/git/buildeng-puppet >> docker build -t=“agent-11” .Sending build context to Docker daemon Step 0 : FROM ubuntu:14.04 ---> e360b5673aef Step 1 : MAINTAINER Adam Wilmore "[email protected]" ---> Using cache ... ... ...(a long time later...)

When I need some new agents…

Page 44: Docker - Diving In

Too much hands on!

Page 45: Docker - Diving In

Too much hands on!

It would be better to have…… and more: http://www.mindmeister.com/389671722/docker-ecosystem

Page 46: Docker - Diving In

…you get the point.

Page 47: Docker - Diving In

But doing this…

[adam@laptop ~] ssh adam@build-server

adam@build-server:~ >> Last login: Tue Oct 28 22:13:27 2014 from 10.126.176.99

cd git/buildeng-puppet

adam@build-server:~/git/buildeng-puppet >> git checkout grails-agents-branch

adam@build-server:~/git/buildeng-puppet >> docker build -t=“agent-11” .Sending build context to Docker daemon Step 0 : FROM ubuntu:14.04 ---> e360b5673aef Step 1 : MAINTAINER Adam Wilmore "[email protected]" ---> Using cache ... ... ...(a long time later...)

Page 48: Docker - Diving In

Doing It Wrong

Page 49: Docker - Diving In

• Containers simply do too much!

• Stateful and Stateless concerns mixed together

• Poor use of Dockerfiles and Image Layering

• No orchestration

Doing It Wrong

Recap:

Page 50: Docker - Diving In

Next time, it’ll be perfect…

Page 51: Docker - Diving In

So how about

Doing It Right?

Page 52: Docker - Diving In

The Next Project

• Build new Artifactory* Service using Docker

• Find out a bit more about Docker in the process

• Take the learnings so far, build a bit, learn a bit more, repeat…

* Artifactory from JFrog is an artefact management tool, similar to Nexus

Page 53: Docker - Diving In

“Hang on a minute! How do you know that Docker is the right tool

for this type of service?”

Good question.

Page 54: Docker - Diving In

A short detour…

Why Copper Needs Docker

Page 55: Docker - Diving In

Why Copper Needs Docker

Page 56: Docker - Diving In

• Portable infrastructure - changing licensed platform

• Major infrastructure pressures within Copper - scaling, availability and limited resources

• Increasing demand for disposable infrastructure

• What the Copper team needs is…

Why Copper Needs Docker

Page 57: Docker - Diving In

The Copper PaaS!

Page 58: Docker - Diving In

And we need to start somewhere…

Page 59: Docker - Diving In

• Artifactory service comprised:

• Java app server (Jetty)

• Postgres backend

• Web-based file share

• Linux all the way down

• Performance and Availability are critical - can’t be worse than previous artefact manager

Project Requirements

Page 60: Docker - Diving In

Some Principles to Work With

• Use Puppet with Docker for “image creation”; and

• Favour Puppet over Docker for “doing work” *

• Stick to One Concern Per Container!

• Dive in and learn!

* Why? For reuse, “might move to EC2 one day”, already familiar with Puppet…?

Page 61: Docker - Diving In

“Hang on a minute! What about service discovery, orchestration, logging,

monitoring and backups?”

<crickets…>

Page 62: Docker - Diving In

So how did it turn out?

Page 63: Docker - Diving In

Container Structure

Page 64: Docker - Diving In

Image Inheritance

Page 65: Docker - Diving In

The Challenges Ahead

Page 66: Docker - Diving In

The State of Ops• How do we scale and load-balance for performance and

availability?

• How do we backup all critical data?

• How do we do upgrades?

• How do we keep operational configuration changes under source-control?

• Can we restore everything in the event of a disaster?

• What about service discovery, orchestration, monitoring, all that stuff to help with some of these questions?

Page 67: Docker - Diving In

The State of Dev• Have we correctly designed containers for extensibility?

• Are we using the right tools and libraries to build the containers?

• How do we version and release our code changes?

• Is our code set up for optimal reuse?

• How do we test our builds?

• How do we collaborate most effectively as developers writing infrastructure software?

Page 68: Docker - Diving In

One last detour…

Page 69: Docker - Diving In

…on the question about using tools properly…

Like Docker vs Puppet…

Page 70: Docker - Diving In

Is it…

(Puppet installs Docker)

Page 71: Docker - Diving In

Or is it…

(Docker installs Puppet)

Page 72: Docker - Diving In

The answer appears to be:

“It’s both, and it depends.”

Page 73: Docker - Diving In

The Copper PaaS

And so it appears there’s still lots of work to do

Which is great because…

Page 74: Docker - Diving In

Next time, it’ll be perfect!

Page 75: Docker - Diving In

Next time, it’ll be perfect!

Copper @ an Aussie Insurance Company@awilmore