Download - More developers on DevOps with Docker orchestration

Transcript
Page 1: More developers on DevOps with Docker orchestration

more DEVs on DEVOPS

with

DOCKER ORCHESTRATION

All the Things you have to Know in Order to use docker with Orchestration in Production like I did but not really like i did it because I cried, I really cried hard, so please do not cry because life is short

and you should spend your time enjoying it.

Page 2: More developers on DevOps with Docker orchestration

2 .@liuggio Giulio De Donato

@liuggio

welcometothebundle.co

m

Page 3: More developers on DevOps with Docker orchestration

more DEVs on DEVOPS

with

DOCKER ORCHESTRATION

All the Things you have to Know in Order to use docker with Orchestration in Production like I did but not really like i did it because I cried, I really cried hard, so please do not cry because life is short

and you should spend your time enjoying it.

Page 4: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

1 Docker Container!==

Page 5: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

Virtualization !== ContainerContainer are mostly syscalls2

Page 6: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

3 It is all about

while true; do mkdir x; cd x; done

bomb() { bomb | bomb & }; bombISOLATIO

N

Page 7: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

4 DevOps is ...

Page 8: More developers on DevOps with Docker orchestration
Page 9: More developers on DevOps with Docker orchestration

The perfect Storm

Page 10: More developers on DevOps with Docker orchestration

●VELOCITY●Variation ●Visualizati

onLEAD TIME

Three way devops:

Page 11: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

Infrastructure like a managed application5 Infrastructure like a managed application

Page 12: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

6 Use the FORCETHE DOCKER

WAY

One process per container

Page 13: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

7 Use the FORCETHE DOCKER

WAY

log to StdErr and StdOut

Page 14: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

Can’t touch thisImmutability8

Page 15: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

9 Use the FORCETHE DOCKER

WAY

Env. Variable all the things

/etc/php5/fpm/pool.d/www.confclear_env = no

[www]env[MY_ENV_VAR_1] = 'value1'env[MY_ENV_VAR_2] = 'value2'

Page 16: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

10

Containers communication is easy

Page 17: More developers on DevOps with Docker orchestration

NGINX PHP-FPM

Data (code)

php-cli

@liuggio Giulio De Donato

Cache

DB

10

Containers communication is easy

Backend

exposeport 80

Fairly easy

... Services

Page 18: More developers on DevOps with Docker orchestration

NGINX PHP-FPM

Data (code)

php-cli

@liuggio Giulio De Donato

Cache

DB

10

Containers communication is easy

N

N

N

NPHP

PHP

PHP

CLI

exposeport 80

Load balancer

Random port

Random port

Random port .

Random port .

Fairly easytricky

... Scale

Page 19: More developers on DevOps with Docker orchestration

NGINX PHP-FPM

Data (code)

php-cli

@liuggio Giulio De Donato

10

Containers communication is easy

N

N

N

NPHP

PHP

PHP

CLI

exposeport 80

Load balancer

Fairly easy

NODE 3

tricky NODE 2

NODE 1

Very tricky

... Nodes

Page 20: More developers on DevOps with Docker orchestration

NGINX PHP-FPM

Data (code)

php-cli

@liuggio Giulio De Donato

10

Containers communication is easy

Cache

DB

Fairly easytrickyVery tricky

... SubNet

A mess!

Page 21: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

10

Containers communication is easy Fairly

easytrickyVery tricky

... MicroservicesNGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DBNGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DBNGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

A mess!NGINX

PHP-FPM

Data (code)

php-cli

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

Page 22: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

10

Containers communication is easy Fairly

easytrickyVery trickyNOT FOR

HUMAN!!!! A mess!

Page 23: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

11 Orchestration !==

Automation

Page 24: More developers on DevOps with Docker orchestration

●Kubernetes●Docker Cloud●DOCKER UCP●MESOS●Provisioning

tool (BASHISM/…)

●…

Docker Orchestration frameworks/tools

Page 25: More developers on DevOps with Docker orchestration

@liuggio Giulio De DonatoDEMO

Page 26: More developers on DevOps with Docker orchestration

Devops:The last human action happens when you commit?

