sacha chua :: living an awesome life

2069 blog subscribers
2745 on Twitter
Subscribe!
E-mail Feed reader

Deploying Drupal updates onto a live site

Our configuration management discipline paid off last week, when we rolled out lots of bugfixes onto our production server. I used my deployment script to test the release-1 branch against our regression tests and copy the source code to the production server after it passed. A quick database update later, and everything worked without a hitch.

Why did it work? Here’s what’s behind our build system:

  • We have a branch for release-1 bugfixes and a trunk branch for new features. It’s easier than cherrypicking features to push to production.
  • Module .install files handle all behavior-related changes (variables, new modules, etc.). Drupal can automatically apply those changes during the database upgrade process. Even the process of enabling a module is done through an update function in our main module’s .install file. Note that the module install files are called in alphabetic order, so you may need to think about the sequence of functions.
  • The Simpletest framework for unit and functional testing allows us to write regression tests that minimize risks of updates.
  • Updates and tests are always run after a stripped-down copy of the production database is loaded, and are also occasionally tested against a full copy of the production database. This makes sure that the changes will cleanly apply to the production server. Domain Access complicates things a little because the domain name is encoded in the database, so my deployment script also takes care of substituting the correct domain name.
  • To automate testing and upgrades, we use the Drupal Shell (drush) module in our local and QA environments.
  • I wrote a deployment script webpage that provides a form for managing database changes and source code deployments to our QA server and to our production server.

I think it’s pretty darn good. What would make it even awesomer?

  • An updated deployment plan. I’m going to work on this document later.
  • Testing before commits, instead of after. maybe I can set up a pre-hook on my own system, or use Emacs to do this somehow.
  • Buttons to get full copy of database for local, QA. Full copies of the database take much more time, but are useful for getting a realistic feel for the functionality.
  • An article on how other people can get up and running with this kind of thing. DeveloperWorks, maybe?
So-soHmmGoodGreatAwesome! (No Ratings Yet)
Loading ... Loading ...
Save to - del.icio.us - Digg it - reddit - StumbleUpon -

3 Responses to “Deploying Drupal updates onto a live site”

  1. Article! Article! There is an awful lot there for people to learn from, especially the Drush and testing parts.

  2. I second the motion. :) I’d really like to see details on the Domain Access chunk of the script. At the moment I’ve resorted to hard-coding my domains into /etc/hosts when I want to work locally. It’s not a pretty sight.

  3. Katherine: Use at least two, maybe three different domains, like local.whatever.com, qa.whatever.com, and whatever.com. Leave local.whatever.com defined in your /etc/hosts file, and then define a wildcard DNS entry for whatever.com. Set up multisites – sites/local.whatever.com and so on – and then configure $cookie_domain and other domain-specific variables in the appropriate settings.php

    The Domain Access module is optional. If you’re using it because you’re also doing domain-based editing control and shared content across domains, you’ll need to do a search-and-replace of the domain on the database dump before you load it into your database server. Also, it helps to override the domain_root variable in your settings.php.

Discussion Area - Leave a Comment

Please comment as you, not your organization.





On This Day...

  • 2009: Drupal workflow for small projects — One of the recent hires dropped by with a few questions about Drupal development in small projects. She wanted to [...]
  • 2008: — Update build and deployment plan Refine alert behavior for Drupal site Participate in IBM’s Innovation Jam Paperwork: expenses, time, overtime Write about lesson 2 [...]
  • 2007: Took the IELTS — Canada’s skilled worker point system includes points for language proficiency, which can be proved either through a letter or through a standardized [...]
  • 2006: Check out Hack Night! — In Toronto from Oct 16 to 19? Come to Hack Night on Oct 17 (Tuesday)! It’ll be fun. Free pizza, [...]
  • 2006: Minutes from meeting on Thursday — Attendance: Dave Kemp, Sacha Chua From 2:10 to 2:30 or so Apologies for miscommunication: Sacha had written down the meeting for 1:00 [...]
  • 2005: Tips for time management — Jessie and I also talked about the challenges of balancing the demands of research, studies, teaching, and life. She wanted to [...]
  • 2005: Tips for talking to other people — I met Jessie at the Graduate Students Initiative lunch yesterday. She’s a first-year grad student taking up a master’s degree in chemical [...]
  • 2005: Research blog — Yes, yes, yet another blog. http://blogs.imedia.mie.utoronto.ca/sacha/research/ will store my research notes. Really. Promise. Well, at least my research notes will stay there for [...]
  • 2005: More about looking for geek role models — Michael Olson wrote: I hope Google does a better job with your tech talk than they did at Purdue. A few [...]
  • 2005: Geek girl T-shirts — The two women from HR wore Google Women’s Tees. From the website: “We originally designed this shirt for our efforts in [...]
  • 2005: Google recruitment talk: Impressions — Google is, of course, t3h k3wl. In fact, working at Google is probably cooler than studying at MIT, in terms of [...]
  • 2005: Google: Organizing the World’s Information… and Loving It! — The Google recruitment talk was given by John Abd-El-Malek (jam@google.com, abdelMAHLik). Other engineers were also around for the question and answer: Amit [...]
  • 2003: Deadline for Submission of Final Marks for the First Semester, SY — 2003-2004 will be on: October 22, 2003, Wednesday (for GRADE SHEETS SUBMISSION) *October 26, 2003,Sunday (for ON-LINE SUBMISSION ).
  • 2003: More PersonalityQuizzes — 1. When do you feel your best? c. Late at night 2. You usually walk… b. Fairly fast, with little steps 3. When talking [...]
  • 2003: More thoughts on my course — Sacha wrote: > I'm somewhat hesitant about taking my master's degree in Ateneo > because I want to learn more about different [...]
  • 2003: Interesting uses of Emacspeak — CSJ wrote on the debian-user mailing list: For helping teach my kid to read I used emacs running emacspeak. The robotic language, [...]
  • 2003: USB Bluetooth dongle that should work with Linux — http://www.the-gadgeteer.com/mitsumi-usb-bluetooth-review.html