drall
drall copied to clipboard
Use --drall-group=prod with only drush aliases files and no sites.*.php
Problem Statement
In a multisite Drupal 10 setup, when executing drall
from a developer's local environment, I want a way to execute remote drush commands for all sites in a specific server environment via drush aliases *.sites.yml files.
Example Use Case
Get super user password reset links for all PROD sites.
drall --drall-group=prod exec drush uli
Expected Results
A list of password reset links for each domain grouped into the "prod" drall group via drush aliases *.sites.yml files.
Actual Results
Got error output:
In SitesFile.php line 37:
Cannot read sites file: /var/www/html/docroot/sites/sites.prod.php
Steps to reproduce:
-
Drupal 10 multisite.
-
Drush aliases files for each site, each with entries for local, dev, test, and prod environments.
drush/sites/site1.site.yml
local: root: /var/www/html/docroot uri: https://site1.example.local paths: config-sync: /var/www/html/config/site1/sync drall: groups: - local dev: uri: https://www.dev.site1.example.com host: devserver.example.com user: username drall: groups: - dev test: uri: https://www.dev.site1.example.com host: testserver.example.com user: username drall: groups: - test prod: uri: https://www.dev.site1.example.com host: prodserver.example.com user: username drall: groups: - prod
-
A single sites.php file with each domains pointing to its appropriate directory name.
Note: It is critical to have all domains pertaining to a single site in one single file, as opposed to creating different files for each environment sites.local.php sites.dev.php sites.test.php sites.prod.php). Furthermore, we cannot depend on sites.prod.php because our PROD environment supports various subdomain clones like
www.site1.example.com
site1.oembed.example.com
site1.example.com
site1.com
.
Proposed resolution
Before erroring out due to missing sites.GROUP_NAME.php file also scan all drush site aliases files containing drall groups defined that match the GROUP_NAME.