2

I try to rsync between a multisite setup (local) and a multisite setup (stage). If I run a sync it will copy all sites from dev to stage but I just want the current site to be synced.

$drush rsync @dev @stage

My drush alias file is located in ~/.drush/example.aliases.drushrc.php

$aliases['local'] = array(
  'root'           => '/Users/admin/Sites/drupal',
  'uri'            => 'example.local',
  'shell-aliases'  => array(
    'dump' => '!drush sql-dump --gzip --ordered-dump'
  ),
  'path-aliases' => array(
    '%dump'          => '/Users/admin/dev-' . date('Ymdhis') . '.sql',
    '%drush'         => '/Users/admin/drush',
    '%site'          => 'sites/example/',
  ),
);

// REMOTE: STAGING
$aliases['stage']  = array(
  'remote-user'      => 'xyz',
  'remote-host'      => 'stage.example.com',
  'root'             => '/home/xyz/www/stage.example.com',
  'uri'              => 'stage.example.com',
  'path-aliases' => array(
    '%drush'         => '/home/xyz/drush',
    '%drush-script'  => '/home/xyz/drush/drush',
    '%dump-dir'      => '/Users/admin/.drush-backups/example.stage',
    '%site'          => 'sites/example/',
  ),
  'command-specific' => array(
    'sql-sync'       => array(
      'no-cache'     => TRUE,
    )
  ),
  'shell-aliases'    => array(
    'dump' => '!drush sql-dump --gzip --ordered-dump'
  ),

  // DB
  'databases' =>
  array(
    'default' =>
    array(
      'default' =>
      array(
        'database'   => 'xyz',
        'username'   => 'xyz',
        'password'   => 'xyz',
        'host'       => 'xyz',
        'port'       => 'xyz',
        'driver'     => 'mysql',
        'prefix'     => '',
      ),
    ),
  ),
);

Questions:

  1. %site: My project folder in sites/ is called example on the local side and has the same name on the staging side. Do they need to be different?

  2. Do i need to put all domains in site.php on my staging server? At the moment I am using just the actual setup ($sites['stage.example.com'] = 'stage.example.com';) on my staging server. My local sites.php file:

    $sites['example.local'] = 'example.local';
    $sites['stage.example.com'] = 'stage.example.com';
    $sites['example.com'] = 'live.example.com';
    
  3. Are the directories all/ and default/ always needed?

My local Setup:

  • Drush 7.x dev
  • PHP 5.5.x
  • MAMP

My Server Setup:

  • Drush 7.x dev
  • PHP 5.5.x

Edit: Removed opinion based questions ;)

3
  1. On Drupal 6, your sites folders must be the same. Since you are using Drupal 7, they can be different, but it is more convenient if they are the same.

  2. You do not need to copy all of your multisites to your dev server. The drush rsync option you are looking for is --exclude-other-sites. This will cause rsync to skip everything in the sites folder except for sites/all, and the site you are syncing from.

  3. sites/all is where sites/all/modules and sites/all/themes go, so you typically need these. With some effort it might be possible to move your contrib modules elsewhere (if everything was in a profile, or if you hand-modified your registry), but this would be an unusual setup. sites/default is not needed.

  • Thank you very much! I wonder why --exclude-other-sites did not cross my 4h+ search marathon :) – Mike Jan 15 '14 at 18:27
  • You are very welcome. Always try drush help rsync (substitute command of choice), and also look at drush topic to see if anything is listed there; might save you some time next time! – greg_1_anderson Jan 15 '14 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.