PADRÕES DE DEPLOY PARA 
DEVOPS E ENTREGA CONTÍNUA 
Danilo Sato (@dtsato) 
dsato@thoughtworks.com
MISSÕES AMBICIOSAS EXIGEM 
IDEIAS DISRUPTIVAS
NEGÓCIO GLOBAL: COMUNIDADE GLOBAL
NEGÓCIO GLOBAL: COMUNIDADE GLOBAL 
www.thoughtworks.com/pt/join 
BH!
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
MAIS DE 20 ANOS DE 
LIDERANÇA NO PENSAMENTO 
…para nomear 
alguns
QUEM SOU EU? 
▫︎Desenvolvedor 
▫︎Arquiteto 
▫︎Coach 
▫︎Treinador 
▫︎Administrador de Rede 
6 
@dtsato
7 
www.devopsnapratica.com.br
UMA HISTÓRIA 
COMUM… 
8 
“O dia que fizemos o deploy errado”
9 
Freqüência de 
deploy 
Quantidade de 
mudanças 
Risco 
Processo
COM UM FINAL 
DIFERENTE… 
10 
“Problemas difíceis não se resolvem do dia para a noite”
11 
Freqüência de 
deploy 
Quantidade de 
mudanças 
Risco 
Processo 
DevOps
Nosso objetivo é tornar o deploy um 
“não-evento” 
12
AUTOMAÇÃO 
https://www.flickr.com/photos/sushithegreat/21396114123 9
Ideia Em produção 
14
Ideia Em produção 
15 
Código 
Testes 
Pacote 
Aprovação 
Homologação / Ambientes 
Servidores / Exploração / Implantar
Ideia Em produção 
15 
Código 
Testes 
Pacote 
Aprovação 
Homologação / Ambientes 
Servidores / Exploração / Implantar 
Pipeline de Entrega
PIPELINE DE ENTREGA 
16
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
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 
(...) 
(…)
19 
Monitoramento 
Alertas 
Suporte 
Feedback dos usuários 
Dados / Análises 
Insights 
Em produção
19 
Monitoramento 
Alertas 
Suporte 
Feedback dos usuários 
Dados / Análises 
Insights 
Em produção Ideia
20 
Tempo de Ciclo 
Qualidade
PRINCÍPIOS PARA 
ENTREGAS DE BAIXO 
RISCO 
21
INCREMENTAL É MELHOR QUE “BIG BANG” 
22 
… …
INCREMENTAL É MELHOR QUE “BIG BANG” 
22 
… …
IMPLANTAÇÃO != ENTREGA 
https://www.flickr.com/photos/thesurlefilariane/151313600283 5
IMPLANTAÇÃO != ENTREGA 
https://www.flickr.com/photos/thesurlefilariane/14944787618 
https://www.flickr.com/photos/thesurlefilariane/151313600283 5
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.
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.
QUALIDADE DEVE ESTAR EMBUTIDA 
NO PROCESSO 
https://www.flickr.com/photos/edgarallanbro/71979142275 4
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
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; 
} 
!!! 
}
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; 
} 
!!! 
}
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); 
} 
}
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
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
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
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); 
} 
}
3. CONTRAÇÃO 
34 
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); 
} 
}
35 
IMPLANTAÇÃO 
AZUL-VERDE 
http://www.thoughtworks.com/insights/blog/implementando-implantacoes-azul- 
verde-com-amazon-web-services-aws
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
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
“Mas e o Banco de Dados?” 
38
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
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
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
42 
https://speakerdeck.com/mavcunha/releases-sem-interrupcoes
43 
IMPLANTAÇÃO 
CANÁRIO 
http://www.thoughtworks.com/insights/blog/implantações-canário
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
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%)
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%)
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
48 
FEATURE TOGGLES 
http://martinfowler.com/bliki/FeatureToggle.html 
https://www.flickr.com/photos/waynewilkinson/6187603535
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
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
51 
ENTREGA NO 
ESCURO 
https://www.flickr.com/photos/dwrose/3967195917
ENTREGA NO ESCURO 
52 
Web Page Title 
http://facebook.com Google 
João 
Backend de Chat 
Web Page Title 
http://facebook.com Google 
Maria
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
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
SERVIDORES 
PHOENIX 
55 
http://martinfowler.com/bliki/PhoenixServer.html
SERVIDORES SNOWFLAKE 
56 
…
SERVIDORES SNOWFLAKE 
57 
… …
SERVIDORES SNOWFLAKE 
58 
… … …
SERVIDORES SNOWFLAKE 
58 
… … …
SERVIDORES PHOENIX 
59 
…
SERVIDORES PHOENIX 
60 
…
SERVIDORES PHOENIX 
60 
…
SERVIDORES PHOENIX 
60 
… …
SERVIDORES PHOENIX 
61 
… …
SERVIDORES PHOENIX 
62 
… …
SERVIDORES PHOENIX 
62 
… …
SERVIDORES PHOENIX 
62 
… …
SERVIDORES PHOENIX 
62 
… … …
SERVIDORES 
IMUTÁVEIS 
http://martinfowler.com/bliki/ImmutableServer.html 
63
SERVIDORES IMUTÁVEIS 
64 
…
SERVIDORES IMUTÁVEIS 
65 
…
SERVIDORES IMUTÁVEIS 
65 
…
SERVIDORES IMUTÁVEIS 
65 
… …
SERVIDORES IMUTÁVEIS 
66 
… …
SERVIDORES IMUTÁVEIS 
67 
… …
SERVIDORES IMUTÁVEIS 
67 
… …
SERVIDORES IMUTÁVEIS 
67 
… … …
SERVIDORES IMUTÁVEIS 
68 
▫︎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 
69
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 
70
MAIS CONTEÚDO 
▫︎Kit de Entrega Contínua: 
▫︎http://info.thoughtworks.com/entrega-continua-toolkit 
▫︎Insights (blogs e artigos) 
▫︎Livros 
▫︎Slides 
▫︎Vídeo 
71
PERGUNTAS? 
72 
#DevopsNaPratica
OBRIGADO! 
Danilo Sato (@dtsato) 
dsato@thoughtworks.com 
73 
www.devopsnapratica.com.br 
! 
#DevopsNaPratica

