Skip to content

Commit

Permalink
Add detailed documentation for --ssh (#462)
Browse files Browse the repository at this point in the history
* Add detailed documentation for --ssh

* Add documentation on advanced config
  • Loading branch information
rmccue committed Sep 5, 2023
1 parent 0f81193 commit 49f74df
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions config.md
Expand Up @@ -306,6 +306,27 @@ Here's an annotated example `wp-cli.yml` file:
# Inherit configuration from an arbitrary YAML file
inherit: prod.yml

## Remote (SSH) configuration

Using the `ssh` option, WP-CLI can be configured to run on a remote system rather than the current system. Along with the SSH protocol, WP-CLI also supports connecting to Docker containers (including docker-compose) and Vagrant VMs.

The connection type can be passed via the scheme of the `--ssh` parameter or `ssh` option.

Supported types are:

* `docker:[<user>@]<container_id>` - Runs WP-CLI in a running Docker container via `docker exec [--user <user>] <container_id> ...`
* `docker-compose:[<user>@]<container_id>` - Runs WP-CLI in a running Docker container via `docker-compose exec [--user <user>] <container_id> ...`
* `docker-compose-run:[<user>@]<container_id>` - Runs WP-CLI in a new Docker container via `docker-compose run [--user <user>] <container_id> ...`
* `vagrant` - Runs WP-CLI in a running Vagrant VM via `vagrant ssh ...`
* `[<user>@]<host>[:<port>]` (ssh) - Runs WP-CLI on a remote machine through an SSH connection via `ssh [-p <port>] [<user>@]<host> ...`

All connection types support an optional `path` suffix to specify a directory to `cd` to before running WP-CLI; `path` is a full system path starting with either `/` or `~`. (If `WP_CLI_SSH_PRE_CMD` is specified, `cd` is run after this pre-command.)

The SSH connection type also supports two advanced connection configuration options, which must be specified via an alias in the YAML configuration:

* `proxyjump` - Specifies a jumpbox connection string, which is passed to `ssh -J`
* `key` - Specifies the key (identify file) to use, which is passed to `ssh -i`

## Environment variables

WP-CLI's behavior can be changed at runtime through the use of environment variables:
Expand Down

0 comments on commit 49f74df

Please sign in to comment.