Q C o n R i o 2 0 1 4 
PADRÕES DE DEPLOY PARA 
DEVOPS E ENTREGA CONTÍNUA 
Danilo Sato (@dtsato) 
dsato@thoughtworks.com
QUEM SOU EU? 
▫︎Desenvolvedor 
▫︎Arquiteto 
▫︎Coach 
▫︎Treinador 
▫︎Administrador de Rede 
2 
@dtsato
3 
www.devopsnapratica.com.br
3 
www.devopsnapratica.com.br
UMA HISTÓRIA 
COMUM… 
4 
“O dia que fizemos o deploy errado”
5 
Freqüência de 
deploy 
Quantidade de 
mudanças 
Risco 
Processo
COM UM FINAL 
DIFERENTE… 
6 
“Problemas difíceis não se resolvem do dia para a noite”
7 
Freqüência de 
deploy 
Quantidade de 
mudanças 
Risco 
Processo 
DevOps
Nosso objetivo é tornar o deploy um 
“não-evento” 
8
AUTOMAÇÃO 
https://www.flickr.com/photos/sushithegreat/2139611429 9
Ideia Em produção 
10
Ideia Em produção 
11 
Código 
Testes 
Pacote 
Aprovação 
Homologação / Ambientes 
Servidores / Exploração / Implantar
Ideia Em produção 
11 
Código 
Testes 
Pacote 
Aprovação 
Homologação / Ambientes 
Servidores / Exploração / Implantar 
Pipeline de Entrega
PIPELINE DE ENTREGA 
12
PIPELINE DE ENTREGA 
13 
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
PIPELINE DE ENTREGA 
14 
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 
(...) 
(…)
15 
Monitoramento 
Alertas 
Suporte 
Feedback dos usuários 
Dados / Análises 
Insights 
Em produção
15 
Monitoramento 
Alertas 
Suporte 
Feedback dos usuários 
Dados / Análises 
Insights 
Em produção Ideia
16 
Tempo de Ciclo 
Qualidade
PRINCÍPIOS PARA 
ENTREGAS DE BAIXO 
RISCO 
17
INCREMENTAL É MELHOR QUE “BIG BANG” 
18
INCREMENTAL É MELHOR QUE “BIG BANG” 
18 
… …
INCREMENTAL É MELHOR QUE “BIG BANG” 
18 
… …
INCREMENTAL É MELHOR QUE “BIG BANG” 
18 
… …
IMPLANTAÇÃO != ENTREGA 
https://www.flickr.com/photos/thesurlefilariane/151313600189 5
IMPLANTAÇÃO != ENTREGA 
https://www.flickr.com/photos/thesurlefilariane/14944787618 
https://www.flickr.com/photos/thesurlefilariane/151313600189 5
FOQUE EM ENTREGAR LOTES PEQUENOS 
20 
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.
FOQUE EM ENTREGAR LOTES PEQUENOS 
20 
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.
QUALIDADE DEVE ESTAR EMBUTIDA 
NO PROCESSO 
https://www.flickr.com/photos/edgarallanbro/71979142271 4
MUDANÇA PARALELA 
22 
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
1. EXPANSÃO 
23 
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; 
} 
!!! 
}
1. EXPANSÃO 
24 
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; 
} 
!!! 
}
1. EXPANSÃO 
25 
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); 
} 
}
2. MIGRAÇÃO 
26 
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
2. MIGRAÇÃO 
27 
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
3. CONTRAÇÃO 
28 
Nova Versão 
Cliente 
Cliente 
Cliente 
addCell(Coordinate c, Cell cell) 
fetchCell(Coordinate c) 
isEmpty(Coordinate c) 
Cell[][] cells 
Map<Coordinate, Cell> cells
3. CONTRAÇÃ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); 
} 
}
3. CONTRAÇÃO 
30 
class Grid { 
! 
private Map<Coordinate, Cell> cells; 
… 
!!!! 
public void addCell(Coordinate coordinate, Cell cell) { 
cells.put(coordinate, cell); 
} 
!!! 
public Cell fetchCell(Coordinate coordinate) { 
return cells.get(coordinate); 
} 
!!! public boolean isEmpty(Coordinate coordinate) { 
return !cells.containsKey(coordinate); 
} 
}
31 
IMPLANTAÇÃO 
AZUL-VERDE 
http://www.thoughtworks.com/insights/blog/implementando-implantacoes-azul- 
verde-com-amazon-web-services-aws
IMPLANTAÇÃO AZUL-VERDE 
32 
Verde 
Azul 
Servidor 
web 
Servidor de 
aplicação 
Servidor de 
BD 
Usuários Roteador 
Servidor 
web 
Servidor de 
aplicação 
Servidor de 
BD
IMPLANTAÇÃO AZUL-VERDE 
33 
Verde 
Azul 
Servidor 
web 
Servidor de 
aplicação 
Servidor de 
BD 
Usuários Roteador 
Servidor 
web 
Servidor de 
aplicação 
Servidor de 
BD
“Mas e o Banco de Dados?” 
34
IMPLANTAÇÃO AZUL-VERDE 
35 
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
IMPLANTAÇÃO AZUL-VERDE 
36 
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
IMPLANTAÇÃO AZUL-VERDE 
37 
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
38 
https://speakerdeck.com/mavcunha/releases-sem-interrupcoes
39 
IMPLANTAÇÃO 
CANÁRIO 
http://www.thoughtworks.com/insights/blog/implantações-canário
IMPLANTAÇÃO CANÁRIO 
40 
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
IMPLANTAÇÃO CANÁRIO 
41 
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%)
IMPLANTAÇÃO CANÁRIO 
42 
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%)
IMPLANTAÇÃO CANÁRIO 
43 
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
44 
FEATURE TOGGLES 
http://martinfowler.com/bliki/FeatureToggle.html 
https://www.flickr.com/photos/waynewilkinson/6187603535
FEATURE TOGGLE 
45 
share_with_friends = false 
Configuração: 
Livro Devops na Prática: Entrega de Software Confiável e Automatizada 
http://www.devopsnapratica.com.br Google
FEATURE TOGGLE 
46 
share_with_friends = true 
Configuração: 
Livro Devops na Prática: Entrega de Software Confiável e Automatizada 
http://www.devopsnapratica.com.br Google
47 
ENTREGA NO 
ESCURO 
https://www.flickr.com/photos/dwrose/3967195917
ENTREGA NO ESCURO 
48 
Web Page Title 
http://facebook.com Google 
João 
Backend de Chat 
Web Page Title 
http://facebook.com Google 
Maria
ENTREGA NO ESCURO 
49 
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
ENTREGA NO ESCURO 
50 
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
SERVIDORES 
PHOENIX 
51 
http://martinfowler.com/bliki/PhoenixServer.html
SERVIDORES SNOWFLAKE 
52 
…
SERVIDORES SNOWFLAKE 
53 
… …
SERVIDORES SNOWFLAKE 
54 
… … …
SERVIDORES SNOWFLAKE 
54 
… … …
SERVIDORES PHOENIX 
55 
…
SERVIDORES PHOENIX 
56 
…
SERVIDORES PHOENIX 
56 
…
SERVIDORES PHOENIX 
56 
… …
SERVIDORES PHOENIX 
57 
… …
SERVIDORES PHOENIX 
58 
… …
SERVIDORES PHOENIX 
58 
… …
SERVIDORES PHOENIX 
58 
… …
SERVIDORES PHOENIX 
58 
… … …
SERVIDORES 
IMUTÁVEIS 
http://martinfowler.com/bliki/ImmutableServer.html 
59
SERVIDORES IMUTÁVEIS 
60 
…
SERVIDORES IMUTÁVEIS 
61 
…
SERVIDORES IMUTÁVEIS 
61 
…
SERVIDORES IMUTÁVEIS 
61 
… …
SERVIDORES IMUTÁVEIS 
62 
… …
SERVIDORES IMUTÁVEIS 
63 
… …
SERVIDORES IMUTÁVEIS 
63 
… …
SERVIDORES IMUTÁVEIS 
63 
… … …
SERVIDORES IMUTÁVEIS 
64 
▫︎Imagem como artefato 
! ▫︎Container como artefato
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 
65
PADRÕES DE DEPLOY 
1. Automação 
2. Pipeline de Entrega 
3. Mudança Paralela 
4. Implantação Azul-Verde 
5. Implantação Canário 
6. Feature Toggles 
7. Entrega no Escuro 
8. Servidores Phoenix 
9. Servidores Imutáveis 
66
MAIS CONTEÚDO 
▫︎Kit de Entrega Contínua: 
▫︎http://info.thoughtworks.com/entrega-continua-toolkit 
▫︎Insights (blogs e artigos) 
▫︎Livros 
▫︎Slides 
▫︎Vídeo 
67
PERGUNTAS? 
68 
#DevopsNaPratica
OBRIGADO! 
Danilo Sato (@dtsato) 
dsato@thoughtworks.com 
69 
www.devopsnapratica.com.br 
! 
Continue a discussão usando 
a hashtag 
#DevopsNaPratica

