CLI support: Drush
You can use Drush on your DRD site to execute any of the available actions. And second, if Drush is available on your remote hosts, you can utilize it by DRD as well.
To run the CLI on your DRD, just call its built-in help function (drush --help
) to get a list of all the available commands, including those from DRD. To get help on how to execute a specific DRD command, simply use drush drd-[COMMAND] --help
.
For most of the actions you can select on which hosts, cores or domains it will be executed. You'll see these options:
$ drush drd:ping --help
Ping remote domain(s).
Options:
--tag[=TAG] Tag name
--host[=HOST] Host name
--host-id[=HOST-ID] Host ID
--core[=CORE] Core name
--core-id[=CORE-ID] Core ID
--domain[=DOMAIN] Domain name
--domain-id[=DOMAIN-ID] Domain ID
With the options host-id
, core-id
and domain-id
you can select entities by their ID, i.e. if you are executing an action on domains and use --host-id=1
then the CLI tool will find all domains on the given host and execute the action there.
With the options host
and core
you can select the host or core by their name and with domain
you can select the domain entity by their domain name, e.g. --domain=www.example.com
. When both, the id-based options and the name-based options are given, then the IDs are used, and the names get ignored.
Also, you can select entities by taxonomy terms with the option tag
. This is only used if none of the other select options are used and the related hosts, cores and domains inherit tags from each other. This means, if you have a core with the tag important
and you then call drush drd:ping --tag=important
, this will be executed on all domains of all cores with that tag. Tag inheritance works upstream and downstream, so if an action is looking for hosts, it will also find those where one of their domains has a given tag.
Pro Tip: Testing the select options is best possible with the DRD list actions for hosts, cores and domains, drd:list:hosts
, drd:list:cores
and drd:list:domains
. They all support the same options and use the same services to actually perform the selection. By default, the output is a compact table, but you can change the format with the general command options provided by the CLI of your choice. Example:
$ drush drd:list:domains --tag=important --format=json
This will output all domains with the important
tag in json format.
For the second part of this, utilizing one of the CLIs remotely, you can edit your hosts and provide the full path to one or both of the CLIs there:
What this allows you to do is when adding a new core, that DRD uses the remote CLI to enable DRD Agent for all domains and configures them automatically. Otherwise, you would have to enable that for each domain manually.
In a future version, we will also support the execution of any Drush command on remote domains, that's on the roadmap.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion