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

Continuous Deployment for Dummies

Continuous Deployment for Dummies

Ran Tavory

May 01, 2012
Tweet

More Decks by Ran Tavory

Other Decks in Programming

Transcript

  1. Continuous Deployment is... • A Lean Startup technique • Code

    written ◦ Immediately deployed • Code deployed many times a day • Continuous Integration => the next step
  2. Continuous Deployment is NOT... • ... is not Low Quality

    code ◦ Quite the contrary, very high quality • ... is not Cowboy Coding ◦ CD requires discipline. Culture is key • ... is not Time Consuming or requires massive investment up front ◦ Small initial investment ◦ Actually saves time • ... is not Just for web services ◦ although it's easier for webs
  3. PM Goal: Minimize feedback loop • Developers know REPL ◦

    Read Evaluate Print Loop • Product managers need fast feedback too ◦ CD is a step forward
  4. Dev Goal: Less process, More fun •Less waits ◦Wait for

    QA ◦Wait for end of cycle ◦Wait for code merge ◦Wait for other devs ◦Wait for... •Less context switches ◦Do one task, end it, next
  5. Ops Goal: Increase Stability •Small changes - small risks •Large

    changes - large risks •You can spill a bucket, but you can't spill a hose / Kent Beck
  6. CD in five easy steps - step 1 •Step 1:

    Continuous Integration ◦Jenkins (aka Hudson) ◦Team City ◦Build Bot ◦... Continuous deployment in 5 easy steps
  7. CD in five easy steps - step 2 •Step 2:

    Post Commit Hooks ◦svn: post-commit ◦git: post-receive ◦cvs: post-commit ◦perforce... Continuous deployment in 5 easy steps
  8. CD in five easy steps - step 3 •Step 3:

    Simple Deployment Script ◦Start simple ◦Build as you grow ▪Don't start with the almighty ◦Add Immune system as you grow Continuous deployment in 5 easy steps
  9. CD in five easy steps - step 4 •Step 4:

    Real Time Alerting ◦Nagios ◦OpenNMS ◦... Continuous deployment in 5 easy steps
  10. CD in five easy steps - step 5 •Step 5:

    Root Cause Analysis ◦Five Whys ◦Fail fast, learn fast, improve Continuous deployment in 5 easy steps
  11. Extra • Mechanics ◦ Are you crazy? No, I'm immune

    • Ingredients ◦ Culture ◦ Trunk stable ◦ Automated Tests ◦ Infrastructure Automation ◦ Deployer ◦ Servicization ◦ The Immune system ◦ Visibility ◦ 5 Ys • Workflow
  12. The Immune System • Coding ◦ Review ◦ Testing •

    Monitoring ◦ We use Nagios for the vitals ◦ Regularly check servers via instrumentation ◦ KeyNote ◦ Test Production (selenium,APT) • Instrumentation ◦ Self-Test ◦ Performance • Monitoring KPIs ◦ PVs, ◦ 3 different CTRs, ◦ clicks, revenue, RPM ◦ etc...
  13. Culture • Everyone need to care about everything! ◦ build

    ◦ tests ◦ quality ◦ production ◦ monitoring ◦ business
  14. Trunk Stable •Everyone run tests before commit •No branches, really

    •Trunk may get released any moment. If you commit now, users will see it really soon. => Test your code, really good •Use feature flags, but only if you must •Forward and backward compatibility
  15. Automated Tests •We have about 2000 test cases •They run

    in < 4 minutes •We use TeamCity •We regularly test production Desired state: No manual QA whatsoever.
  16. Infrastructure Automation "Infrastructure as code" •Using kickstart script to install

    OS and Chef agent. •All infrastructure is deployed by Chef. •All apps are deployed by Glu •All scripts, and chef cookbooks, glu configs are SVNed. •Very easy to deploy large number of machines.
  17. Servicization • At outbrain we have ~ 25 services •

    Each service is deployed at > 1 server • If there's damage, it's contained • It's easy to make small changes • If there's an error it's easy to find it • If rollback is needed it's easier • Everything is either proxies (HAProxy) or queued (AMQ) • Challenge: It's sometimes hard to find the right balance: ◦ number of services that need maintanance ◦ complexity ◦ performance ◦ api conformance
  18. The Immune System • Coding ◦ Review ◦ Testing •

    Monitoring ◦ We use Nagios for the vitals ◦ Regularly check servers via instrumentation ◦ KeyNote ◦ Test Production (selenium,APT) • Instrumentation ◦ Self-Test ◦ Performance • Monitoring KPIs ◦ PVs, ◦ 3 different CTRs, ◦ clicks, revenue, RPM ◦ etc...
  19. The Immune System • The line of defense will always

    be broken => Multiple lines of defense
  20. Fun Numbers • 5-50 production changes a day!!! • More

    then 2000 code tests running in less then 4 minutes. • More then 600 production services tests runs every 10 minutes. • It takes ~30 minutes from code complete to ~100 machines deployed.
  21. References • Why Continuous Deployment / Eric Ries • Continuous

    Deployment at outbrain / Ran Tavory • Deployment Infrastructure for Continuous Deployment / WealthFront • Continuous Deployment presentation / Eishay Smith • Quantum of Deployment / Etsy • Chrome Release Cycle / Anthony Laforge