To use Drupal VM with a Drupal project that is generated with Acquia BLT:
- Download the Drupal VM dependencies listed in Drupal VM's README. If you are running Homebrew on macOS, you can use the following commands:
brew tap caskroom/cask brew install php71 git composer ansible drush brew cask install virtualbox vagrant
-
Create and boot the VM:
blt vm
-
Commit all resulting files, including
box/config.yml
andVagrantfile
.git add -A git commit -m <your commit message>
-
Install Drupal and complete your Acquia BLT installation:
vagrant ssh blt setup
-
Sign in to Drupal:
drush uli
You can make other changes if you choose to match the Acquia Cloud server configuration more closely. See Drupal VM's example configuration changes in Drupal VM's examples/acquia/acquia.overrides.yml
file.
Subsequently, you should use vagrant
commands to interact with the VM. Do not re-run blt vm
. For instance, use vagrant up
to start the VM, and then run vagrant halt
to stop it.
With a Drupal VM installation, Acquia BLT expects all commands (with the exception of commands in the blt vm
namespace), to be executed in the VM. To SSH into the VM, run vagrant ssh
as you did in the "Install Drupal" previous step.
Drupal VM and Behat tests
The Drupal Extension for Behat has an inherent limitation: it cannot use the 'drupal' driver to bootstrap Drupal on a remote server. If you're using Drupal VM and would like to execute Behat tests using the 'drupal' driver, you must execute them from within the VM. This is a break of the established pattern of running all BLT commands outside of the VM.
To execute Behat tests using the 'drupal' driver on a Drupal VM environment, you must do the following:
- SSH into the VM
vagrant ssh
- Execute behat tests
blt tests:behat:run
Alternately, you may choose to write only behat tests that utilize the Drupal Extension's "drush" driver. Doing this will allow you to run blt tests:behat:run
from the host machine.