Drall: One Command to Drush Them All

If you are facing the challenge of running Drush commands on all/multiple sites in the Drupal installation, Drall could help you and make the process much easier. This blog post is written by one of the best symetris drupal experts. In the following, you can find out how to install Drall and how to use it.

Having discussed this issue with the innovations team at Symetris, I decided to write an open-source tool named Drall which would make it easier to run Drush commands on multi-site Drupal installations.

Drall: A Great Contribution to the Drupal Community

Before deciding to build Drall, I looked for the existence of other similar utilities. However, I couldn’t find a standard, reusable solution. Many developers have tried addressing this issue by writing custom scripts, but such scripts often differ from project to project and from developer to developer. Thus, I felt that a standard, reusable tool like Drall could help the Drupal community.

How to Install Drall? 

Drall can easily be installed with Composer just like several other PHP tools.

composer require jigarius/drall;

 

2 Ways of Using Drall?

Now that Drall is installed, here are the two common ways of using it. There are other not-so-commonly-used commands in Drall, but they’ve been omitted from this article to keep things simple. You can read about them on the Drall’s GitHub repository.

1- Exec:drush (exd)

This is the big command that Drall brings to the table. It allows you to run the same drush command on all or multiple websites.

drall exec:drush core:rebuild
# Equivalent to drall exec:drush --uri=@@uri core:rebuild

This executes the drush core:rebuild command on all sites defined in the project’s sites.php file.

Site aliases

If you have site aliases defined in your site, you can use the @@site placeholder to run commands on multiple sites. For example,

drall exec:drush @@site.dev core:rebuild

2- Exec:shell (exs)

The exec:drush command allows you to run a single Drush command. What if you wanted to run multiple commands or run non-drush commands? To solve this problem, the exec:shell command was introduced in Drall 2.x.
Here’s how you can run multiple drush commands with drall exec:shell.

drall exec:shell “drush –uri=@@uri config:import -y && drush –uri=@@uri core:rebuild;”

Cool, isn’t it? Note how multiple commands were wrapped in double quotes. With shell:exec you can also run non-drush commands.

drall exec:shell cat web/sites/@@uri/settings.local.php

Conclusion

Drall makes it easier to run drush as well as non-drush commands on all or multiple sites in a multi-site Drupal installation. Also, it is easy to install and update, thanks to Composer. That said, there are some very cool features in Drall’s pipeline, so don’t forget to star/follow the Drall repository on GitHub. Don’t forget about Drall while working on your next multi-site Drupal installation!


I hereby thank Symetris for sponsoring the initial development of Drall.