Cloning website, making staging copy (v-clone-website)

Post Reply
User avatar
dpeca
Site Admin
Posts: 552
Joined: Fri Jun 19, 2020 9:59 am
Your location: Serbia, Niš and Belgrade
First name and last name: Predrag Damnjanović
Cloning website, making staging copy (v-clone-website)

Post by dpeca »

We have an script for website cloning: v-clone-website

Let's say you have yourdomain.com and you want to make stage.yourdomain.com in one command.
In your SSH run:

Code: Select all

sudo /usr/local/vesta/bin/v-clone-website yourdomain.com stage.yourdomain.com
Our script will show you what will be copied, what database will be created, what URL will be replaced, just press enter to confirm it.
And that's all, the script will clone your site.
WordPress will be detected automatically, no need to modify wp-config.php manually.

Want to copy stage back to production?
In your SSH run:

Code: Select all

sudo /usr/local/vesta/bin/v-clone-website stage.yourdomain.com yourdomain.com
Script will do the rest.

See source code of the script for all available parameters: v-clone-website

Tags:

wpinsites
Posts: 10
Joined: Thu Jul 30, 2020 7:06 am
Re: Cloning website, making staging copy (v-clone-website)

Post by wpinsites »

Thanks for this excellent tool!

I have just used it for the first time to create a staged site to test updates, and now want to copy the staged site back to the production site. I noted, however, that when it displayed the summary of the information to be used to complete the clone, the DATABASE_SUFFIX was set to _migrated, as it was when creating the clone. Is this correct? Should I be using an override so that it doesn't change the structure of the database on the original site?

User avatar
dpeca
Site Admin
Posts: 552
Joined: Fri Jun 19, 2020 9:59 am
Your location: Serbia, Niš and Belgrade
First name and last name: Predrag Damnjanović
Re: Cloning website, making staging copy (v-clone-website)

Post by dpeca »

Code: Select all

--DATABASE_SUFIX=... (default is '_migrated')
so you can override it with this parameter.
If you are cloning site to different account, then you can set it to empty string:

Code: Select all

--DATABASE_SUFIX=""

wpinsites
Posts: 10
Joined: Thu Jul 30, 2020 7:06 am
Re: Cloning website, making staging copy (v-clone-website)

Post by wpinsites »

So if I'm copying the cloned (staged) site back to the original, should I override this parameter and set it blank so that I don't end up with the "_migrated" suffix on the original site?

User avatar
dpeca
Site Admin
Posts: 552
Joined: Fri Jun 19, 2020 9:59 am
Your location: Serbia, Niš and Belgrade
First name and last name: Predrag Damnjanović
Re: Cloning website, making staging copy (v-clone-website)

Post by dpeca »

wpinsites wrote:
Thu Jul 29, 2021 12:36 am
So if I'm copying the cloned (staged) site back to the original, should I override this parameter and set it blank so that I don't end up with the "_migrated" suffix on the original site?
If you clone stage back to original, this script will figure out that it's stage (thanks to '_migrated' sufix) and will copy database directly to original database.

So, let's say we have database test_wp on test.com domain.

If you clone it first time:
v-clone-website test.com stage.test.com
you will get database test_wp_migrated

but...
if you want to copy the stage back to the original:
v-clone-website stage.test.com test.com
then test_wp_migrated will be copied back to test_wp

So, thanks to '_migrated' sufix, script will figure out that you want to copy stage back to original.

wpinsites
Posts: 10
Joined: Thu Jul 30, 2020 7:06 am
Re: Cloning website, making staging copy (v-clone-website)

Post by wpinsites »

Brilliant. You're awesome! Thanks! :D

I love this script. It is so quick. :!:

Any plans to add this (and possibly the script to install WordPress) to the web interface, possibly in the domain options menu when you hover a domain? :idea:


Post Reply