38
Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien zur Entwicklung verteilter Java-Anwendungen Continuous Deployment Keine Angst vor Releases

Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien zur Entwicklung verteilter Java-Anwendungen

Continuous DeploymentKeine Angst vor Releases

Page 2: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 2 ]

• Einführung • Begriffsklärung • Firmenbeispiele • Vorteile von Continuous Deployment

• Deployment Pipeline • Commit Stage • Akzeptanztests • Kapazitätstests • Explorative Tests • Produktion

• Fazit • Literatur

Gliederung

Page 3: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 3 ]

Einführung

Page 4: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 4 ]

Begriffsklärung

Continuous Integration (CI)

� Gemeinsames Repository� Automatisch kompilieren und bauen � Unittests

� Beinhaltet CI� Durchlauf weiterer Test-phasen� Entwickler bestimmen Deployment-zeitpunkt selbst

� Beinhaltet CD� Jede Änderung im Code kann automatisch in Produktion gehen

Continuous Delivery (CD)

Continuous Deployment

Page 5: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 5 ]

Firmenbeispiele

Google-Web-Server-Team • »No changes without tests«

CSG International • Tägliche Deployments • Produktionsnahe Testumgebungen

Page 6: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 6 ]

Continuous Deployment – Vorteile

FAST! FAST

! FAST

! FAST

!

Kurze Durchlaufzeiten

Mehr Verantwortung für die Teams

Schnelles Feedback

Weniger Risiko, mehr Qualität

Page 7: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 7 ]

Kurze Durchlaufzeiten

• Weniger manuelle Arbeitsschritte durch Automatisierung • Schnellere Veröffentlichung von neuen Features • Verbesserung der Time-To-Market

FAST!

Page 8: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 8 ]

Risiko reduzieren / Qualität erhöhen

• Automatisierung bringt Sicherheit • Reproduzierbare und nachvollziehbare Prozesse • Einführung von häufigeren Deployments • Somit kleine, überschaubare Änderungen pro Deployment

FAST!

Page 9: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 9 ]

Schnelles Feedback

• Durch Automatisierung schneller Durchlauf der Pipeline • Häufige Durchläufe der gesamten Pipeline

schaffen regelmäßiges Feedback (Release nicht nur einmal pro Monat/Quartal)

FAST!

Page 10: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 10 ]

Mehr Verantwortung

• Team ist verantwortlich für den Zustand der Deployment Pipeline

• Team ist verantwortlich dafür, dass keine fehlerhafte Software in Produktion gelangt

• Keine weitere Instanz außer dem Team prüft Code-Änderungen, bevor sie in Produktion gelangen

• Mehr Verantwortung kann zu besserer Qualität der Anwendung führen

FAST!

Page 11: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 11 ]

Deployment Pipeline

Page 12: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 12 ]

Pipeline – Allgemein

• Selbe Binaries (Artefakt) für alle Phasen, inkl. Produktion • Gleicher Deployment Prozess für alle Phasen • Testumgebungen sollten nahezu der Produktionsumgebung

entsprechen • Schnelle Tests an den Anfang der Pipeline,

langsame Tests nach hinten verschieben • Fehlerhafte Artefakte gelangen nicht zur nächsten Phase

Pipeline-Tools: Jenkins, Bamboo, TravisCIBuild-Tools: Maven, Gradle

Page 13: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 13 ]

Phasen der Pipeline

Commit

- Kompilieren- Unit-Tests- Code-Analyse- Artefakt erstellen

Akzeptanztests Kapazitätstests Explorative Tests Produktion

- Testumgebung erstellen- Deployment- Akzeptanztests ausführen

- Testumgebung erstellen- Deployment- Kapazitätstests ausführen

- Testumgebung erstellen- Deployment- manuelle Tests ausführen

- Umgebung erstellen- Deployment- Release-Pattern anwenden

Page 14: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 14 ]

Commit Capacity

Commit Stage

Page 15: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 15 ]Commit Capacity Explorative ProductionAcceptance

Commit Stage

Tasks der Commit Stage: • Kompilieren • Tests ausführen (z.B. Unittests) • Codeanalyse (z.B. Testabdeckung, Komplexität, ...) • Artefakt erstellen (WAR, EAR)

Page 16: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 16 ]

Artefakte managen

Commit

binaries +metadata

VCS

Entwickler

Artefakt Repository

Akzeptanztests Kapazitätstests Explorative Tests Produktion

Commit Capacity Explorative ProductionAcceptance

Page 17: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 17 ]

Acceptance CapacityCommit

Akzeptanztests

Page 18: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 18 ]

Akzeptanztests

• Überprüfung auf abstrakterer Ebene • Tests unabhängig von konkreten Implementierungen • Anwendung wird als ganzes getestet, keine einzelnen Einheiten • Tests prüfen, ob die Akzeptanzkriterien

der Stories/Requirements erfüllt sind • Basis zur Abnahme durch den Kunden

Acceptance CapacityCommit Explorative Production

Page 19: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 19 ]

Akzeptanztests erstellen

Acceptance CapacityCommit Explorative Production

Akzeptanzkriterien

„Gegeben“ ...„Wenn“ ...„Dann“...

Test-Implementierungsschicht

- Keine Abhängigkeiten zur GUI- Verwendung von DSL

Application Driver Layer

Kommuniziert mit der Anwendung über APIoder über GUI

• Textuelle Beschreibung der Tests (auch für Kunden lesbar)

• Behavior Driven Development (BDD) • Nur die »Application Driver Layer«

kennt die konkrete Implementierung der Applikation

Tools: JBehave, Cucumber

Page 20: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 20 ]

Akzeptanztests – Beispiel

Szenario: Kunde registriert sich erfolgreich