@liuggio Giulio De Donato

Page 27: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

12

Understand your processes

CODE TEST DEPLOY

Page 28: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

13

Blue Green Deployment

LoadBalancer

Web Blue

Web Green

Page 29: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

12 My pipeline (contd)

CODE

BUILD

CHOOSE NODES

Register Services

RUN Containe

rs(blue-green)

Integration

tests

Configure Proxy

with color

PostIntegrati

ontest

PUSH toregistry

TEST

PULL CONTAIN

ER

YOUR CUSTOMERS ARE HAPPY

Page 30: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

14

Container registry and service discovery

Page 31: More developers on DevOps with Docker orchestration

CONSUL

Page 32: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

12 My pipeline (contd)

CODE

BUILD

CHOOSE NODES

Register Services

RUN Containe

rs(blue-green)

Integration

tests

Configure Proxy

with color

PostIntegrati

ontest

PUSH toregistry

TEST

PULL CONTAIN

ER

YOUR CUSTOMERS ARE HAPPY

Page 33: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato15 Graceful Deployment

(contd)

LoadBalancer

Web

New Web Feature

Page 34: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

16

You’ll need a lot of disk space

Page 35: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

17 Resources ...

Page 36: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

18

CONTAINER SERVICE A

CONTAINER SERVICE A

CONTAINER SERVICE A

CONTAINER SERVICE B

CONTAINER SERVICE B

CONTAINER SERVICE B

Page 37: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

18

DNS SRV is your friend

CONTAINER SERVICE A

CONTAINER SERVICE A

CONTAINER SERVICE A

CONTAINER SERVICE B

CONTAINER SERVICE B

CONTAINER SERVICE B

Page 38: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

18

DNS SRV is your friend

$ dig @192.168.99.100 bash_server.service.dc1.consul. SRV

Page 39: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

$consulHost = "bash_server.service.dc1.consul.";$results = dns_get_record($consulHost, DNS_SRV);// $result["host"] // $result["port"]// $result["pri"]// $result["weight"]// $result["class"]// $result["ttl"]// $result["type"]// $result["target"]

DNS SRV is your friend

18

Page 40: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

19

Use a log handler

-visualiz

e-

Page 41: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

20 Fast is better

abc

Small Images eg. Alpine ~5mbDockerFile use layer cache wiselyBuild could be slow (if you don’t follow the docker-way)d Bad performance on large files

Page 42: More developers on DevOps with Docker orchestration

Winning Keys

DEMO --- THE PERFECT ORCHESTRATIONEasily DEPLOY

(LAST FEATURE PUSHED

gracefully)

Easily Rollback

(LAST PUSHED FEATURE

gracefully)Visualiz

eShare/Test/

Commit/Merge

Infrastructure

liuggio

Page 43: More developers on DevOps with Docker orchestration

THE PERFECT ORCHESTRATION

Processes respect your needs and:

- The Lead time is SHORT- The Feedback is FAST- The Improvement loop is

INFINITE@liuggio Giulio De Donato

Page 44: More developers on DevOps with Docker orchestration

few things you have to Know in Order to use

docker with Orchestration in Production like I did, but

not really like i did, because I cried, I really cried hard,

so please do not cry because life is short and

you should spend your time enjoying it.

Thank You @liuggio joind.in/talk/4b24e

Page 45: More developers on DevOps with Docker orchestration

@liuggio Giulio De Donato

● http://www.infoq.com/articles/continuous-deployment-containers● devops 2.0 the book● www.welcometothebundle.com/isolate-a-process-with-no-container-like-docker● https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#namespaces ● https://www.opencontainers.org/news/faqs/who-will-be-initial-technical-leadership ● http://www.cyberciti.biz/faq/unix-linux-chroot-command-examples-usage-syntax/● http://s0.cyberciti.org/uploads/faq/2013/01/bash-chroot-ls-demo.gif● https://www.flockport.com/lxc-vs-docker/● http://ramirose.wix.com/ramirosen● https://lwn.net/Articles/532593/● https://lwn.net/Articles/531114/● https://unsplash.com/photos/6wQId4r0uA4

CREDITS