haproxy?stats - docs.mesosphere.com · dcos package install marathon-lb http://:9090/haproxy?stats
VarnaConf - Blue/Green Deployments with Docker, haproxy and Consul
-
Upload
zeridon -
Category
Technology
-
view
255 -
download
2
Transcript of VarnaConf - Blue/Green Deployments with Docker, haproxy and Consul
Agile and DevOps The Problem The Solution The Demo Q/A
Blue/Green Deployment with HAProxyand Consul
Автоматизирано въвеждане в експлоатация на софтуер
Владимир Витков
2016.08.13 / VarnaConf
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Кой е пред вас
• Владимир• Системен Администратор• Привърженик на FOSS но не и зеалот• Експериментатор• Относително приятен човек за разговор*
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Census
• Програмисти• Администратори• Performance• Agile• QA
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Agile and DevOps
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Какво е Agile
• Идеология за разработка на софтуер• Това което се ползва• Нещо прекрасно• . . . но но съвсем• Периоди на разработка с функционалност• Много караници
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Какво е DevOps
• Смесица между администратор и разработчик• Много автоматизация• Управлени на инфраструктура• . . . като разработчик• Отново много караници
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Защо Agile и DevOps
• Agile - много версии (и често)• DevOps - мутираща инфраструктура• Сборът? - голямо натоварване ако няма синхрон• Бързо развитие на софтуера
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
The Problem
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Приложението
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
The Solution
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Архитектура
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Компоненти
• docker• haproxy• consul• registrator
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Consul
• Контейнер предоставящ key/value услуга• Съхранява описанието на приложението ни• Може да се клъстеризира
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Consul - starting
docker run --detach --restart=always \--hostname consul-master --name consul-master \gliderlabs/consul-server [-bootstrap]
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Registrator
• Динамично обновява Consul• Попълва параметри за контейнери
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Registrator - starting
docker run --detach --restart=always \--name registrator --hostname registrator \--net=host \--volume=/var/run/docker.sock:/tmp/docker.sock \gliderlabs/registrator:latest consul://localhost:8500
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
haproxy
• контейнер базиран на alpine linux• haproxy• consul-template• nginx - holding pages
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
haproxy - entrypoint
frontend http-inbind *:80# Generated automatically by consul-template# blue if app-web and blue in service/app/color# green if app-web and green in service/app/color# else holdinguse_backend app_{{with $cl:=key "service/app/color"}}{{$cl}}{{else}}holding{{end}}default_backend app_holding
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
haproxy - holding
backend web_holdingserver sink 127.0.0.1:59599
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
haproxy - color
listen web_greenbind *:18000balance roundrobin{{range $i,$s:=service "web"}}{{if .Tags | contains "green"}}server {{$i}}{{.Node}}green {{.Address}}:{{.Port}}
{{end}}{{end}}server sink 127.0.0.1:56569 backup
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
haproxy - starting
docker run --detach --restart=always \--env=’CONSUL_CONNECT=172.17.42.1:8500’ \--hostname lb-prod --name lb-prod \zeridon/haproxy-consul
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
The Demo
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Q/A
Blue/Green Deployment with HAProxy and Consul Владимир Витков
Agile and DevOps The Problem The Solution The Demo Q/A
Контакти
• Владимир Витков• [email protected]• https://www.getoto.net/zeridon• https://github.com/zeridon• http://www.slideshare.net/zeridon
Blue/Green Deployment with HAProxy and Consul Владимир Витков