Automating deployments across many sites
When leveraging multisite, it is important to consider automation. Updating every site in a large-scale Drupal multisite implementation would be difficult, especially given the frequency with which updates happen.
Drush provides helpful commands to manage this.
$ drush site:alias > list-of-sites.txt
The preceding command prints a list of site aliases for a Drupal application (https://www.drush.org/12.x/commands/site_alias/).
$ while read s; do \ drush sql-dump > backup-$s.sql \ drush "@$s" deploy \ done <list-of-sites.txt
This small script takes the results of each alias from the previous command and performs a deployment. While it is a simple example, a script could then invoke rollback logic upon error.
$ if grep -Fxq "error" list-of-sites.txt \ then \ while read s; do \ drush "@$s" sql-import -y < backup-$s.sql \ done <list-of-sites.txt \ fi
It is highly recommended that you stage...