Padrões de deploy para DevOps e Entrega Contínua

  • 1.
    Q C on R i o 2 0 1 4 PADRÕES DE DEPLOY PARA DEVOPS E ENTREGA CONTÍNUA Danilo Sato (@dtsato) [email protected]
  • 2.
    QUEM SOU EU? ▫︎Desenvolvedor ▫︎Arquiteto ▫︎Coach ▫︎Treinador ▫︎Administrador de Rede 2 @dtsato
  • 3.
  • 4.
  • 5.
    UMA HISTÓRIA COMUM… 4 “O dia que fizemos o deploy errado”
  • 6.
    5 Freqüência de deploy Quantidade de mudanças Risco Processo
  • 7.
    COM UM FINAL DIFERENTE… 6 “Problemas difíceis não se resolvem do dia para a noite”
  • 8.
    7 Freqüência de deploy Quantidade de mudanças Risco Processo DevOps
  • 9.
    Nosso objetivo étornar o deploy um “não-evento” 8
  • 10.
  • 11.
  • 12.
    Ideia Em produção 11 Código Testes Pacote Aprovação Homologação / Ambientes Servidores / Exploração / Implantar
  • 13.
    Ideia Em produção 11 Código Testes Pacote Aprovação Homologação / Ambientes Servidores / Exploração / Implantar Pipeline de Entrega
  • 14.
  • 15.
    PIPELINE DE ENTREGA 13 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
  • 16.
    PIPELINE DE ENTREGA 14 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 (...) (…)
  • 17.
    15 Monitoramento Alertas Suporte Feedback dos usuários Dados / Análises Insights Em produção
  • 18.
    15 Monitoramento Alertas Suporte Feedback dos usuários Dados / Análises Insights Em produção Ideia
  • 19.
    16 Tempo deCiclo Qualidade
  • 20.
    PRINCÍPIOS PARA ENTREGASDE BAIXO RISCO 17
  • 21.
    INCREMENTAL É MELHORQUE “BIG BANG” 18
  • 22.
    INCREMENTAL É MELHORQUE “BIG BANG” 18 … …
  • 23.
    INCREMENTAL É MELHORQUE “BIG BANG” 18 … …
  • 24.
    INCREMENTAL É MELHORQUE “BIG BANG” 18 … …
  • 25.
    IMPLANTAÇÃO != ENTREGA https://www.flickr.com/photos/thesurlefilariane/151313600189 5
  • 26.
    IMPLANTAÇÃO != ENTREGA https://www.flickr.com/photos/thesurlefilariane/14944787618 https://www.flickr.com/photos/thesurlefilariane/151313600189 5
  • 27.
    FOQUE EM ENTREGARLOTES PEQUENOS 20 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.
  • 28.
    FOQUE EM ENTREGARLOTES PEQUENOS 20 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.
  • 29.
    QUALIDADE DEVE ESTAREMBUTIDA NO PROCESSO https://www.flickr.com/photos/edgarallanbro/71979142271 4
  • 30.
    MUDANÇA PARALELA 22 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
  • 31.
    1. EXPANSÃO 23 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; } !!! }
  • 32.
    1. EXPANSÃO 24 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; } !!! }
  • 33.
    1. EXPANSÃO 25 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); } }
  • 34.
    2. MIGRAÇÃO 26 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
  • 35.
    2. MIGRAÇÃO 27 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
  • 36.
    3. CONTRAÇÃO 28 Nova Versão Cliente Cliente Cliente addCell(Coordinate c, Cell cell) fetchCell(Coordinate c) isEmpty(Coordinate c) Cell[][] cells Map<Coordinate, Cell> cells
  • 37.
    3. CONTRAÇÃ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); } }
  • 38.
    3. CONTRAÇÃO 30 class Grid { ! private Map<Coordinate, Cell> cells; … !!!! public void addCell(Coordinate coordinate, Cell cell) { cells.put(coordinate, cell); } !!! public Cell fetchCell(Coordinate coordinate) { return cells.get(coordinate); } !!! public boolean isEmpty(Coordinate coordinate) { return !cells.containsKey(coordinate); } }
  • 39.
    31 IMPLANTAÇÃO AZUL-VERDE http://www.thoughtworks.com/insights/blog/implementando-implantacoes-azul- verde-com-amazon-web-services-aws
  • 40.
    IMPLANTAÇÃO AZUL-VERDE 32 Verde Azul Servidor web Servidor de aplicação Servidor de BD Usuários Roteador Servidor web Servidor de aplicação Servidor de BD
  • 41.
    IMPLANTAÇÃO AZUL-VERDE 33 Verde Azul Servidor web Servidor de aplicação Servidor de BD Usuários Roteador Servidor web Servidor de aplicação Servidor de BD
  • 42.
    “Mas e oBanco de Dados?” 34
  • 43.
    IMPLANTAÇÃO AZUL-VERDE 35 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
  • 44.
    IMPLANTAÇÃO AZUL-VERDE 36 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
  • 45.
    IMPLANTAÇÃO AZUL-VERDE 37 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
  • 46.
  • 47.
    39 IMPLANTAÇÃO CANÁRIO http://www.thoughtworks.com/insights/blog/implantações-canário
  • 48.
    IMPLANTAÇÃO CANÁRIO 40 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
  • 49.
    IMPLANTAÇÃO CANÁRIO 41 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%)
  • 50.
    IMPLANTAÇÃO CANÁRIO 42 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%)
  • 51.
    IMPLANTAÇÃO CANÁRIO 43 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
  • 52.
    44 FEATURE TOGGLES http://martinfowler.com/bliki/FeatureToggle.html https://www.flickr.com/photos/waynewilkinson/6187603535
  • 53.
    FEATURE TOGGLE 45 share_with_friends = false Configuração: Livro Devops na Prática: Entrega de Software Confiável e Automatizada http://www.devopsnapratica.com.br Google
  • 54.
    FEATURE TOGGLE 46 share_with_friends = true Configuração: Livro Devops na Prática: Entrega de Software Confiável e Automatizada http://www.devopsnapratica.com.br Google
  • 55.
    47 ENTREGA NO ESCURO https://www.flickr.com/photos/dwrose/3967195917
  • 56.
    ENTREGA NO ESCURO 48 Web Page Title http://facebook.com Google João Backend de Chat Web Page Title http://facebook.com Google Maria
  • 57.
    ENTREGA NO ESCURO 49 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
  • 58.
    ENTREGA NO ESCURO 50 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
  • 59.
    SERVIDORES PHOENIX 51 http://martinfowler.com/bliki/PhoenixServer.html
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
    SERVIDORES IMUTÁVEIS 64 ▫︎Imagem como artefato ! ▫︎Container como artefato
  • 83.
    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 65
  • 84.
    PADRÕES DE DEPLOY 1. Automação 2. Pipeline de Entrega 3. Mudança Paralela 4. Implantação Azul-Verde 5. Implantação Canário 6. Feature Toggles 7. Entrega no Escuro 8. Servidores Phoenix 9. Servidores Imutáveis 66
  • 85.
    MAIS CONTEÚDO ▫︎Kitde Entrega Contínua: ▫︎http://info.thoughtworks.com/entrega-continua-toolkit ▫︎Insights (blogs e artigos) ▫︎Livros ▫︎Slides ▫︎Vídeo 67
  • 86.
  • 87.
    OBRIGADO! Danilo Sato(@dtsato) [email protected] 69 www.devopsnapratica.com.br ! Continue a discussão usando a hashtag #DevopsNaPratica