Cloning an Environment
Servd's clone environment tool lets you copy over data and config from one environment to another (e.g. from staging to production).
Tip: It can help a bunch once your project is all set up on staging and ready to be pushed to production.
Cloning from Staging, Development and Production #
Here are a few steps for cloning environments that are hosted on Servd:
In the "Clone From Environment" section, select the environment you want to import from, i.e. your "source" environment.
Select one or more of the import options:
- Import assets - Sync all assets stored in your source environment's directory on the Servd CDN with the target environment directory. Note: this will delete any assets in the target directory that aren't present in the source directory.
- Import database - Replace the target environment database with the contents of the source environment database.
- Import and deploy selected bundle - Take the bundle currently live on your source environment and deploy it to your target environment.
- Import new environment variables - Copy environment variables whose keys are present in the source environment, but not the target environment.
Click the "Submit" button.
Wait for the import to complete.
For projects with large databases or a lot of assets, it's time to go make a coffee. This step can take a little while.
Cloning from Local #
Cloning data from local is a little different, mainly due to the fact Servd can't pull data from your personal dev environment.
If you use the Servd plugin to store your local assets on the Servd CDN, then the clone tool is able to copy assets that live in your local CDN directory over to any other environment CDN directory.
It's worth noting however, that if you have enabled the "Use Local Volumes During Dev" setting in your Servd plugin, the assets stored on your local machine will not be used by the clone. Only those stored in the local directory on the Servd CDN will be.
Cloning to Local #
If you want to pull database data and assets into your local environment, follow these steps:
Confirm you have the Servd plugin installed locally.
If you want to import data from one of your Servd environments into your local environment, run the following craft command:
If you want to import assets from one of your Servd environments into your local environment, run the following craft command:
If you have the "Use Local Volumes During Dev" Servd plugin setting enabled, this will download the assets onto your local machine. Otherwise, it will copy the assets to your local Servd CDN directory.
For more information on the available Servd commands, have a read of the Servd plugin docs.