Syncing production with staging

we have a staging server in order to test out plugins and roll out new features and also re designing sites. The issue is that the staging version of the site will be out of sync as soon as new content is done on live site, or a new image is uploaded. What is the best way to keep the staging version in sync with the live one, including all posts, images and plugins as well as the whole database in general.

Topic sync staging production plugins Wordpress

Category Web


If you are using Pantheon for hosting it turns out to be trivial to do this as a test (they call it dev), stage (they call it test) and production server are built into their platform along with tools to manage moving data and files around. Plus with Pantheon you get easy but optional Git deploy as part of the deal.

You can test out Pantheon for free as you only have to pay for sites once you get ready to deploy to a production domain. Also, if you build sites for other people you can become a partner and unlike discounted partner rates for your clients.

If you are not on Pantheon, and cannot move, then for moving the DB down from the live server to staging I would recommend using a SQL tool like Navicat for MySQL (great transfer tools), DataGrip (great UX but not so great transfer tools), Sequel Pro (free for Mac, not as feature rich) or HeidiSQL (free, for Win, not as feature rich).

And for source code (plugins, themes, etc) and uploads I would recommend a plain-old STFP client, of which there are (too) many.


If you use the Mediatemple staging feature (or GoDaddy, is the same parent company)

Then the short answer is: No, for a silly reason you can't

The use case they had in mind probably was: Do all the changes in dev and publish them to prod, but apparently that doesn't work obviously for stores, etc. where you obviously generate new data in production environment.

The best approach is to generate new zip files from prod (Files & DB) delete the old staging site, create a new one and set it up again with the files from prod.

Now if you don't want to use such feauture, best thing would be to set up overnight cronjobs which do this very same approach overnight so at least every morning you work with the most actual state...

Problem with this approach is that uncommited changes to production will be deleted overnight...

So whatever way you choose there's caveats...

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.