[UPDATE: as of 2022.01.13, Flywheel supports remote aliases without taking the extra steps detailed below.]
One of the most indispensable tools that I use to manage the fleet of client websites I oversee is WP CLI, a command-line interface for WordPress. Clients whose websites I maintain are hosted on Flywheel (recently purchased by WP Engine). Flywheel’s hosting environment is optimized for WordPress websites and until recently did not have a means to remotely log into the server except through SFTP. They now have what they call an “SSH gateway,” and it mimics much (though not all) of the functionality of a traditional UNIX shell environment.
One of the more useful features of WP CLI is the ability to execute commands on remote servers. Due to non-standard properties of Flywheel’s SSH gateway, running remote WP CLI commands didn’t work. I wrote to Flywheel Support, and Emerson Carter provided these two snippets of code.
Installation instructions:
- Install
flywheel.php
in your~/.wp-cli
folder. - Edit
flywheel.php
to include your Flywheel host(s). - Modify
~/.wp-cli/config.yml
(or other appropriate WP CLI configuration file) to requireflywheel.php
.
The formatting of the output of WP CLI commands is a little wonky, but it works well enough.