Building deployment pipeline - DevOps way
-
Upload
andrey-rebrov -
Category
Technology
-
view
477 -
download
3
description
Transcript of Building deployment pipeline - DevOps way
Building deployment pipeline: DevOps way
Андрей Ребров
Инженерный тренер ScrumTrek
Continuous Deployment - Ожидание
Continuous Deployment - Реальность
Инструменты разработки != инструменты админов
Недоверие Ops к Dev
«Прохладные истории» сломанных стендов
Решение
• Обеспечить прозрачность процесса
• Обеспечить качество поставок
• Свести dev и ops в одном месте
Delivery Pipeline – наш выбор
Это тоже delivery pipeline
Culture Automation
Measurement Sharing
Culture
Automation
• CI Server
• Code Analysis
• Auto Tests
• Configuration Management
CI Server • Рассмотрим на примере Jenkins
Что нужно
1. Ставим pipeline plugin
2. Делаем dependency между задачами
3. Создаем новый pipeline view
4. ….
5. Profit!
Альтернативы
Configuration Management
• VM control
• OS control
• Installation control
• …
Как неправильно
Например
Vagrant Vagrant::Config.run do |config| config.vm.box = "precise32" config.vm.box_url = http://files.vagrantup.com/precise32.box config.vm.network :hostonly, "192.168.33.10” config.vm.share_folder("v-web", "/vagrant/www", "./www", :nfs => true) config.vm.share_folder("v-db", "/vagrant/db", "./db", :nfs => true) config.vm.forward_port 80, 8080 config.vm.provision :shell, :inline => "apt-get update --fix-missing” end
Docker from ubuntu:12.10 run apt-get update run DEBIAN_FRONTEND=noninteractive apt-get install -q -y python run DEBIAN_FRONTEND=noninteractive apt-get install -q -y python-pip run pip install django run DEBIAN_FRONTEND=noninteractive apt-get install -q -y curl run curl -L https://github.com/shykes/helloflask/archive/master.tar.gz | tar -xzv run cd helloflask-master && pip install -r requirements.txt
Нужно больше инструментов!
Еще больше!
Что важно
• Useful reports
• Useful logging
• Vizualisation – Dashboards
– Graphs
– …
Работаем с логами
Node
Node
Logstash Elas.cSearch
Kibana
Как можно все это собрать
Запуск Lumberjack
/opt/lumberjack/bin/lumberjack -- host your.logstash.host --port port-for- these-logs --ssl-ca-path /etc/ssl/ logstash.pub
Для генерации ключей на logstash сервере:
openssl req -x509 -newkey rsa:2048 -keyout /etc/ ssl/logstash.key -out /etc/ssl/logstash.pub - nodes -days 365
Конфигурируем Logstash #1
input {
lumberjack {
type => "apache-access"
port => 3338
ssl_certificate => "/etc/ssl/logstash.pub"
ssl_key => "/etc/ssl/logstash.key"
}
}
Конфигурируем Logstash #2
filter {
date {
type => "apache-access"
timestamp => "dd/MMM/yyyy:HH:mm:ss Z"
}
}
Конфигурируем Logstash #3
output {
elasticsearch {
embedded => false
cluster => logs
host => "172.28.2.2"
index => "apache-%{+YYYY.MM}"
type => "apache-access"
}
}
Запуск Logstash
/usr/bin/java -jar /opt/logstash/logstash.jar agent -f <path-to-your.conf> -l <path-to-where-you-want-the.log>
Конфигурируем Elasticsearch
cluster.name: logs
index.number_of_replicas: 0
path.data: /elasticsearch/data
path.work: /elasticsearch/work
path.logs: /elasticsearch/logs
bootstrap.mlockall: true
discovery.zen.ping.multicast.enabled: false
Запускаем Elasticsearch
./bin/elasticsearch –f
или в фоне
./bin/elasticsearch
Запускаем Kibana
ruby kibana.rb
Визуализация
Что есть на рынке
Graphite
output {
graphite {
host => "10.10.10.10"
port => 2003
type => "system-netstats"
metrics => [
hosts.%{@source_host}.netstats.interfaces.%{iface}.rxpck_s,
"%{rxpck_s}”]
}
}
Что на выходе