Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
Fixes #1215: Document alternative method of running Drupal Console co…
Browse files Browse the repository at this point in the history
…mmands.
  • Loading branch information
geerlingguy committed Mar 13, 2017
1 parent c9a1704 commit 5a86ff7
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion docs/extras/drupal-console.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ vagrant@drupalvm:/var/www/drupalvm/drupal/web$ drupal cache:rebuild all
The command was executed successfully!
```

## Remote command execution
## Remote command execution using `--target`

To run commands on your host computer but execute them on the VM, add a new sites file `~/.console/sites/drupalvm.yml` on your host computer:

Expand All @@ -38,3 +38,23 @@ Execute from host machine using the `--target` option.
For more details, see [Drupal Console's documentation](https://hechoendrupal.gitbooks.io/drupal-console/content/en/using/how-to-use-drupal-console-in-a-remote-installation.html)

For a list of available role variables, see the [`geerlingguy.drupal-console` Ansible role's README](https://github.com/geerlingguy/ansible-role-drupal-console#readme).

## Remote command execution using `vagrant-exec`

You can use [`vagrant-exec`](https://github.com/p0deje/vagrant-exec) to execute commands remotely through Vagrant, and if you can't get Console to work with `--target`, you might want to try doing this (it's more convenient than logging into the VM just to run a Drupal VM command!).

First, install the plugin:

vagrant plugin install vagrant-exec

Add the following to a `Vagrantfile.local` in your project (set `directory` to your drupal docroot):

```ruby
if Vagrant.has_plugin?('vagrant-exec')
config.exec.commands '*', directory: '/var/www/drupal'
end
```

Now you can execute any Drupal Console command—even interactive ones!—from the host:

vagrant exec bin/drupal generate:module

0 comments on commit 5a86ff7

Please sign in to comment.