8. Hosting API docs
WPMU DEV is dedicated to supporting advanced users in every possible way. Our Hosting API Documentation is an ongoing project. Information about new commands will be added here as it becomes available.
8.1 WP-CLICopy chapter anchor to clipboard
WP-CLI is the command-line interface for WordPress. You can update plugins, configure multisite installations and much more, without using a web browser. WPMU DEV hosting has an integration module with WP CLI, which will allow you to simplify a few common tasks.
wp hosting clearcache [type] [URI]
Clears all of the Static Cache.
wp hosting clearcache static
Clears the Static Cache of the given URI.
wp hosting clearcache static /sample-page/
Clears the Static Cache of the homepage.
wp hosting clearcache static /
Clears the Object Cache.
wp hosting clearcache object
Clears both the Static Cache and the Object Cache.
wp hosting clearcache all
8.2 SSHCopy chapter anchor to clipboard
The following SSH commands are available to members for all WPMU DEV hosted sites.
View hosting access logs in terminal
View logs for the current day only.
View logs for the last 7 days.
This enables you to access the access.log in a live manner, and since the logs themselves are hard to read, it’ll split up various stats.
Note that for the view command, you will need to press q to exit the shell, not ctrl+c like some linux users do.
View hosting access logs as a static file
Inlcude logs for the current day only.
Include logs for the last 7 days.
This command will create an .html file in the wp-content directory with all the same info as seen when using the view command above.
Note that both of these reports will be for the current day from UTC 00:00 until the time you fire the command.
8.3 CI/CDCopy chapter anchor to clipboard
Continuous integration (CI) and continuous delivery (CD) is supported by WPMU DEV to help you automate delivery of assets to your hosting droplets. Please be sure to review our Allowed & Disabled Functions & Commands document before proceeding.
Bitbucket Pipelines fires an Docker Instance and runs the commands in this instance. So every command sequence that the user can run manually via SSH can be automated in a Pipeline. More about Pipelines here.
You will need SSH access with a Public Key without password so the Pipeline can access it programmatically. You need to create the user under the Hosting > SSH/SFTP tab of your site in your Hub. After that, add the Private/Public Key as well the Host Fingerprint to the Repository Settings in Bitbucket > Repository Settings > SSH Keys, under Pipelines.
This example will run an rsync from the repository to the droplet specified in the SERVER variable using the pipe rsync-deploy. After that it will run a command to clear the server static cache.
Github Actions fire a Linux container and runs the commands in this instance. So every command sequence that the user can run manually via SSH can be automated in an Action. More about Github actions here.
You will need SSH access with Public Key without password so the Action can access it programmatically. You need to create the user under the Hosting > SSH/SFTP tab of your site in your Hub. After that you need to add the secrets variables to Repository Settings > Secrets > Actions. We will use the following secrets:
SSH_PRIVATE_KEY: containing the private key
SSH_KNOWN_HOSTS: host fingerprint
SSH_USER: ssh username
SSH_HOST: ssh destination host
This example will run an rsync from the repository to the droplet. After that it will run a command to clear the server static cache. This action will run on every push.