Gegeben ein neuer Kunde mit

E-Mail [email protected]

Vorname Eberhard Name Wolff

Wenn der Kunde sich registriert

Dann sollte ein Kunde mit

der E-Mail [email protected] existieren

Und es sollte kein Fehler gemeldet werden

1

2

3

4

5

6

7

8

Acceptance CapacityCommit Explorative Production

Page 21: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 21 ]

Akzeptanztests – Beispiel

//Implementierung von »Gegeben«

@Given(»ein neuer Kunde mit E-Mail $email Vorname $vorname Name $name«)

public void gegebenKunde(String email, String vorname, String name){

kunde = new User(vorname, name, email);

}

1

2

3

4

5

Acceptance CapacityCommit Explorative Production

Page 22: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 22 ]

CapacityAcceptance Explorative

Kapazitätstests

Page 23: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 23 ]

Kapazitätstests

• Performance der Applikation testen • Mit verschiedenen Akzeptanztests realistische Auslastung

erzeugen • Tests über GUI: anfällig, entsprechen dem Vorgehen der Nutzer • Tests über API: stabiler, entsprechen nicht dem Nutzervorgehen

Vorteil der Kapazitätstests: • Veränderungen der Performance sind direkt

auf Codeänderungen rückführbar

CapacityCommit Explorative ProductionAcceptance

Page 24: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 24 ]

Kapazitätstests

Schwierigkeiten: • Produktionsumgebung realistisch nachbauen

(Abhängigkeiten, Hardware, Datenbanken, ...) • Passenden Schwellwert für Erfolg/Misserfolg

der Tests definieren (nicht zu aggressiv, nicht zu schwach)

CapacityCommit Explorative ProductionAcceptance

Page 25: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 25 ]

ExplorativeCapacity Production

Explorative Tests

Page 26: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 26 ]

Explorative Tests

• Manuelle Tester mit fachlichem Wissen testen mögliche Schwachstellen

• Bedienbarkeit und Design nur manuell testbar • Gefundene Fehler in Zukunft durch schnelle automatische Tests

überprüfen lassen • Tests sind teuer und zeitintensiv

ExplorativeCommit ProductionAcceptance Capacity

Page 27: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 27 ]

ProductionExplorative

Produktion

Page 28: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 28 ]ProductionCommit Acceptance Capacity Explorative

Rollout, Rollback, Roll Forward

Production

Production

1.02.0

Production

2.0 1.0

Rollout

Rollback Roll Forward

Page 29: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 29 ]ProductionCommit Acceptance Capacity Explorative

Green Blue

Router

Server Server

DB

Server Server

DB

User

Blue-Green-Deployment

• 2 identische Produktions-umgebungen

• Nur eine Umgebung ist live

• Wechsel der Umgebungen durch den Router

Page 30: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 30 ]

Lösungsansätze für das Handling von Datenbanken

Synchronisation: • Synchronisation der Datenbanken beim Wechsel der Umgebung

oder Entkopplung: • Datenbank-Release unabhängig vom App-Release • Versionierung der Datenbank hierfür notwendig

ProductionCommit Acceptance Capacity Explorative

Blue-Green-Deployment

Page 31: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 31 ]ProductionCommit Acceptance Capacity Explorative

Canary Releasing

• Neues Feature nach und nach für alle Nutzer ausrollen (z.B. zuerst nur für Poweruser oder Mitarbeiter)

• Bei Fehlern nur kleiner Nutzerkreis betroffen • Produktionsumgebung somit auch für realistische Tests nutzbar

Page 32: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 32 ]ProductionCommit Acceptance Capacity Explorative

Canary Releasing

Server-Gruppe Server-Gruppe

Router/Load Balancer

Server-Gruppe

1. Stufe Mitarbeiter

2. Stufe ausgewählter Nutzerkreis

3. Stufe restliche Nutzer

neues Release

BenutzerMitarbeiter

Page 33: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 33 ]ProductionCommit Acceptance Capacity Explorative

Feature Toggle

• Neues Feature wird deaktiviert in Produktion deployt • Aktivierung des Features ohne neu zu deployen • Verwaltung aller Toggles durch eigenen Service

oder Konfigurationsdatei

Kombination mit Canary Releasing sinnvoll

Page 34: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 34 ]ProductionCommit Acceptance Capacity Explorative

Dark-Launch

• baut auf den Feature Toggles auf • Feature wird aktiviert, aber ist nicht für Nutzer über die GUI sichtbar

• Dark-Launches werden für realistische Tests verwendet (z.B. neue Suchalgorithmen auf Performance testen)

Kombination mit Canary Releasing sinnvoll

Page 35: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 35 ]ProductionCommit Acceptance Capacity Explorative

Dark-Launch – Beispiel

Beispiel: Facebook-Chat

Bildquelle:https://www.gcflearnfree.org/facebook101/chat-and- messages/1/ [06.06.18]

Page 36: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 36 ]

Fazit

Page 37: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 37 ]

Vielen Dank

Page 38: Florian Tobusch – Sommersemester 2018 | Aktuelle Technologien … · 2018. 6. 19. · facebook101/chat-and- messages/1/ [06.06.18] [ Folie 36 ] Fazit [ Folie 37 ] Vielen Dank [

[ Folie 38 ]

Literatur

Gene Kim, Jez Humble, Patrick Debois, John Willis (1. Auflage, 2017). Das DevOps Handbuch. Heidelberg: O’Reilly.

Jez Humble, David Farley (2011). Continuous Delivery. Boston: Pearson Education.

Eberhard Wolff (2. Auflage, 2016). Continuous Delivery – Der pragmatische Einstieg. Heidelberg: dpunkt.Verlag.