Moving data between the development environment and the production
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 at: https://seravo.com/docs/deployment/moving-data/
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 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 <staging-instanssi> #e.g.wp-shadow-reset mysite_123abc
You can find out the name of the instance you're in with wp-list-env
(see CONTAINER).
If your staging environment uses a custom domain, you need to take one more step to get the staging environment working again after reset. In the staging environment, you need to manually replace the production site domain with the custom staging environment domain. You can do this by going to the staging environment after reset and running wp search-replace
there according to the following example (replace the example domains with your own):
wp search-replace '://exampleproductiondomain.com' '://examplestagingdomain' --all-tables