Easy WordPress Staging With VersionPress
We recently changed the way you access GIT on all of our servers and have also now added wp-cli to all of our servers which makes it easy to setup WordPress Staging and recovery for your WordPress site. To set this up we will use VersionPress which is really an amazing plugin that is extremely well done and efficient.
Install VersionPress For Easy WordPress Staging
Unfortunately downloading and extracting through SSH does not create a clean install as some symbolic linking fails. Installing through WordPress admin remedies this so go ahead and download VersionPress than upload, install, and activate.
You should see it activate successfully. Now in your WordPress admin you will see:
Go ahead and activate it. If it complains about GIT version there are 2 options to fix it.
- Change GIT Version With Alias
- Add the following to your to your wp-config.php:
I will use option #2.
Now you should be able to proceed with activation after refreshing the page in your WordPress admin area.
Create A Staging Site
Make sure you are in your site directory and issue the command:
wp vp clone --name=staging
You now have a staging site called “staging”.
This creates a full clone including all files, a database, and makes the needed changes to wp-config.php.
Let’s Have Some Fun!
Now to test things out change the theme on your staging site, and create a few posts and or pages on the “live” environment. When ready issue the command:
wp vp pull --from=staging
VersionPress will compare the changes and merge them properly on your live environment, how slick is that. If by chance something does go wrong you can instantly RollBack individual changes or do a complete RollBack to the point before you merged. Such an amazing way to setup a staging environment, and I have just barely touched the surface of what is possible with the combination of VersionPress, wp-cli, and GIT.
Keep in mind that VersionPress is still in development so always have your backups handy just in case (should you forget we have your back), though in my testing it has done its job extremely well and the only real thing I see lacking right now is plugin support. But this is something being worked on by the VP developers and it is expected to have extensive coverage of plugins by end of 2017.
Try this out on our premium Managed WordPress Hosting!