-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drush alias failure with consolidation/site-alias requires change to BLT #3204
Comments
Changing how Drush alias files are created is not necessary; the only change needed is to call
|
I decided to go ahead and roll back the breaking bugfix on the 1.x branch. BLT users may now update to site-alias 1.1.10 to continue using the current version of BLT. Pinning to 1.1.5 is still also possible, but updating to 1.1.10 is preferred. BLT should update to site-alias ^2 as soon as convenient, and make the changes described above. There will be no further development on the 1.x branch. |
@greg-1-anderson thanks for jumping in on this. i think we can update the version no problem. I scanned our codebase and the The only real place BLT actually "generates" aliases is here: |
Try upgrading to ^2; then the exception that @shelane encountered will return. I think she may have more info about the code path in blt where this is encountered. |
OK great. Yeah, @shelane if you have any additional details on how to reproduce your issue I'd love to try and get this fixed for a 10.x version tag. |
I simply tried to do an install with
Details are listed in the linked issue for consolidation/site-alias in my original message above. |
@shelane how long has it been since you generated your aliases (what version of blt / drush, etc.)? i am looking at my project alias for what i'm on right now, and i have roots defined for all my aliases for both local and acquia cloud alias files, and i see it as an option here: https://github.com/acquia/blt/blob/10.0.x/src/Robo/Commands/Generate/AliasesCommand.php#L339
|
Drupal version : 8.6.2 I just deleted my local.drush.yml file, ran |
Ah, I see the issue. Was thinking actual drush aliases, not the local.drush file. Thanks! Will roll a PR for testing shortly. |
Actually, it looks like drush has this locked into version 1.5.x... https://packagist.org/packages/drush/drush#9.5.2 Not sure if we can update this ahead of them? We could certainly put in a PR to modify the behavior for local.drush.yml generation though, I think it's just a matter of adding the docroot as the default root in https://github.com/acquia/blt/blob/10.0.x/settings/default.local.drush.yml |
Drush 9.6.0-beta1 has been tagged, and allows for site-alias ^2. You are not required to have a root. You are required to use |
@greg-1-anderson that's the thing though, as far as I can tell, there is no BLT code that actually calls the root() method... i'm wondering if this bug should actually be on the drush side, not the BLT side? |
Possibly. Test with 9.6.0-beta1. If that clears up the problem, peg to site-alias ^1 until Drupal 9.6.0 stable is available. |
FYI to @balsama for visibility |
You can also do what Drush does, and select |
Part of the reason I tagged the Lightning team, is that BLT doesn't have an explicit requirement for this at all, so I want to make sure that the right things are in the right places (so if the new drush and the right version of site-alias needs to be locked in, that likely needs to be done in Lightning not BLT since we don't require it at all) |
Yeah if you do not use site-alias directly, then leave it out of your composer.json. It should be fine now, as ^1 will bring in 1.1.11 which should still work. |
Sounds like there are no remaining action items here for BLT. |
Looks like the blt composer.lock file has updated consolidation/site-alias to 3.0 but did not actually update the method for handling site roots has not been updated. consolidation/site-alias#20 I now get this exception:
It should be pinned to 1.1.11. |
@shelane precisely what steps did you take to generate that error? I'm assuming you are running a Drupal install on a project using BLT. In that case, BLT's own composer.lock should have zero influence on what version of site-alias gets installed (it's only used if you are actually developing against BLT, it doesn't get applied to downstream projects). I suspect there's something wrong with your site aliases since BLT never directly invokes site-alias, and we have numerous automated tests to ensure that drupal installs work without error. |
@shelane From the stack trace above it looks like this error is in Drush site-install, not in BLT. What version of Drush are you using, and what does your alias look like? Maybe move this report to drush-ops/drush, as it looks like the bug is probably there. |
Using Drush 9.6.2 and the command The
And the
I know the "site root" is not defined in there and BLT doesn't put it in there when it generates the alias file. |
Hm, this is hard for me to reproduce. If Not sure why |
I really wish I had tome to get to the source of this. However, I have taken the path of backing out the upgrades I did to the point that things were working. I've locally restricted site-alias 1.1.11 and then ran the acquia/blt update to 9.2.6. This leaves the drush version at 9.5.2 as well and things are working fine. |
If you want to follow up, the next steps would be to run |
Not sure if it's appropriate to re-open this... but what I've noticed is that BLT will work with a single site install, b/c the That sort of explains why the OP was seeing the error with the |
@dpagini Yes! Thank you. I do have a multi-site setup. |
Wondering if the BLT fix might be to specify |
Isn't the proper fix here to make sure your aliases define a root? I just realized that aliases generated by the Drush tasks in BLT specifically do not include a |
So I'm not sure if this is a BLT thing (I could probably check pretty easy, will later if I have a chance) but we have a However, we don't set Again, not a problem for the default local site which uses |
The use case for defining an alias without a I do not think that a local entry for everyone alias is useful. Is everyone expected to edit this version-controlled file, and then be careful not to commit it back to your repository? Perhaps there is some good way to determine the root in this instance that I am not considering; however, failing that, I am 👎 on this instance of rootless (local) site aliases. There are two good ways in Drush 9 to share aliases in a site repository.
Drush 9 aliases can expand environment variables. If you require everyone to: a. Check out your site name into a directory named after the repo (git default) Then you can set
Require all developers to set up a simple local alias
Then, you can define So, alias files that do not define a |
So from a BLT perspective, it seems like we should recommend that the root always be set via an alias. Either because you are using a VM / Lando where the root can be hardcoded, or via one of the methods described by Greg (these should be documented in BLT and / or Drush). Add a note about this to the multisite alias generation script, which can't set a root for non-VM users. BLT could also add a configuration option for |
If you are expecting to identify your site via cwd, and then use rootless aliases only to set the site's Also, the Drush site-install bug is still a bug, regardless of the type of alias used to produce it. If I can get a clear description with steps to reproduce in the Drush queue, then I'll fix it. |
Yeah actually I agree, this should probably get fixed upstream in either Drush or consolidation/site-alias. Upstream issue: drush-ops/drush#4059 Even our internal tests are now failing when we try to use any alias other than |
Hm I don't know if I missed that Drush issue you posted or what, because it looks like it's clear enough how to reproduce it. I'll try it again and see if I can make it behave more uniformly. |
I fixed our internal tests, and suggest folks work around this until the Drush issue is resolved, using Greg's comment in #3614 (basically just set the root to If you regenerated your multisite aliases using #3614 then BLT should set the root this way for you. Is any other action required of BLT or can we close this issue? |
So if I'm not mistaken, the work-around means you could only use the alias from the BLT project root at this time, right? So right now, I can call |
@dpagini I'm not sure if I understand your use-case. How can OIC, you currently have the ability to set the cwd to any directory inside the project, not just at the project root. That is what you are referring to, correct? As far as I know, the bug reported here only affects site-install. |
Correct. I mean, BLT sets the CWD for all it's commands, so the "workaround" would work for BLT commands (I think). |
Should BLT not install sites locally identical to how sites are installed by the hosting provider? The change in BLT to use an alias rather than the default @self alias, namely in https://github.com/acquia/blt/pull/3614/files#diff-036b3640d738b718066597b1db31e407R195, was previously found to cause ssh recursion to localhost within the VM and was a deliberate fix in #3231. #3614 is not really an approach that Acquia will be able to support In general, drush aliases are rarely, if ever, used in site-install by design, as this would require aliases to be managed and updated by hosting provider on every site install request or creation of a new multisite, as the use of aliases during site install it would likely mean that no values could be overridden in ~/.drush and site-local drush alias files. This is why --root and --uri and other command line overrides should always be used as a safeguard because on large multisite hosting platforms like Acquia Site Factory for example, the user could theoretically install a site over the default site's database or execute other unauthorized task which could compromise the integrity of the platform. This approach would also require an alias to be committed and updated prior to installing every new site, which creates a fundamental chicken/egg problem for sites/providers where the site name and uri is not known in advance and committed to code. This shift in BLT will also likely result in additional challenges on hosting providers that do not allow write access to the file system, as the --uri used to install or create a production site is almost always different than than the "go live" uri and instead often uses the vendor-provided default uri. For scenarios where a user feels they must use an alias in BLT or other projects, a more scalable and portable solution could be to use dynamic aliases which instead use the current request to populate variables in templates rather than hard-coded config that has to be updated and deployed for values such as --host, --root, --uri. @danepowell and @nateacquia it would be helpful if the BLT team could include testing steps and/or clarify when PRs such as #3614 have not been reviewed or tested on multisite or products like ACSF, as doing otherwise is creating a burden on both users and support/engineering teams. |
I think all of this is just a workaround until someone manages to fix the bug in |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
So I know we are talking about a workaround for this above, but I'm still unclear how this is supposed to work... Our team is not on a standard build (Drupal-VM, Lando, etc).. but let's say I could get every developer on the same hard-coded root for multi-site... I then still have my Travis builds which I'm not sure I can change (maybe I can, but man this is getting complicated). If there's not an immediate fix for drush on the horizon (the issue has been opened for almost 3 months now), is there any chance BLT could consider passing in the root to the site-install command? Is there any downside to that? Presumably BLT knows the site docroot, right? It doesn't have to be for all commands, but just site-install (and just for multisites if we want to go that far). |
I'm not sure I fully understand the issue here, because no one provided clear steps to reproduce on a standard BLT project. Feel free to open a new issue if you can provide steps to reproduce. However is this not a dupe of #3467? |
I don't think this is a dupe. I'll open a new ticket. Thanks @danepowell! |
The lightning profile includes consolidation/site-alias in composer requirements. Apparently, BLT has to change how drush alias files are created.
consolidation/site-alias#18
The text was updated successfully, but these errors were encountered: