Can't finish setup if aegir running on a non-standard port

adrinux - September 2, 2009 - 16:09
Project:Hostmaster
Version:6.x-0.4-alpha2
Component:Code
Category:bug report
Priority:normal
Assigned:adrinux
Status:needs work
Description

I'm stuck on the 'Welcome to the Aegir hosting system' part of the install process/aegir setup with this error:

Could not resolve IP address of webserver aegir.perlucida.com:8092. Either set the web server name to a FQDN (Fully Qualified Domain Name) or hardcode the IP here.

There doesn't seem to be any 'here' to hardcode the IP. :/

This is an ubuntu virtual machine running on virtualbox.
The IP of the machine is fixed (but is a LAN IP)
The hostname aegir.perlucida.com is set in /etc/hosts
Servername is set to aegir.perlucida.com in apache config

Tried using the IP for the drupal sites/sitename folder name instead, but that just generates the invalid domain error on the next page.

Does anyone have aegir working on a VM and a non standard port? eg 8092 insterad of 80? (I'm using the latter to get around my router, works fine with all the other drupal stuff I do. But it does mean the IP address of the domain resolves to that of the router, not the IP of the virtual server. The router is set to forward traffic on port 8092 to the correct LAN server.)

Idea's? Workarounds?

#1

adrinux - September 2, 2009 - 19:08
Title:Setup wizard fails when unable to resolve IP address of webserver» Setup wizard error unable to resolve IP address of webserver
Category:support request» bug report

Changing the title.

Where does hosting.module get $fqdn from?

#2

adrinux - September 2, 2009 - 20:11

After some tinkering I now have a different error;

Invalid valid domain name. Either choose a proper domain name or hardcode the IP address of the webserver.

On the 'Configure your web server' page of the setup.

It seems it now can resolve the IP, but doesn't think it's a valid domain name.

I'm still confused.

#3

adrinux - September 2, 2009 - 20:15
Title:Setup wizard error unable to resolve IP address of webserver» Setup wizard error claims domain name is invalid
Category:bug report» support request

changing the title again.

_hosting_valid_fqdn() has a regex, and that does match my domain, even with the port added, so I just don't get where this error message is coming from.

#4

adrinux - September 2, 2009 - 22:21

Ok. Some clarity is beginning to emerge.

If you ignore the first error during install and click 'next' you get the second error, the second error actually occurs because $ip_address is empty, it's not set unless the ip address can be resolved.

So this is all the same problem.

I wrote a little cli script:

$ip = gethostbyname('aegir.perlucida.com');

echo $ip;

to do gethostbyname() and it returns 80.175.116.45 which is what I'd expect for aegir.perlucida.com. That's the IP of my router.

hosting_nodeapi_web_server_presave() uses
$ip = gethostbyname($node->title);
however, so I'm about to figure out what $node->title it's actually feeding to gethostbyname....

#5

adrinux - September 2, 2009 - 22:28

Right, so modify my script with $ip = gethostbyname('aegir.perlucida.com:8092'); and it returns aegir.perlucida.com:8092, which is obviously not right.

Why is $node->title set to 'aegir.perlucida.com:8092' instead of 'aegir.perlucida.com'?

#6

adrinux - September 2, 2009 - 23:13
Title:Setup wizard error claims domain name is invalid» Can't run setup if aegir site is accessed via a port defined in the URL.

...because it's picking the $node->title directly from the url, as far as I can tell...I just can't see where.

If I knew that we might be able to strip off the port number before feeding the hostname to gethostbyname.

Gone midnight, giving up for now. First aegir install: FAIL.

#7

anarcat - September 3, 2009 - 09:51

So the solution here is to parse HTTP_HOST for the port number, which can also be used properly alongside #515052: Customizable port field per site.

#8

adrinux - September 3, 2009 - 11:07
Title:Can't run setup if aegir site is accessed via a port defined in the URL.» Can't finish setup if aegir running on a non-standard port
Project:Hosting» Hostmaster
Version:6.x-0.3» 6.x-0.3
Component:Miscellaneous» Code
Category:support request» bug report
Assigned to:Anonymous» adrinux

Ok. I now have a fix for this, but anarcat pointed out on irc#aegir that http://drupal.org/node/515052 is a companion issue.

My quick fix for installation issues (I haven't finished the install yet, never mind actually tried to use aegir), is just trimming off the port when $node->title is generated, so that gethostbyname() will work as expected.

This is for the 0.3 release:
in drupal-6.x/profiles/hostmaster/hostmaster.profile at line 245 we currently have:

  $node->type = 'web_server';
  $node->title = $_SERVER['HTTP_HOST'];

to trim off the port:
  $node->type = 'web_server';
  $hostname = explode(':', $_SERVER['HTTP_HOST'], 2);
  $node->title = $hostname[0];

So even with aegir at http://aegir.perlucida.com:8092 it is able to resolve the host:

Initialized the webserver IP to 80.175.116.45 based on hostname aegir.perlucida.com

For now I'm posting this as a bit of a hack for anybody else that sees this issue and wants to play with aegir, if/when http://drupal.org/node/515052 lands in hosting I'll install HEAD and take another look at this issue.

Will move this issue to Hostmaster where it belongs, mark it as a bug, and assign it to myself.

#9

anarcat - September 7, 2009 - 13:19
Status:active» needs work

The ports patch has landed: please provide a proper patch and make sure the webserver has it's ports settings properly set. It's in $node->ports, see http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/hosting/web...

#10

adrinux - October 8, 2009 - 23:10
Version:6.x-0.3» 6.x-0.4-alpha2
Status:needs work» needs review

Patch attached. Grabs the port too and sets it as $node->ports. As it stands this means only the grabbed port will be listed in the form, effectively replacing 80. I think this is the desired behaviour.

This eradicates the originally described error, but I'm still having issues further along unless I install to sites/default - but those are likely in hosting or drush so shouldn't really be included here anyway.

(Actually using mig5's git mirror for this testing.)

AttachmentSize
hostmaster_install_on_nondefault_port-566410-v1.patch 540 bytes

#11

adrinux - October 9, 2009 - 10:27

On second thoughts, new version that adds the captured port to the default port. So if aegir is being installed on a site on port 8080, the ports entered automatically during the wizard session will be 80,8080 seemed like a better option to keep the default port.

AttachmentSize
hostmaster_install_on_nondefault_port-566410-v2.patch 548 bytes

#12

adrinux - October 9, 2009 - 21:09

There's a follow up issue to this, once you've applied the patch you hit a small bump further on in setup. See http://drupal.org/node/600508 for details.

#13

mig5 - October 11, 2009 - 03:40
Status:needs review» needs work

Thanks adrinux, I applied this patch and it let me complete the installer no problem.

However, since you've included port 80 as *well* as the nonstandard port, this immediately breaks the aegir site post-verify, because we don't actually have support right now for running one site on multiple ports.

In other words, post verify, the only vhost that is generated for the site is for port 80.

There's a separate ticket to introduce support for 'one vhost, many ports' so that HTTP + HTTPS sites will work. Currently if you want to run the same URl on a separate port, it actually *installs* a new site for you.

#570980: allow vhosts of the same name on a different port

Feel free to use my patches there and test. I hit a brick wall with it and am having trouble with the vhost generation - basically everything is working and it will generate multiple vhosts for the site if it has multiple ports, but some corner cases are not working i.e http > https redirection, multiple ports, and site aliases with alias redirection as well.

So to commit this right now, we'd have to drop back to *not* supporting a default port of 80, so that it would *only* run on the nonstandard port, until the multiports stuff gets in, and then we could come back to this to make it support multiple ports off the bat at install time.

If those multiports patches can be fixed to handle every possible combination of vhost / redirection/ https / whatever, I would be the happiest man on the planet :)

#14

adrinux - October 13, 2009 - 14:09

It seems this once again needs to be set aside until *another* ports patch lands...

#15

adrinux - October 29, 2009 - 01:31
Status:needs work» needs review

Actually I think I was confused by the multiple ports. All we really need is to grab the port from the url so the install can finish properly, and default to port 80 if no port is found in the url.

So rerolled. It now add's the port if there is one on the url, and uses 80 otherwise.

Tested with port 8092, needs someone to test install on standard port 80.

Would be nice to get this in so I don't have to patch before each install.

AttachmentSize
hostmaster_install_on_nondefault_port-566410-v3.patch 570 bytes

#16

adrian - November 13, 2009 - 16:48
Status:needs review» fixed

committed. thanks.

#17

adrian - November 13, 2009 - 21:43
Status:fixed» needs work

this broke installation, so i have had to revert it

here's the issue it created : http://drupal.org/node/632302#comment-2263312

i believe it's because the ports extension is not yet loaded at this point.

 
 

Drupal is a registered trademark of Dries Buytaert.