Highload++ 2015
highlightAnsible + Docker
© Pavel Alexeev, 20161
DevOPSDocker в работе: взгляд на его использование в Badoo через год
Слон желтого цвета и его друзья (эксплуатация Hadoop-стека в федеральном проекте)
2
Disclaimer
Информация и часть слайдов позаимствованы из оригинальных презентаций:● Docker в работе: взгляд на его использование в Badoo через год / Турецкий
Антон Михайлович● Слон желтого цвета и его друзья (эксплуатация Hadoop-стека в федеральном
проекте) / Чистяков Александр Анатольевич
3
DOCKER
4
5
Ansible?
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Решение Badoo.Есть свободные, например Docker
Swarm
22
23
Docker registryThe Registry is a stateless, highly scalable server
side application that stores and lets you distribute Docker images.
tightly control where your images are being stored
integrate image storage and distribution tightly
into your in-house development workflow
Git-based
Start your registry:$ docker run -d -p 5000:5000 --name registry registry:2Pull (or build) some image from the hub:$ docker pull ubuntuTag the image so that it points to your registry:$ docker tag ubuntu localhost:5000/myfirstimagePush it:$ docker push localhost:5000/myfirstimagePull it back:$ docker pull localhost:5000/myfirstimageNow stop your registry and remove all data:$ docker stop registry && docker rm -v registry
Ansible
24
25
26
27
WHAT IS ANSIBLE?● cloud provisioning
● configuration management
● application deployment
● intra-service orchestration
● Multi-tier deployment
● No agents and no additional custom security infrastructure
● Very simple language (YAML, in the form of Ansible Playbooks)
28
MANAGE YOUR INVENTORY IN SIMPLE TEXT FILES
● By default, used a very simple INI inventory file
● Many services also supported
● Plugins like EC2, Rackspace, OpenStack, and more.
Here's what a plain text inventory file like:
[webservers]
www1.example.com
www2.example.com
[dbservers]
db0.example.com
db1.example.com
29
---- hosts: webserversserial: 5 # update 5 machines at a timeroles: - common - webapp
- hosts: content_serversroles: - common - content
---- yum: name={{contact.item}} state=installedwith_items: - app_server - acme_software
- service: name=app_server state=running enabled=yes
- template: src=/opt/code/templates/foo.j2 dest=/etc/foo.confnotify: - restart app server
Playbook looks like
30
Playbook Roles and Include Statements
Variables
Jinja2 filters
Conditionals
Loops
Blocks
Strategies
Best Practices
Multi-tier rollouts rolling updates
Delegate actions to other hosts
Interacting with monitoring servers and load balancers
Playbook simple but powerful
31
Top Related