Docker architecture rework case study

67
Docker Architecture Rework Case Study

Transcript of Docker architecture rework case study

Page 1: Docker  architecture rework case study

Docker

Architecture Rework Case Study

Page 2: Docker  architecture rework case study

Daniel CHAFFIOLSofteam Cadextan (1999)

BNP-Paribas

Société Générale

Amundi Asset ManagementHSBC

Page 3: Docker  architecture rework case study

VonCStack Overflow(2008)

Git - Hg – SVN - ClearCase

Golang - Docker

Eclipse - Jenkins

Page 4: Docker  architecture rework case study

slideshare & Intranet

Page 5: Docker  architecture rework case study

slideshare & Intranet

Page 6: Docker  architecture rework case study

slideshare & Intranet

Page 7: Docker  architecture rework case study

slideshare & Intranet

Page 8: Docker  architecture rework case study

Project

From: Blessed Staging External

Company Outside

master master_ext

mastermaster_ext

Page 9: Docker  architecture rework case study

What are the issues?

Example: Monolithic service => Isolation (processes) issue

Blessed /Staging /External /Internal

NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCronData

SSHD

Page 10: Docker  architecture rework case study

What are the issues?

Example: Monolithic service => Isolation (processes) issue

Blessed /Staging /External /Internal

Apache

SSHD

NGiNX LDAP

Gpg2

Gitolite

Data MCron

Page 11: Docker  architecture rework case study

What are the issues?

Example: Replicated Git repos hosting servers

Blessed Staging ExternalInternal

● Isolation (server)

● Configuration

● Reproducibility

Page 12: Docker  architecture rework case study

Docker:

○ Why?○ How?○ Benefits?

Page 13: Docker  architecture rework case study

Why?

Why “container”?

Page 14: Docker  architecture rework case study
Page 15: Docker  architecture rework case study
Page 16: Docker  architecture rework case study
Page 17: Docker  architecture rework case study

Project

To: NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCronData

SSHD

Page 18: Docker  architecture rework case study

What is Docker

Lightweight virtualization

Page 19: Docker  architecture rework case study

What is Docker

Lightweight virtualization OS distro (Host)

Linux distro (VM)

OS Kernel Hardware

Hypervisor (type 2)

Linux Kernel Hardware

Application

Virtual Machine

Lightweight virtualization

Page 20: Docker  architecture rework case study

What is Docker

Lightweight virtualization OS distro (Host)

Linux distro (VM)

OS Kernel Hardware

Hypervisor (type 2)

Linux Kernel Hardware

Application

Virtual Machine

Linux distro (Host)

Files (Docker)

Linux Kernel Hardware

Docker Engine

[Application]

Docker

Page 21: Docker  architecture rework case study

What is Docker?

Containers

Page 22: Docker  architecture rework case study

What is Docker?

Containers Linux distro (Host)

Container(user space)

KernelSpace

Process

System calls

Page 23: Docker  architecture rework case study

What is Docker?

Containers Linux distro (Host)

Container(user space)

KernelSpace

Process

System calls

Linux distro (Host)

Data Container

(for instance)

/home/git/repositories

KernelSpace

Page 24: Docker  architecture rework case study

What is Docker?

Images: docker build Linux distro (Host)

Dockerfile:

FROM ubuntu

Ubuntu

Page 25: Docker  architecture rework case study

What is Docker?

Images: docker build Linux distro (Host)

Dockerfile:

FROM ubuntu

Ubuntu

NGiNXRUN \ add-apt-repository -y ppa:nginx/stable && \ apt-get update && \ apt-get install -y nginx

Page 26: Docker  architecture rework case study

What is Docker?

Images: docker build Linux distro (Host)

Dockerfile:

FROM ubuntu

Ubuntu

NGiNXRUN \ add-apt-repository -y ppa:nginx/stable && \ apt-get update && \ apt-get install -y nginx

Config file

COPY env.conf /home/git/RUN ln -fs /home/git/env.conf /etc/nginx/nginx.conf

EXPOSE 80EXPOSE 443

ENTRYPOINT ["/bin/sh", "-c"]CMD ["nginx"]

Page 27: Docker  architecture rework case study

StatusCommands

What is Docker?

Layered file system: Linux distro (Host)

Config file

NGiNX

Ubuntu

