Skip to main content

Drush

https://www.drush.org/

Drush is a command line shell and Unix scripting interface for Drupal. Drush core ships with lots of useful commands and generators. Similarly, it runs update.php, executes SQL queries, runs content migrations, and misc utilities like cron or cache rebuild. Drush can be extended by 3rd party commandfiles.

Drush is used throughout Vortex to interact with Drupal from the automation scripts and Behat tests.

It also allows a developer to interact with the site via CLI during development.

While all the standard Drush commands supported, Vortex also provides some shorthand commands to abstract some of the common tasks:

  • fetching the database dump from the remote environment
  • importing the database dump into the local environment
  • running database updates and clearing caches

➡️ See Development

Usage

Drush should be used from the inside of the container.

ahoy drush <command>

PHP runtime configuration

Vortex allows you to customize PHP runtime settings for PHP CLI processes, including Drush commands, by editing the drush/php-ini/drush.ini file.

This file is auto-discovered via the PHP_INI_SCAN_DIR environment variable, which is pre-configured in both the Docker CLI container and Acquia deployment hooks. Every PHP CLI process that loads this scan path picks the file up, not only Drush.

Any valid PHP ini directive can be added to this file to adjust the runtime behavior of those processes.

note

The leading colon in the PHP_INI_SCAN_DIR value preserves the default scan directories. On Acquia, this ensures that the hosting provider's own PHP ini overrides (such as sendmail_path) are not lost.

Memory limit

The shipped configuration raises the PHP memory limit above the platform default:

; drush/php-ini/drush.ini
memory_limit = 1G

This value is sized for database imports and configuration synchronization on large sites. It applies to PHP CLI processes that load this scan path, including Drush, and does not change the memory limit used to serve web requests.

If a Drush command exhausts this limit, profile the command before raising the value. An exhausted 1G limit usually points to a memory leak in custom code rather than a limit set too low, and raising the ceiling hides the leak until a larger dataset reaches the new limit.

To grant more memory to a single command without changing the default:

ahoy cli php -d memory_limit=2G vendor/bin/drush <command>

Aliases

For Lagoon hosting, Drush site aliases are automatically generated for each environment and can be used either from the host machine or from within the container.

  1. Make sure your SSH key is loaded in your ssh-agent:
ssh-add ~/.ssh/path/to/key
  1. Run Drush commands using the Lagoon site aliases:
drush @lagoon.develop status # Show status of the develop environment
drush @lagoon.pr-123 ssh # SSH into the web container of the PR-123 environment