Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Brownfields DevOps in Practice

Brownfields DevOps in Practice

Brownfields DevOps in Practice slide deck from the Toronto Enterprise DevOps Meetup

Damian Brady

March 09, 2017
Tweet

More Decks by Damian Brady

Other Decks in Programming

Transcript

  1. @damovisa TWO ENDS OF THE SPECTRUM Startup Established Move fast,

    break stuff File | New Project Money to invest Get features out faster
  2. @damovisa ESTABLISH A BASELINE • How do you work? •

    How do you build? • How do you deploy? • How do you measure?
  3. @damovisa ISOLATE VARIATIONS public decimal GetWithSalesTax(decimal amount) { // Australia

    //return amount * 1.1; // New Zealand //return amount * 1.15; // UK return amount * 1.2; }
  4. @damovisa ISOLATE VARIATIONS public decimal GetWithSalesTax(decimal amount) { switch (this.Country)

    { case Australia: return amount * 1.1; case New Zealand: return amount * 1.15; case UK: return amount * 1.2; } }
  5. @damovisa ISOLATE VARIATIONS public class UkSalesTaxCalculator : ISalesTaxCalculator { public

    decimal GetWithSalesTax(decimal amount) { return amount * 1.2; } }
  6. @damovisa ONE CODEBASE • Set configuration at deployment time •

    Read configuration at runtime • Choose an implementation at runtime <appSettings> <add key="Country" value="UK" /> </appSettings> <appSettings> <add key="Database" value="TestDB" /> </appSettings>
  7. @damovisa BUILD ONCE, DEPLOY MANY • The same bits everywhere

    • The same deployment process everywhere
  8. @damovisa VERSIONING • Semver if you can… • Every build

    has a unique version • Newer code has a higher version • 1.0.0 à 1.0.1 • 20170120.1423 à 20170121.823
  9. @damovisa GET TO A GOOD STATE • One codebase •

    Isolate variations • Externalize configuration • Build once, deploy many • Versioning • Measure Breaking up your code Ultimately into microservices
  10. @damovisa STATELESS DEPLOYMENTS App Version 1 App Version 1 Version

    2 changes Version 3 changes App Version 2 App Version 3
  11. @damovisa DATABASES • Migration scripts • DbUp • EF Migrations

    • Readyroll • Compare and apply • SqlCompare
  12. @damovisa TRANSITIONAL DEPLOYMENTS Id Name DateOfBirth 1 Lucy Oct 19

    1976 2 Peter 24 January 1984 3 Richard Dec 10th, 1965 Id Name DateOfBirth DoB 1 Lucy Oct 19 1976 1976-10-19 2 Peter 24 January 1984 1981-01-24 3 Richard Dec 10th, 1965 1965-12-10 4 Beth Jan 5 1971 1971-01-05 Id Name DoB 1 Lucy 1976-10-19 2 Peter 1984-01-24 3 Richard 1965-12-10 4 Beth 1971-01-05 v1 v2 v3 Id Name DateOfBirth DoB 1 Lucy Oct 19 1976 1976-10-19 2 Peter 24 January 1984 1984-01-24 3 Richard Dec 10th, 1965 1965-12-10
  13. @damovisa DEPLOY WITHOUT DRAMA • Stateless deployments • Migration scripts

    • Transitional deployments • Database compatibility one version back
  14. @damovisa BUILD A PIPELINE BUILD Does it merge? Does it

    compile? TEST Do our tests pass? PRODUCTION Hooray! DEPLOY + TEST Do the tests still pass? Does the UI work? Can we talk to our DB? Did our deployment work?
  15. @damovisa BUILD A PIPELINE • Stop the bad stuff getting

    to production • “Prove this release candidate sucks” • A failure in pre-production is a win • Red-green-refactor your process
  16. @damovisa FEATURE FLAGS • Wrap changes in flags • Configure

    externally • Deploy it turned off • Test in production! • Separate “Launch” from ”Deploy”
  17. @damovisa BROWNFIELDS DEVOPS Why bother? Culture shift Establish a baseline

    Get to a good state Deploy without drama Improve cycle time