If your website plan is WP Pro or larger, we can set up a staging environment for site development. A common use case is to develop a new version of the site in staging environment, and when it is ready, copy the site to the production environment.
The basic task is to copy new theme files and database from staging to production, here's how:
Make backups from both environments (
wp-backup)Be very careful, check the direction where you are moving data
Follow our instructions.
Resetting Staging Environment
Replacing staging environment with a copy of the current production environment is easy, but be careful! Resetting staging removes all data and replaces it with a copy of production environment data, so take a backup first (wp-backup) if there is anything worth saving in staging.
After that, you can reset staging by running the following command in production environment:
wp-shadow-reset example_123abc
You can find out the name of the instance you're in with wp-list-env (see CONTAINER). You can also view the names of the shadow environments through the Seravo Plugin (Tools > Site Status).
Shadow resets do not copy the uploads directory because image files are fetched from production via a proxy. Some themes and plugins may store files in this folder, so those files must be manually copied or regenerated.
Checking the Domain Address
If your staging environment uses a custom domain, you need one final step to restore access after a reset. In the staging environment, you must manually replace the main production domain with the custom staging domain. You can achieve this by accessing the staging environment after the reset and running wp search-replace according to the following example:
wp search-replace '//example.com' '//staging.example.com' --all-tables
Finally, remember to clear all caches. You can purge the Seravo service caches by running the command wp-purge-cache.
Publishing the Shadow Environment to Production
Changes made in the shadow environment can be copied or published to the production environment using almost the same pattern as when resetting the shadow. This copies all data (content and database) from the shadow and overwrites the production site. If there is anything in the production environment that you wish to save, take a backup before making changes using the command wp-backup.
Publishing the shadow environment to production is done by running the following command in the production environment:
wp-shadow-pull example_123abc
You can find the name of the shadow environment you wish to publish by running wp-list-env in the shadow (under the CONTAINER field). You can also view the names of the shadow environments through the Seravo Plugin (Tools > Site Status).
Checking the Address Structure
The shadow environment's address structure will overwrite the production environment's address structure. If your shadow environment used a custom domain (e.g., staging.example.com), you must manually run a separate search-replace operation in the production environment after the pull to ensure the production domain (e.g., example.com) is routed correctly:
wp search-replace '//staging.esimerkki.com' '//esimerkki.com' --all-tables
Finally, remember to clear all caches. You can purge the caches of the Seravo service by running the command wp-purge-cache.
Need Assistance?
Contact our customer service by sending a message to [email protected].
