Getting a site out of a Drupal Multisite install into a “stand-alone” Drupal install
Recently I participated in a project that required to take a Drupal site out of a multi-site install into it’s own server.
The site in question was part of a regular Aegir-Drupal multi-site install, to manage the site’s development phase and once ready for production, it had to be moved into its own server.
After making several tests to see how to make it work and confusing myself everytime I tried, I found drush’s own archive-dump and archive-restore, so I decided to give it a try. What was my surprise? After a full week reading here and there and trying this and that… all it really took was:
SSH into development server, cd into Drupal platform install directory and do:
$ drush ard sitename.com —destination=~/site-backup-filename.tar.gz
Move site-backup-filename.tar.gz into the production server
SSH into production server, cd into Apache document root and issue:
$ drush arr site-backup-filename.tar.gz —db-url=mysql://dbuser:dbuserpasswd@dbhost/dbname
This will restore the sitename.com directory inside a full Drupal install taken from the development server’s platform, e.g. drupal-7.10-x
Change owner for the whole Drupal directory:
$ chown -R www-data:www-data drupal-7.10-x
Just in case, also issue the same command for the following directories:
sites/sitename.com/files
sites/sitename.com/private
sites/sitename.com/private/temp
Create sites/sites.php file with the following content:
<?php
$sites = array(
‘sitename.com’ => ‘sitename.com’
// the first sitename.com in the file, refers to the url content in the browser’s window,
// you may replace this with the a FQDN.
// the second sitename.com appearing after ‘=>’ is the directory name inside sites/ where
// the site files are stored.
);
Just to be completely sure, remove anything from sites/sitename.com/settings.php that is not db related, when the site is restored, drush appends the new db settings to this file, so pretty much what’s before this new db declaration is “useless”.
Issue several times:
$ drush cc all
just to be sure we cleared all cache from this new install… remember to do this inside sites/sitename.com directory.
Point your browser to the production server url and enjoy.