Documentation
Servd Plugin Console Commands
Here's some of the Craft console commands that the Servd plugin makes available:
Clearing the Servd Static Cache #
If you'd like to clear the entire Servd static cache for your project's environment, run the following:
./craft clear-caches/servd-static-cache
Running a Craft Console Command #
From v3.5.3 of the Servd plugin, you can run Craft console commands in one of your Servd environments:
./craft servd-asset-storage/command "<your command>"
This command will try it's best to auto-detect all of the settings they need, even before the plugin has been fully configured within Craft. If it cannot identify specific settings it will prompt you for them, or you can supply them via CLI flags:
./craft servd-asset-storage/command "<your command>" --environment=staging --servdSlug=my-project-slug --servdKey=my-servd-key --wait=0 --interactive=0
A few things to note:
- You don't need to add ./craft to the start of the command you wish to run, but the plugin will handle it if you do.
- If the command you're running has several arguments and you're finding that they're not being passed through, we'd recommend wrapping the command in double quotes to avoid them being interpreted the ./craft servd-asset-storage/command command itself.
Cloning Remote Environments #
From v3.4.10 of the Servd plugin, you can trigger clones between your staging, development and production environments using the following command:
./craft servd-asset-storage/clone
This command will try it's best to auto-detect all of the settings they need, even before the plugin has been fully configured within Craft. If it cannot identify specific settings it will prompt you for them, or you can supply them via CLI flags:
./craft servd-asset-storage/clone --from=production --to=staging --servdSlug=my-project-slug --servdKey=my-servd-key --database --assets --bundle --newEnvVars --wait --interactive=0
Syncing Local Assets #
You can sync your assets from local to staging, development, and production, or from staging, development and production to local. If you are using remote storage during local development (the default) this will simply trigger a clone task to copy the asset files between directories in the Servd Asset Platform. If you have Use Local Volumes During Dev enabled this will sync assets between your local filesystem and the specified remote storage directory.
You can trigger asset syncs using the following commands:
./craft servd-asset-storage/local/pull-assets
./craft servd-asset-storage/local/push-assets
These commands will try their best to auto-detect all of the settings they need, even before the plugin has been fully configured within Craft. If it cannot identify specific settings it will prompt you for them, or you can supply them via CLI flags:
./craft servd-asset-storage/local/pull-assets --from=staging --servdSlug=my-project-slug --servdKey=my-servd-key --interactive=0
./craft servd-asset-storage/local/push-assets --to=production --servdSlug=my-project-slug --servdKey=my-servd-key --interactive=0
Syncing Local Databases #
You can pull down a database from Servd or push up your local database at any time using the commands:
./craft servd-asset-storage/local/pull-database
./craft servd-asset-storage/local/push-database
These commands will try their best to auto-detect all of the settings they need, even before Craft has been installed. If it cannot identify specific settings it will prompt you for them, or you can supply them via CLI flags:
./craft servd-asset-storage/local/pull-database --from=staging --servdSlug=my-project-slug --servdKey=my-servd-key --skipBackup=1 --interactive=0
./craft servd-asset-storage/local/push-database --to=production --servdSlug=my-project-slug --servdKey=my-servd-key --interactive=0
Please note that while a database is being pushed to a Servd, the target environment is likely to become unresponsive if the Atomic Database Imports setting is disabled.