Problem/Motivation

As a developer working on local machine it would be great to have aliases for platform and site to get to files and database.

drush archive dump / backup download is a little to much especially when having platform and site in git.

Proposed resolution

Generate alias tab on site nodes
Generate aliases tab on client nodes?

Remaining tasks

Check with https://www.drupal.org/project/drush_recipes for potentials.

User interface changes

API changes

Comments

ergonlogic’s picture

If I understand correctly, you want to have a Drush alias generated for an Aegir-hosted site, that would contain the database and ssh credentials to allow for remotely sync'ing files and db?

Since this is under Hosting, I assume you'd want such a snippet provided in the front-end?

clemens.tolboom’s picture

Indeed. A download drush alias button for a site (rsync, sql-sync) and or platform (rsync). Similar to pantheon.

ergonlogic’s picture

We actually make an effort not to store database credentials in the front end, as a security precaution. So, we'll need to find a solution that respects that. The back end generation of such an alias should be pretty straight-forward, though.

For ssh/rsync access, this gets more complicated. I think the best bet, at this point, is to just require that a user's public key be added to a user's authorized keys. I think provisionacl would be the only way to secure such a setup for multiple users/clients.

clemens.tolboom’s picture

Thanks for your thoughts. I'll discuss this with @helmo too.

clemens.tolboom’s picture

Issue summary: View changes

Running on hostmaster server drush @site.example.com sa @self we get way too much info.

$aliases["site.example.com"] = array (
  'uri' => 'site.example.com',
  'root' => '/var/aegir/platforms/drupal-7.35',

  'remote-host' => 'hostmaster.example.com',
  'remote-user' => 'aegir',
);

Remote user should either be aegir or the current hostmaster user requesting the alias. The latter is in my case ACL configured.

I've tested some command:

drush sql-query
drush sql-dump
drush dl --destination

The advice could be to save the alias in hostmaster.example.com.aliasses.drushrc.php but it is up to the user where to save the alias.

Maybe we could add client related aliases too?

I try to make 'alias tab on site node' soon.

clemens.tolboom’s picture

Project: Hosting » Aegir Hosting Tasks Extra
Status: Active » Needs review
StatusFileSize
new1.99 KB

Code needs work but I'd like a review.

clemens.tolboom’s picture

Status: Needs review » Needs work
  1. +++ b/hosting_drush_alias/hosting_drush_alias.module
    @@ -0,0 +1,59 @@
    +function hosting_drush_alias_access($node) {
    +  // TODO: make sure user has access to site
    +  return $node->type == 'site';
    +}
    +
    

    How to make sure user has access to site.

    And how to add platform or is that not needed?

  2. +++ b/hosting_drush_alias/hosting_drush_alias.module
    @@ -0,0 +1,59 @@
    +function hosting_drush_alias_page($site) {
    

    What if it's not a site but platform?

helmo’s picture

Lets create a checkbox on admin/hosting/settings to indicate which remote-userto use for the ssh connection. 'aegir' of the logged in hostmaster user.

A comment line could be added to hint where the user can save this to use the alias.

helmo’s picture

Status: Needs work » Needs review
StatusFileSize
new2.04 KB

Small update to specify which filename to use on your local system.

I don't think it's usefull for a platform node.

ergonlogic’s picture

This is looking good. I'll try to test it over the weekend.

  • helmo committed 04d8275 on
    Issue #2473101 by clemens.tolboom, helmo: Generate drush aliases
    
helmo’s picture

Status: Needs review » Fixed

I added a hosting.feature.hosting_drush_alias.inc file and set the status to experimental.

Configuring the ssh hostname could be a nice follow-up issue, but I don't have time for it atm.

helmo’s picture

Issue tags: +Aegir 3.3

Status: Fixed » Closed (fixed)

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