Upload
dmytro-slupytskyi
View
623
Download
1
Embed Size (px)
Citation preview
Continuous integration with Docker and Ansible
Dmitriy Slupytskyi
About project
• 70+ repositories
• 10+ microservices
• 4+ technologies (golang, php, ruby, nodejs)
• 65 build and deploy scripts
Docker
Virtual Machines Containers
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”
Deployment process
Start Clone Build Push DeployTest
Jenkins
CloudBees Docker Build and Publish plugin
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
😉
Build
Test
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
Ansible
• Inventory
• Playbooks
• Tasks
• Modules
• docker-py (<=1.1.0)
• docker module(http://docs.ansible.com/ansible/docker_module.html)
• docker-compose
docker-composehttps://docs.docker.com/compose/
Deploy
Jenkins + Ansible plugin
Logspout(https://hub.docker.com/r/gliderlabs/logspout/)
Papertrail
Profit• easily to update and maintenance images
• Dockerfile
• portability
• isolated
• logspout
• docker registry timeout
• ansible freezes
• time to build
Developers
Pros
• Logs
• Build specify environment for target service
• Service management (start, stop, restart)
• Manage environment variables (one container for few environments)
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