Migrating an existing Drupal6 site to Mercury

Mercury

Introduction

Mercury is a very fast hosting solution for hosting Drupal sites.
The following quote from http://getpantheon.com/mercury/what-is-mercury describes it perfectly.

Mercury is a drop-in replacement for your Drupal website hosting service that  
delivers break-through performance. Mercury can serve two-hundred times more  
pages per second and generate pages three times faster than standard hosting  
services.  
How is this possible?  
By standing on the shoulders of giants.  
We've integrated, borrowed, tuned and tweaked the fastest open-source hosting  
technologies available so that they can at last work perfectly with Drupal at  
the click of a button.  
You can read all of the technical details here.  
The tools and techniques available in Mercury have been around for some time,  
but were expensive and tricky to integrate with Drupal in the past.  
Now, finally, they are available for everyone.  

The following is a post on how I migrate my sites from a standard Drupal6 hosting server to a Mercury based hosting server.
We manage all our sites in GIT. You can read more about how we are doing it in another post - drupal-git-workflow-pt1
One thing to mention here is that when we build a new Mercury server there is only 3 modules placed into sites/all/modules
cacherouter memcache varnish. The rest are kept as part of a sites individual repository.
This allows a site to be able to easily migrated between a Mercury and non-Mercury server.

HOWTO

  • Clone the site's repository into the sites/ folder:
git clone gitosis@gitserver:example.com.au.git
  • Initialize submodules:
git submodule init
  • Update submodules:
git submodule update
  • Place existing site offline (on Drupal6 server) to stop any new changes to database happening (use drush)
  • Dump the database and load up on Mercury server
  • Copy sites/example.com.au/files to the new Mercury server.(rsync or scp -r)
  • Configure the settings.php file to point to the right database. (if necessary)
  • add the following to the bottom of settings.php
    ##########################
    #
    # Mercury Settings
    #
    # Alter With Caution :)
    #
    ##########################
    # Varnish reverse proxy on localhost
    $conf['reverse_proxy'] = TRUE;           
    $conf['reverse_proxy_addresses'] = array('127.0.0.1'); 
    # Memcached configuration
    $conf['cache_inc'] = './sites/all/modules/memcache/memcache.inc';
    $conf['memcache_servers'] = array(
      '127.0.0.1:11211' => 'default',
    );
    $conf['memcache_key_prefix'] = 'example.com.au';
    ### END Mercury settings
  • Create an Apache vhost and restart apache should already be done by puppet

  • Setup caching modules for site

    DSITE="example.com.au"
    drush -l $DSITE en cacherouter
    drush -l $DSITE vset --yes cache 3
    drush -l $DSITE vset --yes cache_lifetime 0
    drush -l $DSITE vset --yes page_cache_max_age 600
    drush -l $DSITE vset --yes block_cache 1
    drush -l $DSITE vset --yes preprocess_css 1
    drush -l $DSITE vset --yes preprocess_js 1
    drush -l $DSITE vset --yes page_compression 0
  • clear any Drupal cache entries
drush -l $DSITE cache-clear all
  • test on port 9880 first then port 80 if successfull.
  • install cron
    0 * * * * /usr/bin/wget -O - -q -t 1 http://example.com.au:9880/cron.php

Conclusion

Please note that this is how we do the migration onto our own servers built following the Mercury install documents minus the Solr-search. Some adjustments may be necessary by you to follow these on a complete Mercury platform.