Documentation

Using the Servd Plugin Locally

The plugin contains several features which aim to make local development a smoother process and save you time.

Use Local Volumes During Dev #

You can force the use of local volumes when working outside of Servd to make development work a little quicker.

Craft 3

To do so with Craft 3, just flip the Use Local Volumes During Dev switch in the plugin settings. This will convert all Servd Asset Volumes into Local Volumes during local dev, but keep them unchanged when running inside Servd itself. This setting also ensures that the Local Volume override does not leak into any Project Config files or database data which might inadvertently break the staging or production environment.

This setting is very useful if you have multiple developers working on a single project and they all need to keep track of their own sets of assets. It also ensures that assets used during local development do not count towards your Servd Asset Platform usage total.

This setting ignores the Assets Volume Environment setting (see Forcing a Specific Environment above) and will be applied regardless of any value added there.

Craft 4+

To use local copies of assets with Craft 4 and above, we recommend using "Local Folder" asset filesystems when in local development, and "Servd Asset Storage" asset filesystems in your Servd environments.

This can be done by setting the "Asset Filesystem" field of your asset volumes to environment variables, where the value of the environment variable is the "Local Folder" asset filesystem handle locally, and the "Servd Asset Storage" asset filesystem handle in your Servd environments.

Afterwards, you may want to enable the Enable Local Filesystem Links Servd plugin setting to define the mapping between each of your Servd Asset Storage filesystems and their corresponding Local Folder filesystems. Doing so will allow the ./craft servd-asset-storage/local/pull-assets and ./craft servd-asset-storage/local/push-assets commands to download asset files stored in your Servd project's asset bucket down to your local environment, and vice versa.

Database and Asset Syncing #

The Servd plugin comes with a bunch of useful console commands that can let you

  • Pull the contents of a remote Servd database into your local database.
  • Push the contents of your local database to a remote Servd database.
  • Pull assets from a remote Servd environment into your local project.
  • Push the assets from your local project up to a remote Servd environment.

To read more about them, check out the Console Commands documentation.