Эволюция процесса деплоя в проекте — Денис Яковлев,...

Post on 25-Jul-2015

98 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Эволюция процесса деплоя впроектеЯковлев Денис

2gis.ru    @rnd2gis

О себе

•  Parallels

•  10 лет

•  От QA engineer до Team Lead

•  2ГИС

•  ~1.5 года

•  Ведущий разработчик

3

Deploy

Составляющие

Код

•  SCP

•  FTP/SFTP

•  Rsync

•  Git pull

6

Данные

•  Миграции

•  yii migrate

•  django-admin.py migrate

•  etc...

7

Конфиги

•  Значения переменных

•  Рестарт сервисов

8

Third party•  Install

•  Upgrade

•  Configure

9

Решения"в лоб"

"Ручками"

•  Wiki

•  SSH

11

Скрипты

•  Bash

•  Perl

•  PowerShell

12

Плюсы

•  Быстро

•  Просто

Но только для простых проектов

14

Минусы

Увеличивается

•  Количество документации

•  Сложность скриптов

•  Ручной труд

16

Infrastructure asa code

The essence of Infrastructure as Code is to treat the configuration of systems

the same way that software source code is treated

Kief Morris. ThoughtWorks

Infrastructure automation makes it possible to carry out actions repeatedly,

across a large number of nodes. Infrastructure as code uses techniques,

practices, and tools from software development to ensure those actions are

thoroughly tested before being applied to business critical systems.

Kief Morris. ThoughtWorks

““

18

Инструменты

CMS

•  Ansible

•  Chef

•  SaltStack

•  Puppet

•  ...

20

Ansible

Ansible. Host inventory[webservers]

www.example1.com

www.example2.com

[dbservers]

db1.example.com

db2.example.com

01.

02.

03.

04.

05.

06.

22

Ansible. Playbooks•  hosts

•  tasks

ansible-playbook -i hosts playbook.yml

23

Ansible. nginx install---

- hosts: webservers

tasks:

- name: Install nginx

yum: name=nginx state=latest

- name: Copy nginx configuration

template: src=default.conf dest=/path/to/file

notify: restart nginx

01.

02.

03.

04.

05.

06.

07.

08.

24

25

Chef

Chef

•  Cookbooks

•  Roles

•  Environment

27

Chef. Configurations•  Chef server

28

29

Chef. Configurations•  Chef server

•  Chef zero

•  Chef solo

30

Chef: nginx installpackage "nginx" do

action :install

end

01.

02.

03.

31

Рабочиемоменты

•  Зона ответственности

•  Новый workflow разработки

•  + Написание инфраструктуры

•  + Тестирование инфраструктуры

33

Тестирование

•  Vagrant

vagrant init hashicorp/precise32

vagrant up

34

Тестирование

Vagrant.configure("2") do |config|

config.vm.provision "chef_solo" do |chef|

chef.cookbooks_path = ["cookbooks", "my_cookbooks"]

chef.add_recipe "apache"

end

end

01.

02.

03.

04.

05.

06.

35

С чего начать?

•  Автоматизировать простой сервис

•  Ссылки

•  https://galaxy.ansible.com

•  https://supermarket.chef.io/cookbooks

•  https://docs.ansible.com/playbooks_best_practices.html

37

Вопросы?

Яковлев Денис

d.yakovlev@2gis.ru

38

top related