architecting for continuous delivery
play

ARCHITECTING FOR CONTINUOUS DELIVERY Ken Mugrage ThoughtWorks - PowerPoint PPT Presentation

ARCHITECTING FOR CONTINUOUS DELIVERY Ken Mugrage ThoughtWorks Technology Advocate @kmugrage https://gocd.org/ TEAM STRUCTURE @kmugrage https://gocd.org/ CONWAYS LAW Any organization that designs a system (defined broadly) will produce


  1. ARCHITECTING FOR CONTINUOUS DELIVERY Ken Mugrage – ThoughtWorks Technology Advocate @kmugrage https://gocd.org/

  2. TEAM STRUCTURE @kmugrage https://gocd.org/

  3. CONWAY’S LAW Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure. @kmugrage https://gocd.org/

  4. YOU BUILD IT, YOU RUN IT “…It also brings them into day -to-day contact with the customer. This customer feedback loop is essential for improving the quality of the service.” @kmugrage https://gocd.org/

  5. CODE MANAGEMENT @kmugrage https://gocd.org/

  6. TRUNK BASED DEVELOPMENT @kmugrage https://martinfowler.com/bliki/FeatureBranch.html https://gocd.org/

  7. TRUNK BASED DEVELOPMENT @kmugrage https://martinfowler.com/bliki/FeatureBranch.html https://gocd.org/

  8. TRUNK BASED DEVELOPMENT @kmugrage https://martinfowler.com/bliki/FeatureBranch.html https://gocd.org/

  9. The purpose of a Continuous Delivery pipeline is to kill release candidates @kmugrage https://gocd.org/

  10. FEATURE TOGGLES function reticulateSplines(){ // current implementation lives here } @kmugrage https://martinfowler.com/articles/feature-toggles.html by Pete Hodgson https://gocd.org/

  11. FEATURE TOGGLES function reticulateSplines(){ var useNewAlgorithm = false; // useNewAlgorithm = true; // UNCOMMENT IF YOU ARE WORKING ON THE NEW SR ALGORITHM if( useNewAlgorithm ){ return enhancedSplineReticulation(); } else { return oldFashionedSplineReticulation(); } } function oldFashionedSplineReticulation(){ // current implementation lives here } function enhancedSplineReticulation(){ // TODO: implement better SR algorithm } @kmugrage https://martinfowler.com/articles/feature-toggles.html by Pete Hodgson https://gocd.org/

  12. FEATURE TOGGLES @kmugrage https://martinfowler.com/articles/feature-toggles.html by Pete Hodgson https://gocd.org/

  13. THE PIPELINE Functional Tests Deploy To Deploy To Build Stage Production Regression Tests Toggles Off Deploy To Deploy To Build Stage Production Toggles On @kmugrage https://gocd.org/

  14. BRANCH BY ABSTRACTION Client Code Client Code Old Supplier Client Code @kmugrage https://gocd.org/ https://martinfowler.com/bliki/BranchByAbstraction.html

  15. BRANCH BY ABSTRACTION Abstraction Client Code Layer Client Code Old Supplier Client Code @kmugrage https://martinfowler.com/bliki/BranchByAbstraction.html https://gocd.org/

  16. BRANCH BY ABSTRACTION Client Code Abstraction Client Code Old Supplier Layer Client Code https://martinfowler.com/bliki/BranchByAbstraction.html @kmugrage https://gocd.org/

  17. BRANCH BY ABSTRACTION Client Code Abstraction Client Code Old Supplier Layer Abstraction New Supplier Layer Client Code @kmugrage https://gocd.org/ https://martinfowler.com/bliki/BranchByAbstraction.html

  18. BRANCH BY ABSTRACTION Client Code Abstraction Client Code New Supplier Layer Client Code https://martinfowler.com/bliki/BranchByAbstraction.html @kmugrage https://gocd.org/

  19. ARCHITECTURE @kmugrage https://gocd.org/

  20. WELL VERSIONED APIS /api/users/v1 Consumer 1 • ID Consumer 2 • Name • Email Consumer 3 @kmugrage https://gocd.org/

  21. WELL VERSIONED APIS /api/users/v1 Consumer 1 • ID Consumer 2 • Name • Email Consumer 3 /api/users/v2 • ID • FirstName • LastName • Email @kmugrage https://gocd.org/

  22. WELL VERSIONED APIS /api/users/v1 • ID Consumer 1 • Name • Email /api/users/v2 • ID Consumer 2 • FirstName • LastName Consumer 3 • Email @kmugrage https://gocd.org/

  23. WELL VERSIONED APIS /api/users/v2 Consumer 1 • ID • FirstName Consumer 2 • LastName Consumer 3 • Email @kmugrage https://gocd.org/

  24. NO SHARED DATA STORE Service One Service Two DB @kmugrage https://gocd.org/

  25. NO SHARED DATA STORE Service One Service Two DB DB @kmugrage https://gocd.org/

  26. EVENT DRIVEN APPLICATIONS @kmugrage https://gocd.org/

  27. WITHOUT EVENTS User Service Quote Service Quote Service Quote Service Quote Service @kmugrage https://gocd.org/ https://martinfowler.com/articles/201701-event-driven.html

  28. EVENT NOTIFICATION User Service Quote Service Service Service Service @kmugrage https://gocd.org/ https://martinfowler.com/articles/201701-event-driven.html

  29. EVENT SOURCING • You don’t write to the data store, you create an event which writes to the store • The test: You could completely blow away the store and recreate it from the event stream • You use this model every day (I hope) @kmugrage https://gocd.org/ https://martinfowler.com/articles/201701-event-driven.html

  30. TESTING DISTRIBUTED APPS • We’re using external services • We can’t reliably test them • Flaky tests are worse than no tests @kmugrage https://gocd.org/

  31. TEST DOUBLES On Every Continuous Integration Run Client Code Test Double @kmugrage https://gocd.org/

  32. CONTRACT TESTING On Every Continuous Integration Run Client Code Test Double Occasionally Their Test Contract Test Service @kmugrage https://gocd.org/

  33. CONSUMER DRIVEN CONTRACTS • Provider runs tests which verify they won’t break consumers • Shifts responsibility to the provider • Acts as a communication method https://www.thoughtworks.com/radar/techniques/consumer-driven-contract-testing @kmugrage https://gocd.org/

  34. TESTING WEB APPS • Adding waits to tests makes them non-deterministic (flaky) • Non-deterministic tests are bad @kmugrage https://gocd.org/

  35. TESTING WEB APPS • Test specifications in markdown • Reliable browser automation • Multiple language support • Request/Response stubbing and mocking • Maintainable tests • Smart Selectors • GPL v3.0 • MIT License https://gauge.org/ https://taiko.gauge.org/ @kmugrage https://gocd.org/

  36. OBSERVABILITY In control theory, observability is a measure of how well internal states of a system can be inferred from knowledge of its external outputs. The observability and controllability of a system are mathematical duals. The concept of observability was introduced by Hungarian-American engineer Rudolf E. Kálmán for linear dynamic systems. @kmugrage https://gocd.org/

  37. DOMAIN ORIENTED OBSERVABILITY applyDiscountCode(discountCode){ this.instrumentation.applyingDiscountCode(discountCode); let discount; try { discount = this.discountService.lookupDiscount(discountCode); } catch (error) { this.instrumentation.discountCodeLookupFailed(discountCode,error); return 0; } this.instrumentation.discountCodeLookupSucceeded(discountCode); const amountDiscounted = discount.applyToCart(this); this.instrumention.discountApplied(discount,amountDiscounted); return amountDiscounted; } @kmugrage https://martinfowler.com/articles/domain-oriented-observability.html by Pete Hodgson https://gocd.org/

  38. O U R A C T U A L P I P E L I N E @kmugrage https://gocd.org/

  39. DEPLOYMENT @kmugrage https://gocd.org/

  40. EXPA N D / CON T RAC T FOR DATA BA S ES DB Version 1 DB Version 2 DB Version 2 • • • ID (not null) ID (not null) ID (not null) • • • Name (not null) Name (not null) Name (not null) • • • Email (not null) FirstName FirstName • • LastName LastName • • Email (not null) Email (not null) App Version 2 App Version 1 App Version 1 @kmugrage https://gocd.org/

  41. EXPA N D / CON T RAC T FOR DATA BA S ES select FirstName, LastName from users DB Version 2 • ID (not null) • If null select Name from users Name (not null) • Prompt user to update FirstName • Update FirstName, LastName LastName • Email (not null) select FirstName, LastName from users App Version 2 @kmugrage https://gocd.org/

  42. CANARY RELEASE @kmugrage https://gocd.org/

  43. CANARY RELEASE Release to a very small portion of our audience to “test in production”. ( Pro Tip: Test for business efficacy not just successful bits and bytes ) @kmugrage https://gocd.org/

  44. CANARY RELEASE Release to a very small portion of our audience to “test in production”. ( Pro Tip: Test for business efficacy not just successful bits and bytes ) @kmugrage https://gocd.org/

  45. CANARY RELEASE Release to a very small portion of our audience to “test in production”. ( Pro Tip: Test for business efficacy not just successful bits and bytes ) @kmugrage https://gocd.org/

  46. SUMMARY • Small, well versioned pieces are best • Small, well focused teams are best to create those • Continuous Integration is the foundation @kmugrage https://gocd.org/

  47. THANK YOU @kmugrage https://gocd.org/

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend