{"id":15712424,"url":"https://github.com/jigarius/drall","last_synced_at":"2025-09-10T06:35:04.144Z","repository":{"id":41954794,"uuid":"459781858","full_name":"jigarius/drall","owner":"jigarius","description":"A tool to run drush commands on multi-site Drupal installations.","archived":false,"fork":false,"pushed_at":"2025-05-19T16:39:24.000Z","size":598,"stargazers_count":33,"open_issues_count":2,"forks_count":5,"subscribers_count":5,"default_branch":"4.x","last_synced_at":"2025-08-26T03:55:12.637Z","etag":null,"topics":["cli","drupal","drush","php","symfony-console"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jigarius.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"custom":["https://www.paypal.me/jigarius"]}},"created_at":"2022-02-15T23:17:22.000Z","updated_at":"2025-07-14T19:05:53.000Z","dependencies_parsed_at":"2022-09-12T07:42:50.549Z","dependency_job_id":"a5711bb7-a95d-482c-b850-b7ea5f293947","html_url":"https://github.com/jigarius/drall","commit_stats":{"total_commits":159,"total_committers":3,"mean_commits":53.0,"dds":"0.16981132075471694","last_synced_commit":"c6fcab118e15c903d01fb4e78d57f1fbee592937"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/jigarius/drall","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigarius%2Fdrall","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigarius%2Fdrall/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigarius%2Fdrall/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigarius%2Fdrall/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jigarius","download_url":"https://codeload.github.com/jigarius/drall/tar.gz/refs/heads/4.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigarius%2Fdrall/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274422314,"owners_count":25282124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","drupal","drush","php","symfony-console"],"created_at":"2024-10-03T21:16:07.939Z","updated_at":"2025-09-10T06:35:04.133Z","avatar_url":"https://github.com/jigarius.png","language":"PHP","funding_links":["https://www.paypal.me/jigarius"],"categories":[],"sub_categories":[],"readme":"# Drall\n\nDrall is a tool that helps run [drush](https://www.drush.org/) commands\non multi-site Drupal installations.\n\n\u003e One command to *drush* them all.\n\u003e — [Jigarius](https://jigarius.com/about)\n\nA big thanks and shout-out to [Symetris](https://symetris.ca/) for sponsoring\nthe initial development of Drall.\n\n## Preview\n\n![A preview of using Drall](misc/demo.gif)\n\n## Installation\n\nDrall is listed on [Packagist.org](https://packagist.org/packages/jigarius/drall).\nThus, it can easily be installed using `composer` as follows:\n\n    composer require jigarius/drall\n\n## Placeholders\n\nDrall's functioning depends on its _Placeholders_. Here's how Drall works\nunder the hood:\n\n1. Receive a command, say, `drall exec -- COMMAND`.\n2. Ensure there is a `@@placeholder` in `COMMAND`.\n3. Run `COMMAND` after replacing `@@placeholder` with site-specific values.\n4. Display the result.\n\nDrall supports the following placeholders:\n\n### @@dir\n\nThis placeholder is replaced with the name of the site's directory under\nDrupal's `sites` directory. These are the values of the `$sites` array\nusually defined in `sites.php`.\n\n```php\n# @@dir is replaced with \"ralph\" and \"leo\".\n$sites['raphael.com'] = 'ralph';\n$sites['leonardo.com'] = 'leo';\n```\n\n**Note:** In older versions of Drall, this was called `@@uri`.\n\n### @@key\n\nThis placeholder is replaced with keys of the `$sites` array.\n\n```php\n# @@key is replaced with \"raphael.com\", \"raphael.local\" and \"leonardo.com\".\n$sites['raphael.com'] = 'ralph';\n$sites['raphael.local'] = 'ralph';\n$sites['leonardo.com'] = 'leo';\n```\n\n### @@ukey\n\nThis placeholder is replaced with unique keys of the `$sites` array. If a site\nhas multiple keys, the last one is used as its unique key.\n\n```php\n# @@key is replaced with \"raphael.local\" and \"leonardo.local\".\n$sites['raphael.com'] = 'ralph';\n$sites['raphael.local'] = 'ralph';\n$sites['leonardo.com'] = 'leo';\n$sites['leonardo.local'] = 'leo';\n```\n\n### @@site\n\nThis placeholder is replaced with the first part of the site's alias.\n\n```shell\n# @@site is replaced with \"@ralph\" and \"@leo\".\n@ralph.local\n@leo.local\n```\n\n**Note:** This placeholder only works for sites with Drush aliases.\n\n## Commands\n\nTo see a list of commands offered by Drall, run `drall list`. If you feel lost,\nrun `drall help` or continue reading this documentation.\n\n### exec\n\nWith `exec` you can execute drush as well as non-drush commands on multiple\nsites in your Drupal installation.\n\nIn Drall 2.x there were 2 exec commands. These are now unified into a single\ncommand just like version 1.x.\n- `drall exec:drush ...` is now `drall exec -- drush ...`\n- `drall exec:shell ...` is now `drall exec -- ...`\n\n#### Interrupting a command\n\nWhen `drall exec` receives a signal to interrupt (usually `ctrl + c`), Drall\nstops after processing the site that is currently being processed. This\nprevents the current command from terminating abruptly. However, if a second\ninterrupt signal is received, then Drall stops immediately.\n\n#### Drush with @@dir\n\nIn this method, the `--uri` option is sent to `drush`.\n\n```shell\ndrall exec -- drush --uri=@@dir core:status\n```\n\nIf it is a Drush command and no valid `@@placeholder` are present, then\n`--uri=@@dir` is automatically added after each occurrence of `drush`.\n\n```shell\n# Raw drush command (no placeholders)\ndrall exec -- drush core:status\n# Command that is executed (placeholders injected)\ndrall exec -- drush --uri=@@dir core:status\n```\n\n##### Example\n\n```shell\ndrall exec -- drush core:status\n```\n\n#### Drush with @@site\n\nIn this method, a site alias is sent to `drush`.\n\n```shell\ndrall exec -- drush @@site.local core:status\n```\n\n##### Example\n\n```shell\ndrall exec -- drush @@site.local core:status\n```\n\n#### Non-drush commands\n\nYou can run non-Drush commands the same was as you run Drush commands. Just\nmake sure that the command has valid placeholders.\n\n**Important:** You can only use any one of the possible placeholders, e.g. if\nyou use `@@dir` and you cannot mix it with `@@site`.\n\n##### Example: Shell command\n\n```shell\ndrall exec -- cat web/sites/@@uri/settings.local.php\n```\n\n##### Example: Multiple commands\n\n```shell\ndrall exec \"drush @@site.dev updb -y \u0026\u0026 drush @@site.dev cim -y \u0026\u0026 drush @@site.dev cr\"\n```\n\n#### Options\n\nFor the `drall exec` command, all Drall options must be set right after\n`drall exec`. Additionally, `--` must be used before the command to be\nexecuted. Following are some examples of running `drush` with options.\n\n```shell\n# Drall is --verbose\ndrall exec --verbose -- drush core:status\n# Drush is verbose\ndrall exec -- drush --verbose core:status\n# Both Drall and Drush are --verbose\ndrall exec --verbose -- drush --verbose core:status\n```\n\nIn summary, the syntax is as follows:\n\n```shell\ndrall exec [DRALL-OPTIONS] -- drush [DRUSH-OPTIONS]\n```\n\nBesides the global options, the `exec` command supports the following options.\n\n#### --interval\n\nThis option makes Drall wait for `n` seconds after processing each item.\n\n```shell\ndrall exec --interval=3 -- drush core:rebuild\n```\n\nSuch an interval cannot be used when using a multiple workers.\n\n#### --workers\n\nSay you have 100 sites in a Drupal installation. By default, Drall runs\ncommands on these sites one after the other. To speed up the execution, you\ncan ask Drall to execute multiple commands in parallel. You can specify the\nnumber of workers with the `--workers=n` option, where `n` is the\nnumber of processes you want to run in parallel.\n\nPlease keep in mind that the performance of the workers depends on your\nresources available on the computer executing the command. If you have low\nmemory, and you run Drall with 4 workers, performance might suffer. Also,\nsome operations need to be executed sequentially to avoid competition and\nconflict between the Drall workers.\n\n##### Example: Parallel execution\n\nThe command below launches 3 instances of Drall to run `core:rebuild` command.\n\n```shell\ndrall exec --workers=3 -- drush core:rebuild\n```\n\nWhen a worker runs out of work, it terminates automatically.\n\n#### --no-progress\n\nBy default, Drall displays a progress bar that indicates how many sites have\nbeen processed and how many are remaining. In verbose mode, this progress\nindicator also displays the time elapsed.\n\nHowever, the progress display that can mess with some terminals or scripts\nwhich don't handle backspace characters. For these environments, the progress\nbar can be disabled using the `--no-progress` option.\n\n##### Example: Hide progress bar\n\n```shell\ndrall exec --no-progress -- drush core:rebuild\n```\n\n#### --dry-run\n\nThis option allows you to see what commands will be executed without actually\nexecuting them.\n\n##### Example: Dry run\n\n```shell\ndrall exec --dry-run --group=bluish -- drush core:status\n```\n\n### site:directories\n\nGet a list of all available site directory names in the Drupal installation.\nAll `sites/*` directories containing a `settings.php` file are treated as\nindividual sites.\n\n#### Example: Usage\n\n```shell\ndrall site:directories\n```\n\nThe output can then be iterated with scripts.\n\n#### Example: Iterating\n\n```shell\nfor site in $(drall site:directories)\ndo\n  echo \"Current site: $site\";\ndone;\n```\n\n### site:keys\n\nGet a list of all keys in `$sites`. Usually, these are site URIs.\n\n#### Example: Usage\n\n```shell\ndrall site:keys\n```\n\nThe output can then be iterated with scripts.\n\n#### Example: Iterating\n\n```shell\nfor site in $(drall site:keys)\ndo\n  echo \"Current site: $site\";\ndone;\n```\n\n### site:aliases\n\nGet a list of site aliases.\n\n#### Example: Usage\n\n```shell\ndrall site:aliases\n```\n\nThe output can then be iterated with scripts.\n\n#### Example: Iterating\n\n```shell\nfor site in $(drall site:aliases)\ndo\n  echo \"Current site: $site\";\ndone;\n```\n\n## Global options\n\nThis section covers some options that are supported by all `drall` commands.\n\n### --group\n\nSpecify the target site group. See the section *site groups* for more\ninformation on site groups.\n\n```shell\ndrall exec --group=GROUP -- drush core:status --field=site\n```\n\nIf `--group` is not set, then the Drall uses the environment variable\n`DRALL_GROUP`, if it is set.\n\n### --filter\n\nFilter placeholder values with an expression. This is helpful for running\ncommands on specific sites.\n\n```shell\n# Run only on the \"leo\" site.\ndrall exec --filter=leo -- drush core:status\n# Run only on \"leo\" and \"ralph\" sites.\ndrall exec --filter=\"leo||ralph\" -- drush core:status\n```\n\nFor more on using filter expressions, refer to the documentation on\n[consolidation/filter-via-dot-access-data](https://github.com/consolidation/filter-via-dot-access-data).\n\n### --offset\n\nAn integer indicating the number of items to skip from the beginning. If a\nnegative integer is provided it is treated as `n - o`, where `n` is the total\nnumber of items and `o` is the offset.\n\n```shell\n# Skip the first 2 items.\ndrall exec --offset=2 -- drush core:status\n# Start at the 2nd item from the end.\ndrall exec --offset=-2 -- drush core:status\n```\n\n### --limit\n\nAn integer indicating the number of items to process.\n\n```shell\n# Stop after the first 2 items.\ndrall exec --limit=2 -- drush core:status\n# Skip the first 2 items and process 3 items thereafter. Thus, only items\n# 3, 4, 5 are processed.\ndrall exec --offset=2 --limit=3 -- drush core:status\n```\n\n### --silent\n\nDisplay no output.\n\n### --quiet\n\nDisplay very less output.\n\n### --verbose\n\nDisplay verbose output.\n\n### --debug\n\nDisplay very verbose output.\n\n## Auto-detect sites\n\nDrall uses `sites.php` to determine site hostnames and site directories.\nHowever, some Drupal multi-site installations do not have a `sites.php`\nbecause the content of the `DRUPAL/sites` directory changes very frequently,\nthereby making it difficult to maintain such a `sites.php`.\n\nIn such cases, it is suggested that you create a `DRUPAL/sites/sites.php`\nbased on [misc/example.sites.php](misc/example.sites.php) so that Drall can\ndetect the sites in your Drupal installation. Additionally, in this file you\ncan alter the `$sites` variable based on your requirements.\n\n## Site groups\n\nDrall allows you to group your sites so that you can run commands on these\ngroups using the `--group` option.\n\n### Drall groups with site aliases\n\nIn a site alias definition file, you can assign site aliases to one or more\ngroups like this:\n\n```yaml\n# File: tnmt.site.yml\nlocal:\n  root: /opt/drupal/web\n  uri: https://tmnt.com/\n  # ...\n  drall:\n    groups:\n      - cartoon\n      - action\n```\n\nThis puts the alias `@tnmt.local` in the `cartoon` and `action` groups.\n\n### Drall groups with sites.*.php\n\nIf your project doesn't use site aliases, you can still group your sites using\none or more `sites.GROUP.php` files like this:\n\n```php\n# File: sites.bluish.php\n$sites['donnie.drall.local'] = 'donnie';\n$sites['leo.drall.local'] = 'leo';\n```\n\nThis puts the sites `donnie` and `leo` in a group named `bluish`.\n\n## Development\n\nHere's how you can set up a local dev environment.\n\n- Clone the `https://github.com/jigarius/drall` repository.\n  - Use a branch as per your needs.\n- Run `docker compose up -d`.\n- Run `docker compose start`.\n- Run `make ssh` to launch a shell in the Drupal container.\n- Run `make provision`.\n- Run `drall --version` to test the setup.\n- Run `make lint` to run linter.\n- Run `make test` to run tests.\n\nYou should now be able to `make ssh` and then run `drall`. A multi-site Drupal\ninstallation should be present at `/opt/drupal`. Oh! And Drall should be\npresent at `/opt/drall`.\n\n### Hosts\n\nTo access the dev sites in your browser, add the following line to your hosts\nfile. It is usually located at `/etc/hosts`. This is completely optional, so\ndo this only if you need it.\n\n    127.0.0.1 tmnt.drall.local donnie.drall.local leo.drall.local mikey.drall.local ralph.drall.local\n\nThe sites should then be available at:\n- [tmnt.drall.local](http://tmnt.drall.local/)\n- [donnie.drall.local](http://donnie.drall.local/)\n- [leo.drall.local](http://leo.drall.local/)\n- [mikey.drall.local](http://mikey.drall.local/)\n- [ralph.drall.local](http://ralph.drall.local/)\n\n## Acknowledgements\n\n- Thanks, [Symetris](https://symetris.ca/) for funding the initial development.\n- Thanks, [Jigarius](https://jigarius.com/about) (that's me) for spending\n  evenings and weekends to make this tool possible.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjigarius%2Fdrall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjigarius%2Fdrall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjigarius%2Fdrall/lists"}