Opened 7 years ago

Last modified 7 years ago

#5547 assigned Task/To do item

Have red create drush aliases for all Drual sites it createes and tracks

Reported by: Nat Meysenburg Owned by: Nat Meysenburg
Priority: Low Component: Tech
Keywords: drush red drush-aliases Cc:
Sensitive: no


Since drush is installed on all of our machines, it would be incredibly useful to create drush aliases for every site that is installed by red.

I'm not sure of the specific for implementation, but imagine that we could use the db name as the alias, and place alias files (or cat to the end of them).

We would also need to write some form of wrapper that will su the user that owns the site before running drush.

Change History (3)

comment:1 Changed 7 years ago by Ross

Owner: set to Jamie McClelland
Status: newassigned

comment:2 Changed 7 years ago by Jamie McClelland

Owner: changed from Jamie McClelland to Nat Meysenburg

I think the big picture purpose of this ticket is to enable us to run a drush command on all Drupal sites that are controlled by the Control Panel/Red (e.g. drush updatedb). If so, perhaps we should re-title the ticket to reflect it?

Nat and I discussed this briefly on friday and now I that I've thought about it a bit, I realize that I'm not sure if you have in mind installing these aliases for the root user (~/.root/.drush) or in the ~/.drush directory of each individual user.

If I have the big picture right, I think there might be easier ways to run a drush command for each red-installed site.

Creating a drush alias for each user doesn't really help us - since it's not that easy to find ones that we created (vs ones that our users may have created). And it's not the helpful for our users because each user who knows to use drush aliases will probably have a different alias naming convention.

On the other hand, we could create drush aliases in /root/.drush/ and then iterate over all aliases to run a command on all sites. That would simplify the process of running a drush command on all sites.

However, without drush aliases, we can do this by:

  • find all web directories with a symlink pointing to /usr/local/share/drupal-{6,7}/index.php
  • su to the owner of the symlink
  • cd to the sites/default directory
  • run drush command

Iterating over drush aliases is less complicated. However, it relies on keeping data in sync that could go out of sync (if a user deletes their drupal aliases but doesn't delete the control panel item).

Rather than creating the drush alias files, I'm inclined to write a freepuppet script that takes as it's arguments the server to run on and a 2nd argument is the drush command to run and then freepuppet helper would do the complicated finding/su'ing.

What do you think? I'm sending back to you Nat for feedback.


comment:3 Changed 7 years ago by Daniel Kahn Gillmor

I'm also concerned about making aliases in ~/.root/.drush because i don't want to encourage anyone to run drush directly as the superuser.

Please login to add comments to this ticket.

Note: See TracTickets for help on using tickets.