O documento discute padrões e práticas para entrega contínua e implantações seguras, como pipeline de entrega, implantação azul-verde, implantação canário, feature toggles e dark launches. O objetivo é tornar o processo de deploy previsível através da automação e entrega incremental de melhorias em produção.
Padrões de deploy para DevOps e Entrega Contínua, por Danilo Sato
1. J o r n a d a G o i a n a e m E n g e n h a r i a d e S o f t w a re
PADRÕES DE DEPLOY PARA
DEVOPS E ENTREGA CONTÍNUA
Danilo Sato (@dtsato)
dsato@thoughtworks.com
4. UMA EMPRESA DE 100-ANOS
Nossa missão é melhorar a humanidade através do software e ajudar a gerar
a criação de um ecossistema socialmente responsável e economicamente justo.
Gerir um negócio
sustentável
Liderar e promover excelência de
software e revolucionar a indústria de TI
Advogar apaixonadamente em
favor da justiça social e econômica
5. MAIS DE 20 ANOS DE
LIDERANÇA NO PENSAMENTO
…para nomear
alguns
6. QUEM SOU EU?
▫︎Desenvolvedor
▫︎Arquiteto
▫︎Coach
▫︎Treinador
▫︎Administrador de Rede
6
@dtsato
18. PIPELINE DE ENTREGA
17
Repositório
de Código
Build e Testes
de Unidade
Testes de
Aceitação
Validação
com Usuário
Deploy em
Produção
F
commit
feedback
P
commit
feedback
F
P
commit
P
P
aprovação
19. PIPELINE DE ENTREGA
18
App A
Service B
Service C
Unit
Tests
Version
Control
Artifact
Repository
Integration
Tests
Unit
Tests
Integration
Tests
Unit
Tests
Integration
Tests
Contract
Tests
Contract
Tests
Deploy to
Dev Smoke
Deploy to
Int Application
Testing Smoke
Service D
App E
Service F
Unit
Tests
Integration
Tests
Unit
Tests
Integration
Tests
Unit
Tests
Integration
Tests
Contract
Tests
Deploy to
Dev Smoke
Application
Testing
Contract
Tests
Deploy to
Dev Smoke
Deploy to
Int Smoke
Deploy to
Int
End to End
Testing
Dev
Environment
Deploy to
Performance
QA Smoke
Testing UAT
Integration
Environment
QA
Environment
Deploy to
Production Smoke
COTS
Production
Environment
Deploy to
Int
(...)
(…)
29. FOQUE EM ENTREGAR LOTES PEQUENOS
24
https://www.flickr.com/photos/pelosi/2836152295 https://www.flickr.com/photos/55391407@N03/5137410738
vs.
30. FOQUE EM ENTREGAR LOTES PEQUENOS
24
https://www.flickr.com/photos/pelosi/2836152295 https://www.flickr.com/photos/55391407@N03/5137410738
MTBF
Mean Time Between Failure
MTTR
Mean Time To Recover
vs.
31. FOQUE EM ENTREGAR LOTES PEQUENOS
24
https://www.flickr.com/photos/pelosi/2836152295 https://www.flickr.com/photos/55391407@N03/5137410738
MTBF
Mean Time Between Failure
MTTR
Mean Time To Recover
vs.
32. QUALIDADE DEVE ESTAR EMBUTIDA
NO PROCESSO
https://www.flickr.com/photos/edgarallanbro/71979142275 4
33. MUDANÇA PARALELA
26
Também conhecida como “Expansão e Contração”
http://www.thoughtworks.com/insights/blog/mudança-paralela
https://www.flickr.com/photos/telstar/8246798446
34. 1. EXPANSÃO
27
class Grid {
private Cell[][] cells;
…
!
public void addCell(int x, int y, Cell cell) {
cells[x][y] = cell;
}
public Cell fetchCell(int x, int y) {
return cells[x][y];
}
!!
public boolean isEmpty(int x, int y) {
return cells[x][y] == null;
}
!!!
}
35. 1. EXPANSÃO
28
class Grid {
private Cell[][] cells;
…
!
public void addCell(int x, int y, Cell cell) {
cells[x][y] = cell;
}
!
public Cell fetchCell(int x, int y) {
return cells[x][y];
}
!!!
public boolean isEmpty(int x, int y) {
return cells[x][y] == null;
}
!!!
}
36. 1. EXPANSÃO
29
class Grid {
private Cell[][] cells;
private Map<Coordinate, Cell> newCells;
…
!
public void addCell(int x, int y, Cell cell) {
cells[x][y] = cell;
}
public void addCell(Coordinate coordinate, Cell cell) {
newCells.put(coordinate, cell);
}
public Cell fetchCell(int x, int y) {
return cells[x][y];
}
public Cell fetchCell(Coordinate coordinate) {
return newCells.get(coordinate);
}
public boolean isEmpty(int x, int y) {
return cells[x][y] == null;
}
public boolean isEmpty(Coordinate coordinate) {
return !newCells.containsKey(coordinate);
}
}
37. 2. MIGRAÇÃO
30
Nova Versão
Cliente
Versão
Antiga
Cliente
Cliente
addCell(int x, int y, Cell cell)
fetchCell(int x, int y)
isEmpty(int x, int y)
Cell[][] cells
Map<Coordinate, Cell> newCells
38. 2. MIGRAÇÃO
31
Nova Versão
Cliente
Versão
Antiga
Cliente
Cliente
addCell(int x, int y, Cell cell)
fetchCell(Coordinate c)
isEmpty(Coordinate c)
Cell[][] cells
Map<Coordinate, Cell> newCells
39. 3. CONTRAÇÃO
32
Nova Versão
Cliente
Cliente
Cliente
addCell(Coordinate c, Cell cell)
fetchCell(Coordinate c)
isEmpty(Coordinate c)
Cell[][] cells
Map<Coordinate, Cell> cells
40. 3. CONTRAÇÃO
33
class Grid {
private Cell[][] cells;
private Map<Coordinate, Cell> newCells;
…
!
public void addCell(int x, int y, Cell cell) {
cells[x][y] = cell;
}
public void addCell(Coordinate coordinate, Cell cell) {
newCells.put(coordinate, cell);
}
public Cell fetchCell(int x, int y) {
return cells[x][y];
}
public Cell fetchCell(Coordinate coordinate) {
return newCells.get(coordinate);
}
public boolean isEmpty(int x, int y) {
return cells[x][y] == null;
}
public boolean isEmpty(Coordinate coordinate) {
return !newCells.containsKey(coordinate);
}
}
43. IMPLANTAÇÃO AZUL-VERDE
36
Verde
Azul
Servidor
web
Servidor de
aplicação
Servidor de
BD
Usuários Roteador
Servidor
web
Servidor de
aplicação
Servidor de
BD
44. IMPLANTAÇÃO AZUL-VERDE
37
Verde
Azul
Servidor
web
Servidor de
aplicação
Servidor de
BD
Usuários Roteador
Servidor
web
Servidor de
aplicação
Servidor de
BD
46. IMPLANTAÇÃO AZUL-VERDE
39
Azul
Verde
Azul
Verde
Servidor
web
Servidor de
BD
Usuários Roteador
Servidor
web
Servidor de
BD
Servidor de
aplicação
Servidor de
aplicação
47. IMPLANTAÇÃO AZUL-VERDE
40
Azul
Verde
Azul
Verde
Servidor
web
Servidor de
BD
Usuários Roteador
Servidor
web
Servidor de
BD
Servidor de
aplicação
Servidor de
aplicação
48. IMPLANTAÇÃO AZUL-VERDE
41
Azul
Verde
Azul
Verde
Servidor
web
Servidor de
BD
Usuários Roteador
Servidor
web
Servidor de
BD
Servidor de
aplicação
Servidor de
aplicação
51. IMPLANTAÇÃO CANÁRIO
44
Versão Antiga
Nova Versão
Servidor
web
Servidor de
aplicação
Servidor de
BD
Servidor
web
Servidor de
aplicação
Servidor de
BD
Todos os
usuários
Usuários Roteador
52. IMPLANTAÇÃO CANÁRIO
45
Versão Antiga
Nova Versão
Servidor
web
Servidor de
aplicação
Servidor de
BD
Servidor
web
Servidor de
aplicação
Servidor de
BD
Maior parte dos
usuários
(95%)
Usuários Roteador
Alguns
usuários
(5%)
53. IMPLANTAÇÃO CANÁRIO
46
Versão Antiga
Nova Versão
Servidor
web
Servidor de
aplicação
Servidor de
BD
Servidor
web
Servidor de
aplicação
Servidor de
BD
Alguns
usuários
Usuários Roteador
(2%)
Maior parte
dos usuários
(98%)
54. IMPLANTAÇÃO CANÁRIO
47
Versão Antiga
Nova Versão
Servidor
web
Servidor de
aplicação
Servidor de
BD
Servidor
web
Servidor de
aplicação
Servidor de
BD
Usuários
Roteador
Todos os
usuários
56. FEATURE TOGGLE
49
share_with_friends = false
Configuração:
Livro Devops na Prática: Entrega de Software Confiável e Automatizada
http://www.devopsnapratica.com.br Google
57. FEATURE TOGGLE
50
share_with_friends = true
Configuração:
Livro Devops na Prática: Entrega de Software Confiável e Automatizada
http://www.devopsnapratica.com.br Google
58. 51
ENTREGA NO
ESCURO
https://www.flickr.com/photos/dwrose/3967195917
59. ENTREGA NO ESCURO
52
Web Page Title
http://facebook.com Google
João
Backend de Chat
Web Page Title
http://facebook.com Google
Maria
60. ENTREGA NO ESCURO
53
Web Page Title
http://facebook.com Google
Phasellus nulla risus, semper non dictum semper, congue
vitae augue. Nunc vulputate ligula eget neque tempus.
Maria
disse
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Curabitur eget ultrices velit.
Suspendisse ut justo elementum felis facilisis aliquam ut
sit amet mi. Praesent sit amet venenatis eros. Fusce est
João
João tellus, congue ac augue in, congue elementum quam.
disse
Backend de Chat
Web Page Title
http://facebook.com Google
Maria
Phasellus nulla risus, semper non dictum semper, congue
vitae augue. Nunc vulputate ligula eget neque tempus.
Maria
disse
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Curabitur eget ultrices velit.
Suspendisse ut justo elementum felis facilisis aliquam ut
sit amet mi. Praesent sit amet venenatis eros. Fusce est
João tellus, congue ac augue in, congue elementum quam.
disse
61. ENTREGA NO ESCURO
54
Web Page Title
http://facebook.com Google
Phasellus nulla risus, semper non dictum semper, congue
vitae augue. Nunc vulputate ligula eget neque tempus.
Maria
disse
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Curabitur eget ultrices velit.
Suspendisse ut justo elementum felis facilisis aliquam ut
sit amet mi. Praesent sit amet venenatis eros. Fusce est
João
João tellus, congue ac augue in, congue elementum quam.
disse
Backend de Chat
Web Page Title
http://facebook.com Google
Maria
Phasellus nulla risus, semper non dictum semper, congue
vitae augue. Nunc vulputate ligula eget neque tempus.
Maria
disse
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Curabitur eget ultrices velit.
Suspendisse ut justo elementum felis facilisis aliquam ut
sit amet mi. Praesent sit amet venenatis eros. Fusce est
João tellus, congue ac augue in, congue elementum quam.
disse
86. PRINCÍPIOS PARA ENTREGAS
DE BAIXO RISCO
1. Incremental é melhor que “big bang”
2. Implantação != Entrega
3. Foque em entregar lotes pequenos
4. Qualidade deve estar embutida no
processo
69
88. 71
MAIS INFORMAÇÕES
▫︎TI de alto desempenho é uma
vantagem competitiva
▫︎Práticas de DevOps melhoram o
desempenho de TI
▫︎Cultura organizacional é
importante
▫︎Satisfação no emprego é o
preditor Nº 1 de desempenho
organizacional
http://puppetlabs.com/2014-devops-report
89. 72
PRÁTICAS CORRELACIONADAS
Métricas de vazão Métricas de Estabilidade
Freqüência de deploy
- Entrega Contínua
- Controle de Versões
Tempo médio para recuperação
- Controle de Versões
- Monitoramento da Saúde do Sistema e
das Aplicações
Tempo de ciclo para mudanças
- Controle de Versões
- Testes Automatizados
Taxa de falhas para mudanças
Não apresentou correlação forte com as
práticas estudadas
90. MAIS CONTEÚDO
▫︎Kit de Entrega Contínua:
▫︎http://info.thoughtworks.com/entrega-continua-toolkit
▫︎Insights (blogs e artigos)
▫︎Livros
▫︎Slides
▫︎Vídeo
73