Top Banner
Continuous integration with Docker and Ansible Dmitriy Slupytskyi
25

Continuous integration with Docker and Ansible

Apr 14, 2017

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Continuous integration with Docker and Ansible

Continuous integration with Docker and Ansible

Dmitriy Slupytskyi

Page 2: Continuous integration with Docker and Ansible

About project

• 70+ repositories

• 10+ microservices

• 4+ technologies (golang, php, ruby, nodejs)

• 65 build and deploy scripts

Page 3: Continuous integration with Docker and Ansible

Docker

Virtual Machines Containers

Page 4: Continuous integration with Docker and Ansible

Why Docker?• Easily to manager containers

• Build specify environment for project

• Isolated workspace

• Package it and be portable

• Replicable - lower barrier to entry for new environments, teams

• No “dependence hell”

Page 5: Continuous integration with Docker and Ansible

Deployment process

Start Clone Build Push DeployTest

Page 6: Continuous integration with Docker and Ansible

Jenkins

CloudBees Docker Build and Publish plugin

Page 7: Continuous integration with Docker and Ansible

Build• Use Dockerfile

• Keep layers to minimum

• Use tags for version control

• Use .dockerignore(the same syntax as .gitignore)

• One container per service

• Manage output

• GNU Make is optional

Just for presentation, make better onefor your services

😉

Page 8: Continuous integration with Docker and Ansible

Build

Page 9: Continuous integration with Docker and Ansible

Test

Page 10: Continuous integration with Docker and Ansible

Private Docker registry

• Version 0.9.1 (version 2 required docker version 1.6.0 and higher)

• Nginx + LDAP authentication (https://hub.docker.com/r/h3nrik/nginx-ldap/)

• Dockerized

Page 11: Continuous integration with Docker and Ansible

Ansible

• Inventory

• Playbooks

• Tasks

• Modules

Page 12: Continuous integration with Docker and Ansible

• docker-py (<=1.1.0)

• docker module(http://docs.ansible.com/ansible/docker_module.html)

• docker-compose

Page 13: Continuous integration with Docker and Ansible

docker-composehttps://docs.docker.com/compose/

Page 14: Continuous integration with Docker and Ansible
Page 15: Continuous integration with Docker and Ansible

Deploy

Page 16: Continuous integration with Docker and Ansible

Jenkins + Ansible plugin

Page 17: Continuous integration with Docker and Ansible

Logspout(https://hub.docker.com/r/gliderlabs/logspout/)

Page 18: Continuous integration with Docker and Ansible

Papertrail

Page 19: Continuous integration with Docker and Ansible
Page 20: Continuous integration with Docker and Ansible

Profit• easily to update and maintenance images

• Dockerfile

• portability

• isolated

• logspout

Page 21: Continuous integration with Docker and Ansible

• docker registry timeout

• ansible freezes

• time to build

Page 22: Continuous integration with Docker and Ansible

Developers

Page 23: Continuous integration with Docker and Ansible

Pros

• Logs

• Build specify environment for target service

• Service management (start, stop, restart)

• Manage environment variables (one container for few environments)

Page 24: Continuous integration with Docker and Ansible

Cons• SSH

• Time to build (can be depends on various factor, for example docker cache)

• Jenkins plugin exit with 0, even if fails, that bring up misunderstanding

• Unmounted volumes

Page 25: Continuous integration with Docker and Ansible