Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Deploy With Certainty

238 views

Published on


In a monolithic application, different services are developed within same project side by side.
In these kind of applications you don't need to worry about breaking the compatibility between contract interfaces since there is an invisible verifier called compiler that checks that all method calls follows the defined signature.
But in case of microservices, different services are deployed in different runtimes and using different separated networks.
In this scenario, any change on the contract of one service cannot be caught by the compiler since there is no typesafe connection between services..
Now breaking the compatibility between services can be really easy and hard to detect (maybe until your new version of the service is on production).

In this talk we are going to explore why deploying a new version of a service might break everything in microservices architecture, and how to fix with consumer-driven contracts pattern.

Video recording: https://2017.javazone.no/program/87956decfb9c467ab4f3bef24cee5064

Published in: Technology
  • Be the first to comment

Deploy With Certainty

  1. 1. Deploy microservices with Certainty Alex Soto
 @alexsotob
  2. 2. @alexsotob2 Alex Soto Red Hat Engineer www.lordofthejars.com @alexsotob Who Am I?
  3. 3. @alexsotob3 Questions
  4. 4. @alexsotob4 Any resemblance to reality is pure coincidence
  5. 5. @alexsotob5 Villains Database Application
  6. 6. @alexsotob5 Villains Database Application
  7. 7. @alexsotob5 Villains Database Application Villains
  8. 8. @alexsotob5 Villains Database Application Villains Crimes
  9. 9. @alexsotob5 Villains Database Application Villains Crimes Give Me Information of Gru
  10. 10. @alexsotob5 Villains Database Application Villains Crimes Give Me Crimes of GruGive Me Information of Gru
  11. 11. @alexsotob5 Villains Database Application Villains Crimes Give Me Crimes of GruGive Me Information of Gru
  12. 12. @alexsotob5 Villains Database Application Villains Crimes Give Me Crimes of GruGive Me Information of Gru
  13. 13. @alexsotob6 Villains Database Application
  14. 14. @alexsotob6 Villains Database Application
  15. 15. @alexsotob6 Villains Database Application Consumer
  16. 16. @alexsotob6 Villains Database Application Consumer Producer
  17. 17. @alexsotob6 Villains Database Application Consumer Producer
  18. 18. @alexsotob6 Villains Database Application Consumer Producer GET /villains/Gru
  19. 19. @alexsotob6 Villains Database Application Consumer Producer GET /crimes/GruGET /villains/Gru
  20. 20. @alexsotob6 Villains Database Application Consumer Producer GET /crimes/Gru [{ "name": "Moon", "villain": "Gru", "wiki": "/wiki/Moon" }] GET /villains/Gru
  21. 21. @alexsotob6 Villains Database Application Consumer Producer GET /crimes/Gru [{ "name": "Moon", "villain": "Gru", "wiki": "/wiki/Moon" }] GET /villains/Gru "name": “Gru”, "areaOfInfluence": "World" "crimes": [{ "name": "Moon", "wiki": "/wiki/Moon" }]
  22. 22. @alexsotob7 Destroying Production Deployment
  23. 23. @alexsotob8
  24. 24. @alexsotob9 Unit Tests and Mock
  25. 25. @alexsotob Advantages Disadvantages Unit Tests (and Mocks) 10
  26. 26. @alexsotob Advantages Disadvantages Unit Tests (and Mocks) 10 Cheap No setup of environment
  27. 27. @alexsotob Advantages Disadvantages Unit Tests (and Mocks) 10 Cheap No setup of environment Fast Mocks
  28. 28. @alexsotob Advantages Disadvantages Unit Tests (and Mocks) 10 Cheap No setup of environment Fast Mocks Reliable All local, no flaky
  29. 29. @alexsotob Advantages Disadvantages Unit Tests (and Mocks) 10 Cheap No setup of environment Fast Mocks Reliable All local, no flaky Targeted You know where it failed
  30. 30. @alexsotob Advantages Disadvantages Unit Tests (and Mocks) 10 Cheap No setup of environment Fast Mocks Reliable All local, no flaky Not Trustworthy How you understand the system Targeted You know where it failed
  31. 31. @alexsotob11 Integration Tests
  32. 32. @alexsotob Advantages Disadvantages Integration Tests 12
  33. 33. @alexsotob Advantages Disadvantages Integration Tests 12 Trustworthy They are real
  34. 34. @alexsotob Advantages Disadvantages Integration Tests 12 Trustworthy They are real Slow Boot service and dependencies
  35. 35. @alexsotob Advantages Disadvantages Integration Tests 12 Trustworthy They are real Not Reliable May fail for any external reason Slow Boot service and dependencies
  36. 36. @alexsotob Advantages Disadvantages Integration Tests 12 Trustworthy They are real Not Reliable May fail for any external reason Slow Boot service and dependencies Become e2e You easily end up with e2e tests
  37. 37. @alexsotob13 Manual Tests
  38. 38. @alexsotob14 Contract Tests
  39. 39. @alexsotob15 Ownership of the Contracts
  40. 40. @alexsotob Ownership Different Approaches 16
  41. 41. @alexsotob > Provider Contracts provider centric, consumers adapts all or nothing Ownership Different Approaches 16
  42. 42. @alexsotob > Provider Contracts provider centric, consumers adapts all or nothing > Consumer Contracts individual consumer’s needs Ownership Different Approaches 16
  43. 43. @alexsotob > Provider Contracts provider centric, consumers adapts all or nothing > Consumer Contracts individual consumer’s needs > Consumer-driven Contracts representation of a provider's obligations to all its consumers Ownership Different Approaches 16
  44. 44. @alexsotob17 Consumer Side Consumer Test
  45. 45. @alexsotob17 Consumer Side Stub Server Consumer Test Expectations
  46. 46. @alexsotob17 Consumer Side Stub Server Consumer Test Expectations
  47. 47. @alexsotob17 Consumer Side Stub Server Consumer Test Expectations GET /crimes/Gru
  48. 48. @alexsotob17 Consumer Side Stub Server Consumer Test Expectations GET /crimes/Gru [{"name":...]}
  49. 49. @alexsotob17 Consumer Side Stub Server Consumer Test Expectations GET /crimes/Gru [{"name":...]}
  50. 50. @alexsotob17 Consumer Side Stub Server Consumer Test Expectations GET /crimes/Gru [{"name":...]} Sharing
  51. 51. Provider Side Sharing Provider
  52. 52. Provider Side Sharing Test Provider
  53. 53. Provider Side Sharing Test Provider
  54. 54. Provider Side Sharing Test Provider GET /crimes/Gru [{"name":...]}
  55. 55. Provider Side Sharing Test Provider GET /crimes/Gru [{"name":...]}
  56. 56. Provider Side Sharing Test Provider GET /crimes/Gru [{"name":...]}
  57. 57. @alexsotob19 Contract Tests Testing Frameworks Consumer Driven Contracts
  58. 58. @alexsotob20
  59. 59. @alexsotob20 > Pact Foundation Pact specification v3
  60. 60. @alexsotob20 > Pact Foundation Pact specification v3 > Integration with several languages JVM, Ruby, Python, Go, .Net, Swift, JS
  61. 61. @alexsotob20 > Pact Foundation Pact specification v3 > Integration with several languages JVM, Ruby, Python, Go, .Net, Swift, JS > Pact Broker Sharing contracts, API documentation, Overview of services
  62. 62. @alexsotob20 > Pact Foundation Pact specification v3 > Integration with several languages JVM, Ruby, Python, Go, .Net, Swift, JS > Pact Broker Sharing contracts, API documentation, Overview of services > Arquillian Algeron Arquillian ecosystem + Pact, Publishers/Retrievers, JBoss Forge
  63. 63. @alexsotob21 Building With Certainty
  64. 64. @alexsotob22 Deploy with Certainty
  65. 65. @alexsotob Deploying Consumer Steps on CI (Commit Stage) 23
  66. 66. @alexsotob > Execute Build Publish contracts as artefact version Deploying Consumer Steps on CI (Commit Stage) 23
  67. 67. @alexsotob > Execute Build Publish contracts as artefact version > Run Head Provider Contract Tests Check contract compatibility against version contract Deploying Consumer Steps on CI (Commit Stage) 23
  68. 68. @alexsotob > Execute Build Publish contracts as artefact version > Run Head Provider Contract Tests Check contract compatibility against version contract > Run Prod Provider Contract Tests Check contract compatibility against version contract Deploying Consumer Steps on CI (Commit Stage) 23
  69. 69. @alexsotob > Execute Build Publish contracts as artefact version > Run Head Provider Contract Tests Check contract compatibility against version contract > Run Prod Provider Contract Tests Check contract compatibility against version contract > Release Consumer Tag contract with environment name Deploying Consumer Steps on CI (Commit Stage) 23
  70. 70. @alexsotob Deploying Provider Steps on CI (Commit Stage) 24
  71. 71. @alexsotob > Execute Build Run as usual Deploying Provider Steps on CI (Commit Stage) 24
  72. 72. @alexsotob > Execute Build Run as usual > Run Provider Contract Tests Check contract compatibility against latest contract Deploying Provider Steps on CI (Commit Stage) 24
  73. 73. @alexsotob > Execute Build Run as usual > Run Provider Contract Tests Check contract compatibility against latest contract > Run Prod Provider Contract Tests Check contract compatibility against environment contract Deploying Provider Steps on CI (Commit Stage) 24
  74. 74. @alexsotob > Execute Build Run as usual > Run Provider Contract Tests Check contract compatibility against latest contract > Run Prod Provider Contract Tests Check contract compatibility against environment contract > Release Provider Deploying Provider Steps on CI (Commit Stage) 24
  75. 75. @alexsotob25 Automate Everything Enjoy your Vacations
  76. 76. @alexsotob26 Let’s Wind Down
  77. 77. @alexsotob Conclusions 27
  78. 78. @alexsotob Conclusions 27 > End To End Tests Late feedback Expensive change Difficult to orchestrate
  79. 79. @alexsotob Conclusions 27 > End To End Tests Late feedback Expensive change Difficult to orchestrate > Consumer Driven Contracts Fail fast Independent deployments Improve communication
  80. 80. More Info https://github.com/arquillian-testing-microservices/ https://www.manning.com/books/testing-java-microservices @alexsotob

×