I have the need to run a bunch of versions of sites, and our URL scheme is pretty long.
We use a bunch of drush tools that refer to these sites by alias, not just the Aegir UI.
We have rapidly found that any decent project starts chopping off the site URL arbitrarily, and I can't imagine a good reason for this to be a neccessary restricting in the code. It makes it hard to keep our commandline and documentation consistent if we can't have a 1:1 match between the site hostname and the site-alias
Example (sligthly exaggerated) URL:
dev.platformversion.projectname.longclientname.hostserver.ourlongcompanyname.co.nz
Our companyname is long 'sparksinteractive.co.nz'
and the hostserver is in there to take advantage of wildcardDNS.
Often clientname and projectname are the same, but not always.
As Aegir encourages each release of a build to be a new platform, we sometimes have to insert the platformversion in there.
Objections to the naming style that has led us here aside (I also encountered this when trying to use temporary AWS URLs),
that is the workflow/schema I have to *be able to* support.
But hosting.module forces a chop at
dev.platformversion.projectname.longclientname.hos
just because the database schema was being stingy with bytes.
mysql> describe hosting_context;
+-------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------------+------+-----+---------+-------+
| nid | int(10) unsigned | NO | PRI | 0 | |
| name | varchar(50) | NO | UNI | NULL | |
+-------+------------------+------+-----+---------+-------+
Unless there is a genuine reason why Aegir's head would explode when presented with a longer URL, I propose a schema update
ALTER TABLE hosting_context MODIFY name VARCHAR(128);
Sorry, I can't tell the 'hosting' version from inspecting the site report or the code, it's the one with hostmaster profile 6.x-1.9
I've tried this on a test hostmaster, and seems to work. Even if this suggestion won't be accepted here, can anyone warn my why this may not be a good idea for me to run on my production server?
Comment | File | Size | Author |
---|---|---|---|
#12 | hostmaster.code_.1971348-12.patch | 3.15 KB | chertzog |
#11 | hostmaster.code_.1971348-11.patch | 3.13 KB | helmo |
#7 | alias.patch | 2.07 KB | chertzog |
#5 | alias.patch | 2.07 KB | chertzog |
#4 | alias-length.patch | 3.18 KB | chertzog |
Comments
Comment #1
ergonlogicInteresting... Digging into this bit, that line in hosting_schema() appears to have been introduced in http://drupalcode.org/project/hostmaster.git/commit/28a7ac8955a25358159a.... The commit message refers to #723288: Introduce the concept of 'shortnames' for all major entities., which doesn't justify a length of 50 characters, that I can see anyway.
So, since this value appears to be arbitrary, I propose implementing @dman's suggestion. If there aren't any objections in the next few days, I'll go ahead and make the requisite modifications.
Comment #2
omega8cc CreditAttribution: omega8cc commentedThis is a bug, because we shouldn't limit the site name length on the SQL level - it causes those weird
This task is not valid
errors when the drush alias name gets truncated because of this silent limitation.It is also much less than legitimate max domain name length, which is 253.
But even with some (if any) limit enforced in the schema, we should limit this on the code level first, to avoid silent name truncating on the SQL level.
Moving this to the correct queue.
Comment #3
anarcat CreditAttribution: anarcat commentedjust changing the database is not enough - we need to validate the heck out of this thing.
i agree with 253, even though I think it's rather silly.
Comment #4
chertzogHow about this? Im not sure if checks need to be placed anywhere else, but here is a start.
Comment #5
chertzogbetter patch with out the whitespace stuff....
Comment #6
omega8cc CreditAttribution: omega8cc commentedWhile 253 is already absurdly long, we need to lower it to 235, or someone will hit the 256 filename max limit, because the actual filename of the drush alias has the
.alias.drushrc.php
extension added.Comment #7
chertzogUpdated.
Comment #8
dman CreditAttribution: dman commentedI see no reason why this shouldn't go in pretty easily.
:-)
Comment #9
helmo CreditAttribution: helmo commentedThis specifies 253 instead of 235
We would need an update hook to change this in existing installations
Comment #10
anarcat CreditAttribution: anarcat commentedplease make that magic number a define() too so that it's not so magic.
Comment #11
helmo CreditAttribution: helmo commentedAdded HOSTING_MAX_ALIAS_LENGTH ... can we use that constant in the hook_schema and hook_update_N?
Comment #12
chertzog@helmo according to the docs of hook_schema (https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...), you can rely on the .module to be available during install, just not uninstall.
looks good to me.
Attached patch updated the hook_update number.
Comment #13
helmo CreditAttribution: helmo commentedThe D7 docs specify:
But for D6 there is no such mention...
Comment #14
anarcat CreditAttribution: anarcat commentedhum, so then we need to include that file.
Comment #15
clemens.tolboomI would not use a constant in a hook_update_N as the constant can change in the future. Then there is no reference anymore to the changed except the constant itself. Hard to debug.
One could use it for hook_schema
No eof
My 2cnts
Comment #16
helmo CreditAttribution: helmo commentedthanks @clemens.tolboom
I've updated the patch and committed.
Comment #17.0
(not verified) CreditAttribution: commentedUpdated issue summary.