Keep Drupal Running                          With Continuous                            Integration                       ...
“Why can’t we edit                        our settings directly                         on the production                 ...
Why We Don’t Just                        Develop On Production Servers                        Visitors dislike broken thin...
Hacking On Live Websites                              Is Awesome                         Focus                          On...
It’s So Awesome, We Maintain                        Dozens of Control Panels For ItSaturday, July 21, 12
Hacking On Live Websites                           Would Be Awesome                         If Only It Didn’t Cause       ...
“What’s the next best                         thing?”Saturday, July 21, 12
What we actually do                        Make copies of the site and develop with them                          Copy the...
The Problem                        Integration                        (The art of resolving                          incon...
Integration                        1. Everyone works on a copy.                        2. Announce a “freeze”.            ...
Continuous                            Integration                        Do this several times a day.Saturday, July 21, 12
The Story of CI                        1. Go to main branch & check out working code.                        2. Build a pa...
Integration                        1. Everyone works on a copy.                        2. Announce a “freeze”.            ...
Use version control                        Put everything in there.                        But don’t use too much version ...
Make the main branch                        available to everyone                        A friendly tarball is nice       ...
Every Commit Must Pass                              Integration Tests                        These are not run on your dev...
Run Integration Tests on                             A Clone of Production                        Same hardware.          ...
Automate Deployment                        You’ll be deploying a lot                        Consistency is vital          ...
Automate Testing                        You’ll be testing a lot                        Every bit you do will help.        ...
“CI” ≠ “Jenkins”                        But Jenkins can help                          (Or CruiseControl, Travis CI, Buildb...
Commit Very Often                        Standard: Everyone commits once per day                        Or more           ...
Builds Must Be Fast                        Seconds = superb                        Five to Ten Minutes = fine              ...
OMG My Builds Take Three Days                         Consider a deployment pipeline                           Stage 1: mi...
Display the Results to Everyone                          Status review during scrum meetings                          Usab...
Lava Lamps               http://www.pragmaticautomation.com/cgi-bin/pragauto.cgi/Monitor/Devices/                         ...
Rubber Chicken                    http://jamesshore.com/Blog/Continuous-Integration-on-a-Dollar-a-Day.htmlSaturday, July 2...
BLAME-SEEKING                                    ENGINE OF DOOM                   http://www.papercut.com/blog/chris/2011/...
You’re Gonna Love                        Continuous Integration                        Reduced Risk                       ...
Credits                        The Acquia Cloud team                        Martin Fowler                        “Continuo...
Upcoming SlideShare
Loading in …5
×

Keep Drupal Running With Continuous integration

5,151 views

Published on

Keeping a software project running is a difficult art. It's fine at first, when the site is in beta and you're happily flipping switches on Drupal's control panels. But soon the site goes live, and downtime costs both money and goodwill, and MySQL fills up with customer data that must not be lost or corrupted, and the code develops multiple branches that are developed and tested on multiple machines, and are edited by programmers who must avoid stepping on each other's work.

This is an introduction to the principles of Continuous Integration (CI), a popular strategy for software projects that attempts to minimize the risk, uncertainty, and effort of releasing new code. We'll discuss:

- Why managing a production site is so much more irritating than building a beta site from scratch, and how CI can ease the pain.

- The central goal of CI: That every project should have a single main branch that is always ready to deploy, passing all tests, and synced with each developer's work.

- Typical strategies for achieving this goal – dedicated integration servers; routine testing of each patch at several stages; frequent commits by all stakeholders; rapid, automated testing and deployment; testing on clones of the production stack – with notes on how these may apply to Drupal sites.

This is a beginner to intermediate session, requiring no coding experience, though a familiarity with the dynamics of software maintenance will help to inspire you.

Mike Booth, is a former devops engineer and the original release manager for Acquia Cloud Drupal hosting, and as such has had a meaningful relationship with Continuous Integration. Though his cardiologist cannot confirm it, Mike believes that CI may have saved his life. War stories will be told as time permits.

Published in: Technology

Keep Drupal Running With Continuous integration

  1. 1. Keep Drupal Running With Continuous Integration Mike Booth NYC Camp 2012Saturday, July 21, 12
  2. 2. “Why can’t we edit our settings directly on the production server?”Saturday, July 21, 12
  3. 3. Why We Don’t Just Develop On Production Servers Visitors dislike broken things Hard downtime Data corruption Rollbacks are slow & they lose new data No audit trail Hard to document changes Hard to discuss changesSaturday, July 21, 12
  4. 4. Hacking On Live Websites Is Awesome Focus One place to go One set of knobs to turn Short Cycle Time Everyone looks for bugs Bugs triage themselves Applause arrives in real timeSaturday, July 21, 12
  5. 5. It’s So Awesome, We Maintain Dozens of Control Panels For ItSaturday, July 21, 12
  6. 6. Hacking On Live Websites Would Be Awesome If Only It Didn’t Cause Expensive DisastersSaturday, July 21, 12
  7. 7. “What’s the next best thing?”Saturday, July 21, 12
  8. 8. What we actually do Make copies of the site and develop with them Copy the code Copy or simulate DB and files Run on a separate dev serverSaturday, July 21, 12
  9. 9. The Problem Integration (The art of resolving inconsistencies.)Saturday, July 21, 12
  10. 10. Integration 1. Everyone works on a copy. 2. Announce a “freeze”. 3. Collect copies and mix together. 4. Test, find bugs, point fingers, fix bugs. 5. Iterate Step 4 until confident. 6. Cross fingers. Upload result to production. 7. Fix more bugs, urgently. 8. Go to Step 1.Saturday, July 21, 12
  11. 11. Continuous Integration Do this several times a day.Saturday, July 21, 12
  12. 12. The Story of CI 1. Go to main branch & check out working code. 2. Build a patch that passes all tests. 3. Update from main branch, make tests pass. 4. Commit to main branch ASAP. 5. Make tests pass on an integration machine. 6. [Optionally, release to production: see Continuous Deployment] 7. Go to Step 1.Saturday, July 21, 12
  13. 13. Integration 1. Everyone works on a copy. 2. Announce a “freeze”. 3. Collect copies and mix together. 4. Test, find bugs, point fingers, fix bugs. 5. Iterate Step 4 until confident. 6. Cross fingers. Upload result to production. 7. Fix more bugs, urgently. 8. Go to Step 1.Saturday, July 21, 12
  14. 14. Use version control Put everything in there. But don’t use too much version control: Private branches are okay There should be one main branch It should live at a canonical source Other branches should have brief livesSaturday, July 21, 12
  15. 15. Make the main branch available to everyone A friendly tarball is nice Github can help you A running server is nicer Update this on every commitSaturday, July 21, 12
  16. 16. Every Commit Must Pass Integration Tests These are not run on your dev machine Although those should’ve passed too Run separate integration-testing machines Your commit is not finished until the main branch passes these testsSaturday, July 21, 12
  17. 17. Run Integration Tests on A Clone of Production Same hardware. Same OS and software stack. Same versions of everything. Database as similar to production as possible. Scrubbed production DB Script-generated test data Virtualization is your friend.Saturday, July 21, 12
  18. 18. Automate Deployment You’ll be deploying a lot Consistency is vital Automate every layer: OS and web stack (e.g. Puppet) Code deployment (e.g. Capistrano) DB updates (Drupal update functions) Acquia Cloud, Pantheon, etc. can help youSaturday, July 21, 12
  19. 19. Automate Testing You’ll be testing a lot Every bit you do will help. Smoke tests Browser-simulation (e.g. Selenium) Test the showstoppers Test things which broke once beforeSaturday, July 21, 12
  20. 20. “CI” ≠ “Jenkins” But Jenkins can help (Or CruiseControl, Travis CI, Buildbot, etc.) “Continuous Integration is an attitude, not a tool” - James ShoreSaturday, July 21, 12
  21. 21. Commit Very Often Standard: Everyone commits once per day Or more Practice doing work in smaller piecesSaturday, July 21, 12
  22. 22. Builds Must Be Fast Seconds = superb Five to Ten Minutes = fine An hour = awful Many hours = disastrousSaturday, July 21, 12
  23. 23. OMG My Builds Take Three Days Consider a deployment pipeline Stage 1: minimalist tests, fast Stage 2: slow Stage 3: wicked slow A commit to main branch: Must pass Stage 1 in advance Triggers Stage 2; failures must be fixed ASAPSaturday, July 21, 12
  24. 24. Display the Results to Everyone Status review during scrum meetings Usable web dashboards Control-room displaysSaturday, July 21, 12
  25. 25. Lava Lamps http://www.pragmaticautomation.com/cgi-bin/pragauto.cgi/Monitor/Devices/ BubbleBubbleBuildsInTrouble.rdocSaturday, July 21, 12
  26. 26. Rubber Chicken http://jamesshore.com/Blog/Continuous-Integration-on-a-Dollar-a-Day.htmlSaturday, July 21, 12
  27. 27. BLAME-SEEKING ENGINE OF DOOM http://www.papercut.com/blog/chris/2011/08/19/who-broke-the-build/Saturday, July 21, 12
  28. 28. You’re Gonna Love Continuous Integration Reduced Risk Process Visibility Fewer Bugs Easier Debugging Easier Rollback Less Wasted EffortSaturday, July 21, 12
  29. 29. Credits The Acquia Cloud team Martin Fowler “Continuous Integration” www.martinfowler.com/articles/continuousIntegration.htmlSaturday, July 21, 12

×