Minimum Viable Docker: our journey towards orchestration

Post on 21-Jan-2018

197 views 2 download

Transcript of Minimum Viable Docker: our journey towards orchestration

Minimum Viable DockerOur journey towards orchestration

What this talk is about

How we’ve been surviving with Docker running in production withoutany orchestration tool.

What we have in store for the future.

To provide affordable and accessible

healthcare to everyone on earth

Very first version of the Chatbot

Micro Service Architecture

8 Stateless Applications

HTTP Based

Start simple. Build fast.

How should our applications artefacts look like ? How to deploy them ?

Criteria:

Multiple languages (Java, Python, …)

Good dependency management

Good artefact tracking

Separate build time / deploy time

Dev/Prod parity

How should our applications artefacts look like ? How to deploy them ?

Criteria:

Multiple languages (Java, Python, …)

Good dependency management

Good artefact tracking

Separate build time / deploy time

Dev/Prod parity

FROM python:3.6-alpineMAINTAINER "Jeremie Vallee" <jeremie.vallee@babylonhealth.com>

COPY . /app

WORKDIR /app

RUN pip install -r requirements.txt

ENTRYPOINT ["python"]

CMD ["app.py"]

Dockerfile

How to manage our Dockerized applications ?

Objectives:

Fast deployments

Service routing & Authentication

Monitoring

High Availability

Scalability

How to manage our Dockerized applications ?

Objectives:

Fast deployments

Service routing & Authentication

Monitoring

High Availability

Scalability

Constraints:

Time (of course)

Docker beginner level

No AWS/GCP

Limited resources

How to manage our Dockerized applications ?

Objectives:

Fast deployments

Service routing & Authentication

Monitoring

High Availability

Scalability

Constraints:

Time (of course)

Docker beginner level

No AWS/GCP

Limited resources

Keep it simple!

What is the minimum we need to run our applications with the objectives we have ?

Linux box

Docker

MyAppA Linux box

Docker

/usr/bin/docker run --rm \ -p 127.0.0.1:8805:7799 \  --env-file /opt/babylon/myapplicationA/environment \ --name myapplicationA myrepo.io/babylon/myapplicationA:master

Running myapplicationA

[Unit]Description=My Application ARequires=docker.serviceAfter=docker.service

[Service]Restart=alwaysTimeoutStartSec=0ExecStartPre=-/usr/bin/docker rm -f myapplicationAExecStartPre=-/usr/bin/docker pull myrepo.io/babylon/myapplicationA:master

ExecStart=/usr/bin/docker run --rm \ -p 127.0.0.1:8805:7799 \  --env-file /opt/babylon/myapplicationA/environment \ --name myapplicationA myrepo.io/babylon/myapplicationA:master

ExecStop=/usr/bin/docker stop myapplicationA

[Install]WantedBy=local.target

/etc/systemd/system/myapplicationA.service

[Unit]Description=My Application ARequires=docker.serviceAfter=docker.service

[Service]Restart=alwaysTimeoutStartSec=0ExecStartPre=-/usr/bin/docker rm -f myapplicationAExecStartPre=-/usr/bin/docker pull myrepo.io/babylon/myapplicationA:master

ExecStart=/usr/bin/docker run --rm \ -p 127.0.0.1:8805:7799 \  --env-file /opt/babylon/myapplicationA/environment \ --name myapplicationA myrepo.io/babylon/myapplicationA:master

ExecStop=/usr/bin/docker stop myapplicationA

[Install]WantedBy=local.target

/etc/systemd/system/myapplicationA.service

service myapplicationA start

/etc/systemd/system/myapplicationA.service

Start

service myapplicationA stop

Stop

service myapplicationA restart

Deploy

MyAppA

MyAppB

MyAppC

Easy deployments

MyAppA

MyAppB

MyAppC

https:// myendpoint / myapplicationA

https:// myendpoint / myapplicationB

https:// myendpoint / myapplicationC

MyAppA

MyAppB

MyAppC

Service routing

MyAppA

MyAppB

MyAppC

https:// myendpoint / myapplicationA

https:// myendpoint / myapplicationB

https:// myendpoint / myapplicationC

MyAppA

MyAppB

MyAppC

Service routing

Authentication

MyAppA

MyAppB

MyAppC

Easy deployments

Service routing

Authentication

MyAppA

MyAppB

MyAppC

Monitoring ?

All applications must have a health check endpoint

https:// myendpoint / myapplicationA / health

MyAppA

MyAppB

MyAppC

Monitoring ?

Logstash on the box to collectapplication logs and metrics

Data gets shipped to Elasticsearchand visualised with Kibana

MyAppA

MyAppB

MyAppC

Easy deployments

Service routing

Authentication

Monitoring

MyAppA

MyAppB

MyAppC

Easy deployments

Service routing

Authentication

Monitoring

High Availability ?

Scalability ?

MyAppA

MyAppB

MyAppC

MyAppA

MyAppB

MyAppC

MyAppA

MyAppB

MyAppC

MyAppA

MyAppB

MyAppC

MyAppA

MyAppB

MyAppC

Load Balancer

MyAppA

MyAppB

MyAppC

MyAppA

MyAppB

MyAppC

Load Balancer

Easy deployments

Service routing

Authentication

Monitoring

High Availability

Scalability

What was good about this design ?

Matched all our objectives

Very simple and fast to set up

Allowed us to learn a lot about Docker

What are the limitations ?

HTTP based applications only

External health checks limited with multiple servers

Each application must be deployed on all servers

THE FUTURE

New needs

50+ micro services

GPU Based Applications

Queue based Applications (Kafka)

gRPC

Internationalisation

The next generation of our Infrastructure

Calico

And much more …

In conclusion

Very simple architecture

Great solution if you face the same constraints as we did

Allowed us to quickly deliver our Medical Chatbot into the real world

We learned a lot

Ready to take it to the next level

We’re hiring!

Thank you!