-
Notifications
You must be signed in to change notification settings - Fork 17
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
How do I set my Drupal site URI in Lando for easy Drushing? #121
Comments
There is already this page, or do you think it should be expanded? |
@gitressa yep that doc has it and also a significant amount of other info. The goal here is to pull that out (leave it where it is too) as a very specific |
Thanks for clarifying @serundeputy. I just discovered another and slightly shorter way of setting the Drupal site URI:
Compared to this:
I wonder if there are reasons to use one over the other? |
To answer my own question, it appears that defining Drush URI via
The result is http://default/user/reset/1/1586688025/TOp-0F....XxQ/login |
I'd prefer the env variable approach, it seems cleaner and more intentional |
Yes, and it's the one that will actually work inside another |
it can be useful if modified in creative way . |
https://github.com/lando/lando/issues/2080#issuecomment-603511033
Yes! From the Lando homepage, the point is to "Save time, headaches, frustration and do more real work." In that spirit I feel there should be complete real-world working examples for both Drush 8 and Drush 9+. It's worth noting the current docs are written for Drush 8 and below (yet link to Drush 10 alias examples). Also Drush 9/10 use My Use CaseI'm working to deploy my first Drupal 8.8 site using composer, with Drush 9. My experience setting up Drush aliases has been, erm, $#%@ difficult. 😬 I have previous Drupal/Drush experience, but Lando Drush aliases setup has been particularly confusing to me. I'm also new to Drupal 8 and trying to figure out what Lando (docker) is doing behind the scenes. My Experience with Lando DocsIt took me many multiple reads of the Lando Drush config docs before I understood what is meant by a How To DebugThe difficult thing for me has been trying to discover/debug the $PATH that Drush uses in order to figure out where to put the (alias settings) file, especially in the case of installing a local version of drush with composer, yet lando also installs a global version as part of the recipe. Its a tangled web. Anyway, that's my two cents. Hope I didn't come across as rude. Don't hate me... just trying to share what I feel could be improved (in the upcoming guide). 🥰 |
@mdrmike ill be honest i dont really understand what you are saying in most of the above comment. @dustinleblanc @serundeputy there are two new things to consider here
tooling:
drush:
service: appserver
cmd: drush
env:
DRUSH_OPTIONS_URI: mysite.lndo.site
proxy:
appserver:
- hostname: object-format.lndo.site
port: 80
pathname: /
middlewares:
- name: test
key: headers.customrequestheaders.X-Lando-Test
value: on
- name: test-secured
key: headers.customrequestheaders.X-Lando-Test-SSL
value: on I think this gives some more flex on what we can do including perhaps finally setting proxy:
appserver:
- hostname: site.lndo.site
port: 80
pathname: /
primary: true and have that imply |
@pirog Ha! Sorry. I was confused with the issue and some terms when I commented. I was piling on with detailed explanation. My comment was an attempt to show where I had problems with the config docs and make the case for why its important to have beginning-to-end examples, both a basic and complex example. But I think that's the intention of guides. Right? Also, the words |
Is there a solution for this that would work in a multi-site setup? Maybe that is the proxy option? It's not 100% clear to me how that connects. |
@markdorison when dealing with Drupal multisite, I don't see a way around passing -l with every drush command unless you add multiple tooling commands that string it on to drush itself. Its been ages since I had to work on a multi-site, but I remember having to do that to run things |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues. |
Thanks Stalebot, but this issue is still relevant. |
One other consideration here is ports. Drush needs the correct port to be passed to DRUSH_OPTIONS_URI and unless it’s hard-coded in .lando.yml the port could be different depending on what lando grabs when it starts up the site. I’m currently struggling with this trying to run lando and docksal in parallel (not forever, hopefully…). |
If this helps anybody else, I've had success modifying my Landofile to explicitly set This has let me run multiple sites simultaneously with Lando and Drush support with a recipe that looks like: recipe: pantheon
config:
framework: drupal8
name: my-site
tooling:
drush:
service: appserver
cmd: 'drush --root=/app/web --uri=http://localhost:49426' You can generate this URI programmatically after the container is built with a script similar to: lando_uri=$(lando info --filter service=appserver_nginx --path 0.urls.1 | tr -d "'")
{
printf "tooling:\n"
printf " drush:\n"
printf " service: appserver\n"
printf " cmd: 'drush --root=/app/web --uri=%s'\n" "$lando_uri"
} >> "$site_landofile" A few notes:
|
This appears to be working for me. tooling:
drush:
service: appserver
cmd: /bin/sh -c "drush --root=$LANDO_WEBROOT --uri=https://$LANDO_APP_NAME.lndo.site $@" "$0" |
I'm struggling with the port as well when running pygmy in parallel with Lando. Pygmy just hijacks 80 and 443 but Lando is more graceful and works around this to run on a different port however it is not always the same port so hardcoding the Is there anyway to grab the port Lando is currently using? (hai @dustinleblanc 👋 😬) |
@soniktrooth Lando has a set of configurable fallback ports: https://docs.lando.dev/core/v3/proxy.html#configuration I'm not sure how the fallback works, but if it's not consistent on your machine, I'm guessing you could choose a single fallback and set that in your global Lando settings. |
Thanks @reynoldsalec that will help me I think. Would be nice if the port being used was exposed as a variable somehow so it could be referenced but I'm sure the feature request pile is high so I will take this as a win. |
As a follow up to lando/lando#447, we should write up a guide on how to modify Drush options within Lando to make
uli
use the correct domain so that users can make their Lando setup just that much nicer.The text was updated successfully, but these errors were encountered: