In moving my website from an Ubuntu server to a virtual host running the TKL Drupal appliance, I decided to keep my conventional development environment i.e. development, staging (test), and production all on the same server. At some point, I will probably move development and staging to a separate virtual host, but for now I'm keeping them together since that's what I'm familiar with. Setting up a multi-root installation on a TKL appliance, or Debian/Ubuntu for that matter, requires a few adjustments. One consideration is how to handle updates. Debian's Drupal package is setup to support a single-root, multi-site installation. I want to be proactive on security matters and yet I'm cautious about relying on a packaged update automatically being applied to my production server. Whenever a new security release of Drupal core or third party module is available, I want to apply it to the staging (test) site first and then run a series of checks before pushing it to the production site. This requires separate 'roots' for each of the Drupal sites so that the staging site can be upgraded without disturbing the production site. Fortunately, Drush makes upgrading core and updating modules easy and was designed to support multi-site, multi-root installations. To make things even easier, I setup site-aliases for each of the three sites, @dev, @test, and @live. Unfortunately, the TKL installation of Drush includes a shell wrapper for drush which breaks it's multi-root capability.
This sets the Drupal root to always be /usr/share/drupal6 which can't be overridden by a site alias.
I believe a better way to set the default root for Drush is to put the following in
/etc/drush/drushrc.php
<?php
// $Id: drushrc.php for TurnKey Linux Drupal
// Specify a particular multisite. Change this to your default host name.
$options['l'] = 'http://localhost';
// Specify your Drupal core base directory (useful if you use symlinks).
$options['r'] = '/usr/share/drupal6';
Running multi-site, multi-root installation
In moving my website from an Ubuntu server to a virtual host running the TKL Drupal appliance, I decided to keep my conventional development environment i.e. development, staging (test), and production all on the same server. At some point, I will probably move development and staging to a separate virtual host, but for now I'm keeping them together since that's what I'm familiar with. Setting up a multi-root installation on a TKL appliance, or Debian/Ubuntu for that matter, requires a few adjustments. One consideration is how to handle updates. Debian's Drupal package is setup to support a single-root, multi-site installation. I want to be proactive on security matters and yet I'm cautious about relying on a packaged update automatically being applied to my production server. Whenever a new security release of Drupal core or third party module is available, I want to apply it to the staging (test) site first and then run a series of checks before pushing it to the production site. This requires separate 'roots' for each of the Drupal sites so that the staging site can be upgraded without disturbing the production site. Fortunately, Drush makes upgrading core and updating modules easy and was designed to support multi-site, multi-root installations. To make things even easier, I setup site-aliases for each of the three sites, @dev, @test, and @live. Unfortunately, the TKL installation of Drush includes a shell wrapper for drush which breaks it's multi-root capability.
This sets the Drupal root to always be /usr/share/drupal6 which can't be overridden by a site alias.
I believe a better way to set the default root for Drush is to put the following in
/etc/drush/drushrc.php
and then link the Drush executable.
Drush will then use the default root when none is specified, but it can be overridden by a site-alias or the -r option on the command line.
Information is free, knowledge is acquired, but wisdom is earned.