Infinite Scalable Systems with Docker

30
#dfist #dfist Infinite Scalable Systems with Docker Huseyin BABAL Full-Stack Software Engineer @ GittiGidiyor

Transcript of Infinite Scalable Systems with Docker

Page 1: Infinite Scalable Systems with Docker

#dfist#dfist

Infinite Scalable Systems with Docker

Huseyin BABAL

Full-Stack Software Engineer @ GittiGidiyor

Page 2: Infinite Scalable Systems with Docker

#dfist#dfist

Page 3: Infinite Scalable Systems with Docker

#dfist#dfist

Docker

Page 4: Infinite Scalable Systems with Docker

#dfist#dfist

What is Docker

Docker lets you to package application with its dependencies like code,

runtime, system libraries, etc. inside one container

Page 5: Infinite Scalable Systems with Docker

#dfist#dfist

VM vs Docker

Infrastructure Infrastructure

Host OS OS

Hypervisor Docker Engine

Guest OS Guest OS Guest OS

bins/libs bins/libs bins/libs

app1 app2 app3

bins/libs bins/libs bins/libs

app1 app2 app3

Page 6: Infinite Scalable Systems with Docker

#dfist#dfist

Docker Machine

Page 7: Infinite Scalable Systems with Docker

#dfist#dfist

What is Docker Machine?

Docker Machine lets you to create Docker host

and specific client to connect Docker on local

computer, cloud providers, even in your own

data center.

Page 8: Infinite Scalable Systems with Docker

#dfist#dfist

Creating Docker Machine

docker-machine create -d virtualbox default

Page 9: Infinite Scalable Systems with Docker

#dfist#dfist

Docker Swarm

Page 10: Infinite Scalable Systems with Docker

#dfist#dfist

What is Docker Swarm?

Native clustering for Docker

Page 11: Infinite Scalable Systems with Docker

#dfist#dfist

Howto Create Swarm?

SID=docker run swarm create

$SID will be used on clustering

Page 12: Infinite Scalable Systems with Docker

#dfist#dfist

Master Create

docker-machine create \

-d virtualbox \

--swarm \

--swarm-master \

--swarm-discovery token://$SID \

swarm-master

Page 13: Infinite Scalable Systems with Docker

#dfist#dfist

Agent Create

docker-machine create \

-d virtualbox \

--swarm \

--swarm-discovery token://$SID \

swarm-agent-00

Page 14: Infinite Scalable Systems with Docker

#dfist#dfist

Swarm Master Process

Page 15: Infinite Scalable Systems with Docker

#dfist#dfist

Swarm Agent Process

Page 16: Infinite Scalable Systems with Docker

#dfist#dfist

Swarm Relay Network

Page 17: Infinite Scalable Systems with Docker

#dfist#dfist

Architectural Design

Page 18: Infinite Scalable Systems with Docker

#dfist#dfist

Components

docker-gen Image

Nginx

NodeJS Application

Page 19: Infinite Scalable Systems with Docker

#dfist#dfist

Docker Project

Page 20: Infinite Scalable Systems with Docker

#dfist#dfist

docker-gen Image

Generates files from docker container metadata

● Centralized Logging

● Log Rotation

● Reverse Proxy Configs

● Service Discovery

Page 21: Infinite Scalable Systems with Docker

#dfist#dfist

How to Build?

docker build -t docker-gen ./docker-gen

Page 22: Infinite Scalable Systems with Docker

#dfist#dfist

How to Run?

docker run -d --restart=always --name=docker-gen \

--env=affinity:image==docker-gen:latest \

--env=DOCKER_HOST=tcp://192.168.99.103:3376 docker-gen

Page 23: Infinite Scalable Systems with Docker

#dfist#dfist

Nginx

Page 24: Infinite Scalable Systems with Docker

#dfist#dfist

How to Run?

docker run -d --restart=always --name=nginx -p 80:80 --

volumes-from=docker-gen nginx

Page 25: Infinite Scalable Systems with Docker

#dfist#dfist

http {

upstream api.nodejs.com {

server 192.168.99.100:5001;

server 192.168.99.100:5002;

}

server {

listen 80;

location / {

proxy_pass http://api.nodejs.com;

}

}

}

Page 26: Infinite Scalable Systems with Docker

#dfist#dfist

NodeJS Application

Page 27: Infinite Scalable Systems with Docker

#dfist#dfist

How to Run?

docker run -d --restart=always -p 3000 --name hello-

express-1 -P --env VHOST=api.nodejs.com

huseyinbabal/express-hello

Page 28: Infinite Scalable Systems with Docker

#dfist#dfist

Load

Balancer

swarm-agent-01

swarm-agent-02

swarm-master

Docker

Gen

Page 29: Infinite Scalable Systems with Docker

#dfist#dfist

Show Time!You can clone project here

Page 30: Infinite Scalable Systems with Docker

#dfist

Thank you!Questions?Questions?

@huseyinbabal

+HüseyinBABAL

http://huseyinbabal.net