Settings for sets of sites: Putting Drush configuration into your project repository
Inherit local-only options with 'parent'
Parent is not working across files. Filed support request: http://drupal.org/node/1262230
In an aliases file that lives with your project, so for our SDL project, sdl.aliases.drushrc.php, put in all settings that are true no matter who is using Drush and from where. This is the settings for an externally hosted development collaboration site.
$aliases['dev'] = array(
'parent' => [email protected]',
'remote-host' => 'simone.mayfirst.org',
'root' => '/var/local/drupal/sdl/web',
'uri' => 'sdl.agariclabs.org',
'parent' => '@testserver' line. If there's no alias named @testserver Drush doesn't cry about it.
Then in a local file:
* Drush aliases that are shared for most sites, such as base configuration.
$aliases['testserver'] = array(
'remote-user' => 'fred',
$aliases['local'] = array(
'root' => '/home/ben/code/sdl/web',
'uri' => 'sdl.localhost',
Gotcha: The alias path is to the folder containing the aliases file, not directly to the alias file itself
If you are in the same directory as the aliases file you want to use:
WRONG: drush @dev status --alias-path=sdl.aliases.drushrc.php
RIGHT: drush @dev status --alias-path=.
I spent over an hour trying to figure out wasn't working here. Watch me suffer.
To check the status of all your aliased sites (including the local Drush version they are using), you can use, where anjali is the name of a project used in the filename anjali.aliases.drushrc.php:
drush @anjali status
(You can run any Drush command on all sites at once but i cannot think of many commands for which that is even remotely, pun intended, a good idea.)
Using a relative path to an alias
Attempting to use a relative path
../ does not work- no, correction, the relative path does not work if it is combined with another path with the colon.
The absolute path alone works:
* Drush configuration.
/**$options['alias-path'] = '/home/ben/code/sdl';
* Additional directories to search for *.alias, *.aliases.drushrc.php files.
* Follows the form:
* $options['alias-path'] = '/path/to/aliases:/path2/to/more/aliases';
This also works:
$options['alias-path'] = '..';
But either of these do not work:
$options['alias-path'] = '..:/home/ben/code/sdl';
$options['alias-path'] = '/home/ben/code/sdl:..';
Note: I don't know that there is any reason not to put mysite.drushrc.php right in the Drupal root (or the aliases file in the sites/ directory). Aside from vague security concerns, this method seems just fine. Personally i prefer not to have anything in the web root that does not naturally belong there, and am willing to jump through a few hoops to put it elsewhere. In consideration of the rest of my team, however,
Sources of information for this how-to include the command
drush topic core-global-options, but primarily the excellent help text in drush/examples/example.drushrc.php and drush/examples/example.aliases.drushrc.php.