the age of orchestration - goto...

38
The age of orchestration NICOLA PAOLUCCI DEVELOPER INSTIGATOR ATLASSIAN @DURDN From Docker basics to cluster management

Upload: others

Post on 20-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

The age of orchestration

NICOLA PAOLUCCI • DEVELOPER INSTIGATOR • ATLASSIAN • @DURDN

From Docker basics to cluster management

Page 2: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

3

Time me and ring a bell if I am over it. Just kidding I’ll be over by a bit but it’s ok. We’re friends.

Three minute Docker intro?

Page 3: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

4

BINS/LIBS

GUEST OS

HYPERVISOR

HOST OS

SERVER

ROBUST MONOLITHIC

SLOW TO BOOT HEAVY

OVERHEAD

APP A

BINS/LIBS

GUEST OS

APP B

DEFINITIONS

Traditional Virtual Machines

Page 4: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

5

DOCKER ENGINE

HOST OS

SERVER

LEAN LIGHTWEIGHT

ISOLATED PORTABLE EFFICIENT

BINS/LIBS

APP A

BINS/LIBS

APP B

DEFINITIONS

Docker Containers

Page 5: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

6

DEFINITIONS

Seen from another angle, the core of Docker is four distinct things

Clearly defined interfaces

Central registry of ready images

Caching mechanism to re-use steps

A standard format to package applications

Page 6: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

7

DO WE USE IT?

We have embraced Docker on two fronts

For our internal PaaS In our productsNOT PART OF THIS

SESSION

Page 7: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

@durdn

Our internal PaaS, called Micros

Page 8: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

9

Overall Micros Numbers

Microservices

600+

9

Java Node.js Python

Docker containers

40%Rest is pre-made stacks

Page 9: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

@durdn

Media Services

Page 10: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

Our Conversion Stack

Page 11: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

6M

12

Media Services Numbers

Microservices

10

12

containers spun per month

Processed every month

TBs

Page 12: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

13

CONCLUSIONS

Docker has been a great fit for our Media Services team

Worked around tools not easy to parallelise

Manage resource control

Isolating data from different customers

Easily scale horizontally

Page 13: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

@durdn

Orchestration is the next arena

Page 14: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

What’s Orchestration?

15

Services YOUR APPLICATION

Orchestration FRAMEWORKS

Data Center PHYSICAL INFRA

Page 15: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

@durdn

Page 16: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

@durdn

Page 17: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

@durdn

Page 18: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

19

Page 19: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

20

Docker’s Own Orchestration Tools

Docker machine Docker compose Docker swarm Docker network

Page 20: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

Where is the DEMO Lebowski?

Page 21: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

22

TOOL NR.1

Docker machine

Simple command line tool to provision local and remote hosts with Docker installed. Fantastic to get up and running fast. It has drivers for many Internet service providers and PaaS.

Docker machine

$ docker-machine create -d virtualbox dev

INFO[0000] Downloading boot2docker.iso from... INFO[0001] Creating SSH key... INFO[0001] Creating VirtualBox VM... INFO[0006] Starting VirtualBox VM... INFO[0007] Waiting for VM to start... INFO[0041] "dev" has been created and is now active

Page 22: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

• Provision a machine with Docker installed and ready

• Pull a minimal image• Run a few docker commands• Tear down the machine

Docker machine DEMO

$ docker-machine create -d virtualbox dev

INFO[0000] Downloading boot2docker.iso from... INFO[0001] Creating SSH key... INFO[0001] Creating VirtualBox VM... INFO[0006] Starting VirtualBox VM... INFO[0007] Waiting for VM to start... INFO[0041] "dev" has been created and is now active

Page 23: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

• “docker-machine create” to provision the host, locally or remotely• “docker-machine ls” to list the machines• “docker-machine stop/rm” to stop and remove

Recap of what you saw

$ docker-machine create -d virtualbox dev

INFO[0000] Downloading boot2docker.iso from... INFO[0001] Creating SSH key... INFO[0001] Creating VirtualBox VM... INFO[0006] Starting VirtualBox VM... INFO[0007] Waiting for VM to start... INFO[0041] "dev" has been created and is now active

Page 24: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

26

TOOL NR.2

Docker compose

Docker compose

