• Home
  • Contact
vagrant-exec.png

Executing Drupal Console commands on a project with DrupalVM using vagrant-exec plugin

Jesus Manuel Olivas
March 13, 2017

I am currently working on a project where we are using DrupalVM as composer dependency.

Since ssh into the VM machine to execute commands could be a little cumbersome, and providing a site configuration file to take advantage of the --target option to execute commands remotely was not an option, because the generate commands can not be executed remotely if you want to use the interactive mode.

My options got narrowed to execute vagrant ssh and run commands within the VM (which I already mentioned I am not a big fan) or take advantage of the vagrant-exec plugin.

I decided to give a try to the vagrant-exec plugin and this what you need to do to use it in your project when DrupalVM is required via composer.

Install plugin

Execute plugin install command.

loading...

Plugin configuration

Create or update your config/Vagrantfile.local file with the following configuration:

loading...

Execute command using plugin

loading...

After this easy steps you can now execute DrupalConsole or any other shell commands against the VM without the need to shh into the machine.

Ready to embrace the JAMstack revolution?

Build fast and secure sites and apps delivered by pre-rendering files and serving them directly from a CDN, removing the requirement to manage or run web servers, databases and worry about traffic spikes.
Work with us!