Helps running commands on remote hosts accesible via ssh
composer global require rimi-itk/remote-commands
eval "$(remote-drupal-drush --completion)"
@TODO
Run
bin/remote-command --help
All configuration of hosts is done in your OpenSSH client configuration file
(~/.ssh/config
).
Assuming the following configuration is set in ~/.ssh/config
# https://man.openbsd.org/ssh_config#IgnoreUnknown
IgnoreUnknown DRUPAL_*,SYMFONY_*
Host drupal.example.com
…
DRUPAL_DRUSH_ROOT /data/www/drupal/htdocs/web
DRUPAL_DRUSH_DRUSH ../vendor/bin/drush
DRUPAL_DRUSH_URI https://drupal.example.com
…
# Example with docker-compose
Host drupal.example.com
…
DRUPAL_DRUSH_DRUSH docker-compose --env-file .env.docker.local --file docker-compose.server.yml exec phpfpm vendor/bin/drush
# The directory to change to before running the drush command
DRUPAL_DRUSH_CWD /data/www/drupal/htdocs
# Drush root inside docker container
DRUPAL_DRUSH_ROOT /app
…
Host symfony.example.com
…
SYMFONY_CONSOLE_ROOT /data/www/symfony/htdocs
…
# Example with docker-compose
…
SYMFONY_CONSOLE_ROOT /data/www/symfony/htdocs
SYMFONY_CONSOLE_CONSOLE itkdev-docker-compose-server exec phpfpm bin/console
then running remote-command drupal:drush drupal.example.com
will be equivalent
to running ssh -t drupal.example.com drush --root=/data/www/drupal/htdocs --uri=https://drupal.example.com
.
remote-drupal-drush
is a shortcut forremote-command drupal:drush
remote-symfony-console
is a shortcut forremote-command symfony:console
If you're using the bash
shell, run
echo 'export PATH="'$(git rev-parse --show-toplevel)/bin:$PATH"' >> ~/.bashrc
to add the commands to your PATH
. If you're running zsh
, run
echo 'export PATH="'$(git rev-parse --show-toplevel)/bin:$PATH"' >> ~/.zshrc