Describe the relation of your components in a simple YAML file called docker-compose.yml and docker-compose takes care of starting them and linking them in order.

1 bitbucket:

2 image: atlassian/bitbucket-server

3 ports:

4 - "7990:7990"

5 - "7999:7999"

6 links:

7 - db

8 volumes_from:

9 - license

10 user: root

11 privileged: true

12 db:

13 image: postgres

14 ports:

15 - "5432:5432"

16 environment:

17 - "POSTGRES_PASSWORD=somepassword"

18 license:

19 build: .

Page 25: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

• Provision a machine on a PaaS• Pull PostgreSQL and a Java

app from the Registry• Use Compose to start the app• Tear down the machine

Docker compose DEMO

$ docker-compose up -d

Page 26: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

• “docker-machine create” to provision the host• Edit “docker-compose.yml” to describe our app• “docker-compose up -d” to start our application• “docker-machine rm compose-demo“ to

remove it

Recap of what you saw

$ docker-compose up -d

Page 27: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

1 bitbucket:

2 image: atlassian/bitbucket-server

3 ports:

4 - "7990:7990"

5 - "7999:7999"

6 volumes_from:

7 - license

8 user: root

9 privileged: true

10 environment:

11 - "constraint:instance==java"

12 db:

13 image: postgres

14 ports:

15 - "5432:5432"

16 environment:

17 - "POSTGRES_PASSWORD=somepassword"

18 - "constraint:instance==db"

19 license:

20 build: .

30

TOOL NR.3

Docker swarm

Deploy images and run containers on a full clusters as if you’re handling a single machine

Docker swarm

Page 28: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

@durdn

Docker swarmswarm master

swarm node swarm node swarm node

container

container

container

container

container

container

discovery service

High level architecture

scheduler

Page 29: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

• Strategies• Spread• Binpack• Random

• Filters• Constraint• Affinity• Port• Dependency• Health

Swarm comes with strategies and filters

$ docker run -e \ constraint:instance==database --name db

Page 30: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

33

HELPER TOOL

Discovery Service

For our Swarm to know which nodes are added to the infrastructure and store information about them we need to use a key-value discovery service, like Consul.

Consul from HashiCorp

Page 31: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

34

TOOL NR.4

Docker network

New Docker command to manage advanced and transparent networking, like creating VXLAN-based overlay networks that span across data centers.

Docker network

$ docker network create \ --driver overlay mynet

Page 32: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

• Provision a Docker swarm• Made up of three hosts

• Master node• Node with 2gb of RAM• simple Node

• Use labels to deploy to nodes• Run Java app and PostgreSQL

on different nodes

The plan for the Swarm DEMO

$ docker pull swarm

$ docker run --rm swarm create 6856663cdefdec325839a4b7e1de38e8

Page 33: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

@durdn

After Part 1demo-master

node1 node2

label: java

Consul: discovery service

Current Architecture

scheduler

RAM: 2GB

label: database

RAM: 512MB

Page 34: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

38

Multi-host Docker compose 1 bitbucket:

2 image: atlassian/bitbucket-server

3 ports:

4 - "7990:7990"

5 - "7999:7999"

6 volumes_from:

7 - license

8 user: root

9 privileged: true

10 environment:

11 - "constraint:instance==java"

12 db:

13 image: postgres

14 ports:

15 - "5432:5432"

16 environment:

17 - "POSTGRES_PASSWORD=somepassword"

18 - "constraint:instance==db"

19 license:

20 build: .

docker-compose.yml

Page 35: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

@durdn

What we diddemo-master

node1 node2

label: java

Final Architecture

scheduler

RAM: 2GB

label: database

RAM: 512MB

PostgreSQLJava App

Consul: discovery service

Page 36: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

• We created a 3-node cluster with “docker-machine”

• We tagged the nodes with labels• We started our components using

label constraints and not IP addresses

Recap of Swarm DEMO

Page 37: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

I hope you are hyped as I am for all this coolness, come

talk to me afterwards!

Page 38: The age of orchestration - GOTO Conferencegotocon.com/dl/goto-berlin-2015/slides/NicolaPaolucci... · 2015-12-05 · The age of orchestration NICOLA PAOLUCCI • DEVELOPER INSTIGATOR

Twitter: @durdn