Site staging is now available!

We now have site staging available. We made this feature mainly with WordPress sites in mind, but it can be used for any site type.

Check out the instructions on our docs site.

This is just an initial iteration of site staging and we’d love to hear what you think would make it better!

One thing we have on our list already is to make exclusion files and script sticky so you don’t have to re-enter them.

1 Like

NIce one, how about a function to create a staging copy from a production site?
This function is only for merging my modifications to the production site, right?

Good idea!

We are thinking of ability to clone a db for staging purposes as well.

This function is only for merging my modifications to the production site, right?

Correct, right now it simply replaces the production files with the staging files on sync. Just wanted to start simple and then build on top of it. :wink:

A quick function to clone a website (with or without database) would be great.

2 Likes

After I click on sync. How long does it complete the work? Is there a status bar?

Hi,
pushing the files seems to work very well.
How about the database option? Maybe we can add some standard post scripts?
For example a database clone/copy script and than running a replace function for the host name?
The last might be done with WP-CLI

I tried some stuff in the mean time. This should work for a WordPress website:

mysql --user=username --password=passwd -e 'DROP DATABASE test_db;'
mysql --user=username --password=passwd -e 'CREATE DATABASE test_db;'
mysqldump --user=username --password=passwd live_db | mysql --user=username --password=passwd test_db

wp search-replace 'https://example.com' 'http://staging.example.com' --skip-columns=guid

What kind of code can I use insde the “Post Sync Script” field? Bash script?
It would be great if I could use some variables here.

This WP cli command doesn’t work for page builders like Elementor :face_with_raised_eyebrow:

Hi Olaf,

Currently, when we sync the site, the staging environment copies the WordPress configuration from staging to production or vice versa.

This means that when performing a Prod-to-Staging sync, the staged WordPress site will connect to the production database.

If you need to run MySQL commands, you can run the commands with the following syntax:

mysql -uroot -e 'mysql command;'

You can provide Bash scripts in the Post Sync Script section, which will run after the sync is completed.

We recommend executing these scripts manually on the server first to verify that everything works as expected before using them as automated post-sync scripts.

Additionally, after some research, we found that the WP search-replace command can be run as follows:

sudo -u {{ site_user }} wp --path=/home/{{ site_user }}/{{ site }}/current search-replace 'https://prod.example.com' 'http://staging.example.com' --skip-columns=guid --recurse-objects

Replace site_user with server user the site is associated with. Default is set to cleavr.

I hope this addresses your queries. If I have missed anything or misunderstood your requirements, please let me know, and I will follow up accordingly.

Hi Anish,

thanks for the examples and for mentioning the site and site_user variables.
I tried the WP cli command, but that one doesn’t work on URL’s in shortcodes (Elementor).
But it’s a beginning.

That’s not what you want, if you work on a staging site the database will be changed even after updating a plugin. You need a database copy. Using a mysql command without variables is like creating a staging site manually. Pushing a copy of your website to a new directory via SSH is not so much work, right?

A "One click “production to staging” function would be great (with a database copy of course) :slight_smile: