Download & Extend

aegir suggests the wrong hosting setup uri for drush when installed on a non-default port

Project:Hosting
Version:6.x-0.4-alpha2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Having patched hostmaster as per http://drupal.org/node/566410#comment-2131318 to allow aegir setup to proceed on a non-default port (eg. aegir.example.com:8080) I run into a second problem at the end of the aegir installer wizard.

When aegir tells me to run hosting setup it suggests the following shell commands:

cd /var/aegir/drupal-6.14
/var/aegir/drush/drush.php --uri=http://aegir.perlucida.com:8092 hosting setup

This generates an error about sites/default because drush can't find the correct sites/sitename folder.

One workaround is to actually install using sites/default, then move settings.php etc to a different folder. Another is to use the correct uri for drush, matching Drupal's usual (if a bit mad) site naming:

/var/aegir/drush/drush.php --uri=8092.aegir.perlucida.com hosting setup

So basically aegir currently tells the user the wrong uri to use if they're not installing on port 80.

The setup command is generated in hosting_help.inc at line 504:

  $drush_path = $node->drush_path;
  $docroot = HOSTING_DEFAULT_DOCROOT_PATH;
  $uri = HOSTING_DEFAULT_BASE_URL;
  $username = HOSTING_DEFAULT_SCRIPT_USER;
  $setup_cmd = <<<EOF
    cd $docroot
    $drush_path --uri=$uri hosting setup

So it's basically using HOSTING_DEFAULT_BASE_URL right now, which obviously isn't correct.

But how to go about fixing this?
Does hosting need to have a more intelligent way of finding the right uri for drush? Does drush need to be smarter about it's uri's?

Suggestions please, and I'll see if I can knock up a patch.

Comments

#1

I'm confused, you haven't mentioned what 8092 is or where it's come from? I can't see how it'd form the uri of http://aegir.perlucida.com:8092 if you're saying your site is 8092.aegir.perlucida.com?

In the other ticket you mention http://aegir.perlucida.com:8092, so isn't this the *correct* url that you're expecting to see? I'm not sure what the problem is, and I'm confused when you mention here why 8092.aegir.perlucida.com is a better? Isn't that wrong?

HOSTING_DEFAULT_BASE_URL is defined simply from the GLOBALS['base_url'], in hosting.module.

I applied your patch from #566410: Can't finish setup if aegir running on a non-standard port and I received the correct instructions to initalise hosting setup with the correct site name and port. See screenshot, you can see it's the correct URI per my location bar..

The only weird issue I *did* experience was that no Verify task kicked off for the inital platform, I had to manually go and Verify it myself which is abnormal. I don't know if this is actually related to that patch, or the idea of running on a non-standard port though, so I'll continue to look at this.

AttachmentSize
600508_hosting_uri.png 134.52 KB

#2

@mig5 well, to resolve some confusion read the instructions in default.settings.php regarding port numbers, kind of assumed everybody had read that, it's been in Drupal's settings.php for several versions ;)
Here's the relevant bit to save you looking:

* If you are installing on a non-standard port number, prefix the
* hostname with that number. For example,
* http://www.drupal.org:8080/mysite/test/ could be loaded from
* sites/8080.www.drupal.org.mysite.test/.

So that's why the port number is added there - because I've been told by settings.php to do it that way and have done for years. It says if my url is http://aegir.perlucida.com:8092 I should create sites/8092.aegir.perlucida.com. Clear?

I just created a site with aegir and it completely ignored the port number, just created sites/example.com without the port and the site is accessible with the port in the URL. So maybe it's superfluous and this can be resolved with documentation. Or maybe there's an edge case where someone might try to create two sites on the same domain but different ports (80 and 443? maybe not so edge?) and aegir will break? Because it'll try to create two site folders with the same name...

What did you name the site folder in your example? I'm guessing since you were unaware of the ports 'needing' to be added you just used 'sites/aegir.mig5-forge.net' rather than 'sites/8080.aegir.mig5-forge.net'? My problem is I know too much :/

IIRC I also had to manually start the verify too.

Hope that's made my issue a bit clearer.

Personally I can work with just leaving the port off the site folder name, but it should probably be documented that you should ignore what settings.php tells you.

#3

Amazing the things you learn!

I imagine this is going to take some refactoring. How then to handle the one site > many ports logic in the other ticket, where one will want a site running on both port 80 *and* 443 ? The point is we don't want to be creating separate sites folders for the same site based on the port : my work in the multiports patches has been to only install once, and create several vhosts per port.

So, it looks like I've some reading to do, as I'd never seen this $port.$sitename stuff in the settings.php before. And i've been a user since the 4.x days :)

#4

Well I'd say it's a good idea to support Drupal core approach (either that or you have to reinvent the wheel). And view 443 as a special case, though of course you can't limit it to that one port.

As I see it aegir should default to one site per port but allow a port 'alias' where required, https/port 443 being one such case.

But then I'm sure you know all that :)

#5

Status:active» fixed

Doesnt suggest anything in HEAD anymore, hostmaster-install call it for you.

#6

Status:fixed» closed (fixed)

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

nobody click here