Automating Drupal Migrations: how to Reduce Downtime from Days to Minutes
Overview & Background
When time is money for your website, having as little downtime as possible during a major website upgrade is highly desirable.
Webdrips was tasked by Nvidia to reduce the downtime of a major Drupal 6 to 7 upgrade (migration) to one day or less from an estimated one week*. We worked with Nvidia's development team to get the downtime reduced to two minutes.
*We believe the downtime required would've been much higher, as the original developer wanted to run manual database queries where coverage was limited. These manual updates would've lead to several unexpected issues requiring resolution while the website was down.
We came up with a revised plan requiring about one business day to complete the migration and two minutes of website downtime. The revised plan also was to migrate 99.9% of the site with a script, and have the upgraded site built from scratch during the migration.
The process described is applicable to any website requiring a major version upgrade. We cover the highlights here, and you can read all about the process on our Automating Drupal Migrations blog post.
About the Drupal 6/7 Site
The following data gives you an idea of the size of the website being migrated:
- 400,000 users and form submissions
- 2,500 web pages
- 25 page types (content types)
Once the Drupal 7 site was migrated, we reduced the number of page types to six without affecting any migrated data.
The Birth of the Automated Migration Process
We believe this process had not been performed before, as we could find no prior seminars or articles on the subject.
We used the standard array of migration code provided by the Drupal community and wrote four custom modules and scripts for automating the migration and deployment. We also knew we were going to need an extremely fast server with solid-state drives to get the migration time down to one business day.
To perform the migration, we came up with a very repeatable/reliable process using an Agile approach.
During the migration, we used our very own Disable Edits module to keep the site alive but in read-only mode.
The Migration Challenges
We had to overcome a few obstacles while we iterated the update process. The primary challenge was reducing the migration time. We ran the migration on an outdated server, and estimated that migrating just the users was going to take over forty hours. By tweaking the server configuration for the database and other things, and the very fast server mentioned above, we were able to get that time down to about 3 hours.
The second major hurdle was assigning the 400,000 users to site groups based on how form questions were answered, and their password needed fixing.
Other challenges include the following:
- Images and links with absolute paths; body images requiring a HTML DOM parser
- Poor Drupal 6 architecture decisions
- Moving larger files to the cloud to improve performance
- Significantly reducing the number of page types.
The team came up with an interesting timeline once it was nearing time to launch the migration:
- -7 days to release: content freeze
- -2 days: automated rebuild, content migration, and editorial approval
- -8 hours: registration lockdown and migration start
- -2 hours: batch processing of content by editors and final tests
We were able to follow the timeline to the hour because of the repeatable reliable process we had.
Webdrips worked closely with the Nvidia team to create a reliable repeatable migration process using an iterative agile approach. Using our refined process, we were able to get the original downtime estimate of one week down to two minutes. Using adjustments to the server, code, and our scripts to make the process automated, we were able to get the migration time down from around 100 hours to about eight.
All of the above lead to an entire Drupal 7 website to be built from scratch automatically, and 99.9% of the data migrated using a script that ran overnight (while we slept), so we were able to use two minutes of downtime in the morning to swap the Drupal 6 and 7 sites.
Given that the website averages nearly 3 million visitors per month, Nvidia was very pleased to have nearly zero downtime.