Cloning website, making staging copy (v-clone-website)
Posted: Tue Jun 08, 2021 2:44 pm
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:
(first parameter is SOURCE website, second parameter is DESTINATION website)
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, Joomla and Open-Cart will be detected automatically, no need to enter DB credentials manually.
Want to copy stage back to production?
In your SSH run:
Script will do the rest.
By default, destination database will be: myuser_domain_com (or, in case it's subdomain, then it will be myuser_subdomain_domain_com )
Optional:
If you want to specify destination database, you can add parameter: --DATABASE_SUFIX=_name_of_new_site or --TO_DATABASE=myuser_exactdbname
or
For custom CMS
In case that you want to clone custom CMS which doesn't store files outside of /public_html folder and there is only one config file, run:
Another scenario would be if you want to clone CMS which does store files outside of /public_html folder and have multiple config files, then you will run this command:
Commands explanation:
--CMS_TYPE='other' If CMS is different from WordPress, Joomla or Open-Cart
--SITE_SUBFOLDER='..' If there are files outside of /public_html folder, use this command to navigate up one directory level. Or you can use this command to navigate directly to subfolder where all files are stored
--CONFIG_FILE='config.php' If there are files outside of /public_html folder, you have to set path to config file, '/public_html/config.php'
--SEARCH_FOR_CONFIGS_DATABASE_NAME=1 Used in case that CMS has multiple config files
Keep in mind that you have to manually read database name/username/password from config file and insert those information in script.
See source code of the script for all available parameters: 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, Joomla and Open-Cart will be detected automatically, no need to enter DB credentials 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
By default, destination database will be: myuser_domain_com (or, in case it's subdomain, then it will be myuser_subdomain_domain_com )
Optional:
If you want to specify destination database, you can add parameter: --DATABASE_SUFIX=_name_of_new_site or --TO_DATABASE=myuser_exactdbname
Code: Select all
sudo /usr/local/vesta/bin/v-clone-website yourdomain.com stage1.yourdomain.com --DATABASE_SUFIX=_stage1
Code: Select all
sudo /usr/local/vesta/bin/v-clone-website stage1.yourdomain.com yourdomain.com --TO_DATABASE=myuser_wp
For custom CMS
In case that you want to clone custom CMS which doesn't store files outside of /public_html folder and there is only one config file, run:
Code: Select all
/usr/local/vesta/bin/v-clone-website domain1.com domain2.com --CMS_TYPE='other' --CONFIG_FILE='config.php' --FROM_DATABASE_NAME='myuser_db' --FROM_DATABASE_USERNAME='myuser_db' --FROM_DATABASE_PASSWORD='mysqlpass1234'
Code: Select all
/usr/local/vesta/bin/v-clone-website domain1.com domain2.com --CMS_TYPE='other' --SITE_SUBFOLDER='..' --SEARCH_FOR_CONFIGS_DATABASE_NAME=1 --CONFIG_FILE='public_html/config.php' --FROM_DATABASE_NAME='myuser_db' --FROM_DATABASE_USERNAME='myuser_db' --FROM_DATABASE_PASSWORD='mysqlpass1234'
--CMS_TYPE='other' If CMS is different from WordPress, Joomla or Open-Cart
--SITE_SUBFOLDER='..' If there are files outside of /public_html folder, use this command to navigate up one directory level. Or you can use this command to navigate directly to subfolder where all files are stored
--CONFIG_FILE='config.php' If there are files outside of /public_html folder, you have to set path to config file, '/public_html/config.php'
--SEARCH_FOR_CONFIGS_DATABASE_NAME=1 Used in case that CMS has multiple config files
Keep in mind that you have to manually read database name/username/password from config file and insert those information in script.
See source code of the script for all available parameters: v-clone-website