Padrões de deploy para devops e entrega contínua - DevDay 2014

  • 1.
    PADRÕES DE DEPLOYPARA DEVOPS E ENTREGA CONTÍNUA Danilo Sato (@dtsato) dsato@thoughtworks.com
  • 2.
    MISSÕES AMBICIOSAS EXIGEM IDEIAS DISRUPTIVAS
  • 3.
  • 4.
    NEGÓCIO GLOBAL: COMUNIDADEGLOBAL www.thoughtworks.com/pt/join BH!
  • 5.
    UMA EMPRESA DE100-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
  • 6.
    MAIS DE 20ANOS DE LIDERANÇA NO PENSAMENTO …para nomear alguns
  • 7.
    QUEM SOU EU? ▫︎Desenvolvedor ▫︎Arquiteto ▫︎Coach ▫︎Treinador ▫︎Administrador de Rede 6 @dtsato
  • 8.
  • 9.
    UMA HISTÓRIA COMUM… 8 “O dia que fizemos o deploy errado”
  • 10.
    9 Freqüência de deploy Quantidade de mudanças Risco Processo
  • 11.
    COM UM FINAL DIFERENTE… 10 “Problemas difíceis não se resolvem do dia para a noite”
  • 12.
    11 Freqüência de deploy Quantidade de mudanças Risco Processo DevOps
  • 13.
    Nosso objetivo étornar o deploy um “não-evento” 12
  • 14.
  • 15.
  • 16.
    Ideia Em produção 15 Código Testes Pacote Aprovação Homologação / Ambientes Servidores / Exploração / Implantar
  • 17.
    Ideia Em produção 15 Código Testes Pacote Aprovação Homologação / Ambientes Servidores / Exploração / Implantar Pipeline de Entrega
  • 18.
  • 19.
    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
  • 20.
    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 (...) (…)
  • 21.
    19 Monitoramento Alertas Suporte Feedback dos usuários Dados / Análises Insights Em produção
  • 22.
    19 Monitoramento Alertas Suporte Feedback dos usuários Dados / Análises Insights Em produção Ideia
  • 23.
    20 Tempo deCiclo Qualidade
  • 24.
    PRINCÍPIOS PARA ENTREGASDE BAIXO RISCO 21
  • 25.
    INCREMENTAL É MELHORQUE “BIG BANG” 22 … …
  • 26.
    INCREMENTAL É MELHORQUE “BIG BANG” 22 … …
  • 27.
    IMPLANTAÇÃO != ENTREGA https://www.flickr.com/photos/thesurlefilariane/151313600283 5
  • 28.
    IMPLANTAÇÃO != ENTREGA https://www.flickr.com/photos/thesurlefilariane/14944787618 https://www.flickr.com/photos/thesurlefilariane/151313600283 5
  • 29.
    FOQUE EM ENTREGARLOTES 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.
  • 30.
    FOQUE EM ENTREGARLOTES 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.
    QUALIDADE DEVE ESTAREMBUTIDA NO PROCESSO https://www.flickr.com/photos/edgarallanbro/71979142275 4
  • 32.
    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
  • 33.
    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; } !!! }
  • 34.
    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; } !!! }
  • 35.
    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); } }
  • 36.
    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
  • 37.
    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
  • 38.
    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
  • 39.
    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); } }
  • 40.
    3. CONTRAÇÃO 34 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); } }
  • 41.
    35 IMPLANTAÇÃO AZUL-VERDE http://www.thoughtworks.com/insights/blog/implementando-implantacoes-azul- verde-com-amazon-web-services-aws
  • 42.
    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
  • 43.
    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
  • 44.
    “Mas e oBanco de Dados?” 38
  • 45.
    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
  • 46.
    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
  • 47.
    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
  • 48.
  • 49.
    43 IMPLANTAÇÃO CANÁRIO http://www.thoughtworks.com/insights/blog/implantações-canário
  • 50.
    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
  • 51.
    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%)
  • 52.
    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%)
  • 53.
    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
  • 54.
    48 FEATURE TOGGLES http://martinfowler.com/bliki/FeatureToggle.html https://www.flickr.com/photos/waynewilkinson/6187603535
  • 55.
    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
  • 56.
    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
  • 57.
    51 ENTREGA NO ESCURO https://www.flickr.com/photos/dwrose/3967195917
  • 58.
    ENTREGA NO ESCURO 52 Web Page Title http://facebook.com Google João Backend de Chat Web Page Title http://facebook.com Google Maria
  • 59.
    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
  • 60.
    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
  • 61.
    SERVIDORES PHOENIX 55 http://martinfowler.com/bliki/PhoenixServer.html
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
    SERVIDORES IMUTÁVEIS 68 ▫︎Imagem como artefato ! ▫︎Container como artefato
  • 85.
    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
  • 86.
    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 70
  • 87.
    MAIS CONTEÚDO ▫︎Kitde Entrega Contínua: ▫︎http://info.thoughtworks.com/entrega-continua-toolkit ▫︎Insights (blogs e artigos) ▫︎Livros ▫︎Slides ▫︎Vídeo 71
  • 88.
  • 89.
    OBRIGADO! Danilo Sato(@dtsato) dsato@thoughtworks.com 73 www.devopsnapratica.com.br ! #DevopsNaPratica