Ubuntu

NGiNX

Config files

Page 28: Docker  architecture rework case study

StatusCommands

What is Docker?

Layered file system: Linux distro (Host)

Config file

NGiNX

Ubuntu

Ubuntu

NGiNX

Config files

docker create Created

Page 29: Docker  architecture rework case study

StatusCommands

What is Docker?

Layered file system: Linux distro (Host)

Config file

NGiNX

Ubuntu

Ubuntu

NGiNX

Config files

files updates

docker start/run Up

docker create Created

Page 30: Docker  architecture rework case study

StatusCommands

What is Docker?

Layered file system: Linux distro (Host)

Config file

NGiNX

Ubuntu

Ubuntu

NGiNX

Config files

files updates

docker start/run Up

docker create Created

docker stop/kill Exited

Page 31: Docker  architecture rework case study

StatusCommands

What is Docker?

Layered file system: Linux distro (Host)

Config file

NGiNX

Ubuntu

Ubuntu

NGiNX

Config files

docker rm

docker start/run Up

docker create Created

docker stop/kill Exited

Page 32: Docker  architecture rework case study

How?

Container ordonnancement

Page 33: Docker  architecture rework case study

Docker rework

Data Container first

Gpg2

Gitolite

HooksGitrepos

Data

Page 34: Docker  architecture rework case study

Docker rework

Data Container first

Gpg2

Gitolite

HooksGitrepos

Data

Page 35: Docker  architecture rework case study

Docker rework

Data Container first

Gpg2

Gitolite

HooksGitrepos

Data

docker create --name=gitolite.repos.blessed.contgitolite.repos/home/git/repositories

Page 36: Docker  architecture rework case study

Docker rework

Leaf containers second

LDAP

Gpg2

Gitolite

HooksGitrepos

MCronData

SSHD

Page 37: Docker  architecture rework case study

Docker rework

Leaf containers second

LDAP

Gpg2

Gitolite

HooksGitrepos

MCronData

SSHD

Page 38: Docker  architecture rework case study

Docker rework

Leaf containers second

LDAP

Gpg2

Gitolite

HooksGitrepos

MCronData

SSHD

docker run --name=mcron.blessed.cont --volumes-from gitolite.blessed.cont--volumes-from data.blessed.cont

Page 39: Docker  architecture rework case study

/home/git/repositories/home/git/gitolite/home/git/data

Docker rework

Leaf containers second

LDAP

Gpg2

Gitolite

HooksGitrepos

MCronData

SSHD

docker run --name=mcron.blessed.cont --volumes-from gitolite.blessed.cont--volumes-from data.blessed.cont

Page 40: Docker  architecture rework case study

Docker rework

Linked containers last

NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCron

SSHD

Data

Page 41: Docker  architecture rework case study

Docker rework

Linked containers last

NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCron

SSHD

Data

Page 42: Docker  architecture rework case study

Docker rework

Linked containers last

NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCron

SSHD

docker run --name=apache.blessed.cont --volumes-from gitolite--volumes-from repos--volumes-from gpg2--volumes-from data

Data

Page 43: Docker  architecture rework case study

Docker rework

Linked containers last

NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCron

SSHD

docker run --name=apache.blessed.cont --volumes-from gitolite--volumes-from repos--volumes-from gpg2--volumes-from data

--link ldap.cont:apache.ldap.cont

Data

Page 44: Docker  architecture rework case study

Docker rework

Linked containers last

NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCron

SSHD

docker run --name=apache.blessed.cont --volumes-from gitolite--volumes-from repos--volumes-from gpg2--volumes-from data

--link ldap.cont:apache.ldap.cont

--link apache.staging.cont: apache.upstream.cont

Data

Apachestaging

Page 45: Docker  architecture rework case study

Docker rework

Linked containers last

NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCron

SSHD

Apachestaging

docker run --name=apache.blessed.cont --volumes-from gitolite--volumes-from repos--volumes-from gpg2--volumes-from data

--link ldap.cont:apache.ldap.cont

--link apache.staging.cont: apache.upstream.cont

-p 6043:8543-p 6053:8553 Data

Page 46: Docker  architecture rework case study

Docker rework

Linked containers last

NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCron

SSHD

Apachestaging

Data

