Multisite: How to specify ~/sites/mydomain.com.mysite in the command-line options?

jccc - November 5, 2009 - 23:29
Project:Drush
Version:All-Versions-2.1
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I've been digging though a lot of documentation and forum postings on command-line options for specifying a multi-site site, but I'm just not seeing the answer to this.

My sites look like:
~/sites/sub.domain.com.mysite/
~/sites/sub.domain.com.myothersite/
~/sites/sub.domain.com.anothersite/

... where "mysite," "myothersite," and "anothersite" are self-pointing symlinks in Web root ("ln -s . mysite").

How do I do a status, for example?

./drush --root=/var/www/domain/httpsdocs --uri=https://sub.domain.com status
./drush --root=/var/www/domain/httpsdocs --uri=https://sub.domain.com/mysite status

I get either the default site only, or "Drush command could not be completed." The multi-site setup has been in operation for months and is working correctly, so this is not a startup installation question. I'm trying to add drush into the mix.

#1

jccc - November 5, 2009 - 23:40

Or maybe I misunderstand the scope of the status command. But how do I specify the site for doing an updatedb?

#2

greg.1.anderson - November 6, 2009 - 05:46

I am not 100% sure about the paths and domains you are using, so let me describe what I did.

/srv/www/drupal == where I usually put my Drupal root.

I usually create "myothersite.domain.com" and "anothersite.domain.com", all pointing at /srv/www/drupal, but this time I created the domain testms.com and gave it its own document root.

/srv/www/testms == document root for testms.com
/srv/www/testms/index.html == "hello world"
/srv/www/testms/drupal/ == symlink to /srv/www/drupal

Then I did the following tests:

drush --root=/srv/www/testms/drupal --uri=testms.com/drupal status

drush --root=/srv/www/drupal --uri=testms.com/drupal status

Both of these worked. "updatedb" in place of "status" also worked.

Finally, I added the following site alias to my drushrc.php file:

$options['site-aliases']['tms'] = array (
  'uri' => 'testms.com/drupal',
  'path-aliases' =>
  array (
    '!root' => '/srv/www/testms/drupal',
  ),
);

After that, I could also do this:

drush tms status

And that worked as well. I did notice that there are some other bugs with these sorts of site aliases, as the sitealias code expects to see 'testms.com.drupal' in some places instead of 'testms.com/drupal' (which is what is necessary). However, I could still use the tms alias with 'drush sql sync' after I added an entry for 'db-url'.

In any event, I will make another incident to repair the site alias bugs. I hope that the information above will be enough to get you started on your way.

#3

greg.1.anderson - November 6, 2009 - 15:03
Status:active» fixed

I realized I should set this to 'fixed' since there is no drush change needed here.

#4

mojzis - November 10, 2009 - 02:33

i am not sure i understand the magic of your symlink stuff :-)

anyway, what I find the best is running drush in the directory of the site you want to work for. Simply create an alias and there you go : cd /sites/whatever drush status (without the need to specify -r and -l).

#5

System Message - November 24, 2009 - 02:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.