Lesson Learned from Using Docker Swarm at Pronto

Preview:

Citation preview

USING DOCKER SWARM AT PRONTO

L E S S O N L E A R N E D F R O M

www.prontotools.ioK A N O U I V I R A C H

K A N O U I V I R A C H

A B O U T M E

Research & Development Engineer

D O C K E R S W A R M

M I C R O S E R V I C E S

https://www.nginx.com/blog/introduction-to-microservices/

. . H O W W E ’ V E S E T U P. .

docker swarm init

docker network create \ -d overlay \ --subnet=192.168.0.0/24 \ simplesat

docker service create \ --name survey \ --network simplesat \ survey:stable

docker service update \ --image survey:live survey

docker swarm join \ --token SWMTKN-1-0nqrebfaz7qc6deimizh4tfqavfq5pam1qt08alxots8w5x9fv-8ii4ina9fm640am99z1tbpfvl \ 192.168.65.2:2377

docker swarm join-token manager

To add a worker to swarm

To add a manager to swarm

O U R B U I L D P I P E L I N E L O O K S L I K E

Check-In

BUILD PIPELINE FOR SERVICE 1

BUILD PIPELINE FOR SERVICE 2

BUILD PIPELINE FOR SERVICE 3

BUILD PIPELINE FOR SERVICE 4

C O N T I N U O U S I N T E G R AT I O N P R O C E S S

Check - In

Static Analysis

Unit Tests

Build & PushPush

Deploy Production

Pull

Deploy DevPull

– I N S P I R E D B Y Y E L P

Docker Images Versioning for Continuous Delivery

docker build -t ${package}:${GIT_COMMIT}

docker tag ${package}:${GIT_COMMIT} ${package}:unstable

During the first docker build

docker tag ${package}:${GIT_COMMIT} ${package}:stable

docker push ${package}:${GIT_COMMIT} docker push ${package}:stable

After the tests pass

docker tag ${package}:${GIT_COMMIT} ${package}:live

docker push ${package}:live

After deployment succeeds

. . W H AT W E ’ V E L E A R N E D . .

http://bocabraincenter.com/conditions/learning-disabilities/

Follow the practices

• One process per one container • Use an appropriate base image (official base

image)

S E R V I C E N A M E I N T H E C O D E !

SURVEY_API_URL = 'http://survey:8000/api/'

R O L L I N G U P D AT E S

F… C O O L F E AT U R E !I S

Effortless with Blue-Green Deployment

– E A S Y T O M A I N TA I N

Keep services in one single repository

Environment variables

– ALLOW US TO HAVE SAME IMAGE ON ALL KINDS OF SERVERS

D O C K E R S W A R M

couldn’t automatically pull images from private registry when update a service

--with-registry-auth

Ex. docker service update --with-registry-auth --image simplesat-gateway:cc01ef0c gateway

(A bit) complex command

. . W H AT W E P L A N . .

https://unsplash.com/photos/CkH1Hh8kllA

Monitoring

Log centralization

Docker images versioning management

More integration tests

Questions?

www.facebook.com/girlswhodev/

We are hiring!https://www.prontomarketing.com/company/careers/

Recommended