Page 47: Docker  architecture rework case study

Docker rework

Linked containers last

NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCron

SSHD

Apachestaging

Data

docker run --name=nginx.blessed.cont

Page 48: Docker  architecture rework case study

Docker rework

Linked containers last

NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCron

SSHD

Apachestaging

Data

docker run --name=nginx.blessed.cont

--link apache.blessed.cont: nginx.apache.cont

Page 49: Docker  architecture rework case study

Docker rework

Linked containers last

NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCron

SSHD

Apachestaging

Data

docker run --name=nginx.repos.blessed.cont

--link apache.blessed.cont: nginx.apache.cont

-p 6080:80-p 6443:443

Page 50: Docker  architecture rework case study

Benefits?

Configuration & Isolation

Page 51: Docker  architecture rework case study

Docker Advantages

Configuration

NGiNX Apache

Page 52: Docker  architecture rework case study

Docker Advantages

Configuration

NGiNX

location /git/ { proxy_pass https://nginx.apache.cont:8543/git/;}

location /hgit/ { proxy_pass https://nginx.apache.cont:8553/hgit/;}

Apache

Page 53: Docker  architecture rework case study

Docker Advantages

Configuration

NGiNX

location /git/ { proxy_pass https://nginx.apache.cont:8543/git/;}

location /hgit/ { proxy_pass https://nginx.apache.cont:8553/hgit/;}

nginx.apache.cont:8543

nginx.apache.cont:8553

Apache

Page 54: Docker  architecture rework case study

Docker Advantages

Configuration

NGiNX

location /git/ { proxy_pass https://nginx.apache.cont:8543/git/;}

location /hgit/ { proxy_pass https://nginx.apache.cont:8553/hgit/;}

nginx.apache.cont:8543

nginx.apache.cont:8543

Apache EXPOSE 8543EXPOSE 8553

Page 55: Docker  architecture rework case study

Docker Advantages

Configuration

NGiNX

location /git/ { proxy_pass https://nginx.apache.cont:8543/git/;}

location /hgit/ { proxy_pass https://nginx.apache.cont:8553/hgit/;}

nginx.apache.cont:8543

nginx.apache.cont:8543

Apache EXPOSE 8543EXPOSE 8553

docker run --name=nginx.repos.blessed.cont

--link apache.blessed.cont: nginx.apache.cont

Page 56: Docker  architecture rework case study

Docker Advantages

Isolation (services)

NGiNX Apache LDAP

MCron

SSHD

Data

HooksGitrepos

Page 57: Docker  architecture rework case study

Docker Advantages

Isolation (services)

From outside: NGiNX Apache

Page 58: Docker  architecture rework case study

Docker Advantages

Isolation (services)

From inside:

MCronData

HooksGitrepos

Page 59: Docker  architecture rework case study

Docker Advantages

Isolation (services)

MCron

SSHD

Data

HooksGitrepos

Page 60: Docker  architecture rework case study

Docker Advantages

Isolation (services)

SSHD

Data

Page 61: Docker  architecture rework case study

Docker Advantages

Isolation (ports/names)

NGiNX Apache LDAP

Data MCron

SSHD

Page 62: Docker  architecture rework case study

Docker Advantages

Isolation (ports/names)

NGiNX Apache LDAPEXPOSE 8543EXPOSE 8553

EXPOSE 80EXPOSE 443

EXPOSE 369

Data MCron

SSHD

EXPOSE 2200

Page 63: Docker  architecture rework case study

Docker Advantages

Isolation (ports/names)

NGiNX Apache LDAP

port 6080port 6443

EXPOSE 8543EXPOSE 8553

EXPOSE 80EXPOSE 443

EXPOSE 369

port 6043port 6053

Data MCron

SSHD

EXPOSE 2200port 2200

Page 64: Docker  architecture rework case study

Conclusion

CaaS: Container as a Service

Page 65: Docker  architecture rework case study

End result

● 21 containers, in 3 sets, one for each environment.

● service vs. data

● Extensible without downtime.

NGiNX Apache LDAP

Gpg2

Gitolite

HooksGitrepos

MCronData

SSHD

Blessed Staging ExternalFrom:To:

Page 66: Docker  architecture rework case study

End result: CaaS

Page 67: Docker  architecture rework case study

End result: CaaS