Cloning Sites with Pagely Sync
Last Updated -
NOTE:This article covers utilizing the Pagely Sync command. it is a useful tool for one time copies of a single site application, to another. For more granular, repetitive, or multisite cloning processes, we recommend using the Pagely Cloning Tool.
The team at pagely has built a great tool called pagely sync for cloning and syncing sites with ease on your VPS.
SSH into your home directory.
To see a list of available commands run
$ pagely sync --help
You should now see a description of usage along with a list basic commands.
Usage: sync [--ignore-table[="..."]] [--ignore-path[="..."]] [--target-host="..."] [--ssh-identity="..."] [--dry-run] [--skip-file] [--skip-db] [--rename] source target Arguments: source The source directory target The target directory Options: --ignore-table Ignore this table while syncing db (multiple values allowed) --ignore-path Ignore this path, rsync rules (multiple values allowed) --target-host Remote host to use in rsync target --ssh-identity ssh identity file to use with rsync --dry-run Print what you would do --skip-file Don't sync files --skip-db Don't sync db --rename Update wp_options/wp_blogs and search/replace at target, with targets origin name (on multisite only renames the primary domain) --help (-h) Display this help message. --quiet (-q) Do not output any message. --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version (-V) Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. --no-interaction (-n) Do not ask any interactive question.
If you recently created a sandbox/staging area and would like to clone your production over you can run the following from your home directory:
IMPORTANT: If your source site is using a prefix other than wp_, please be sure you update the target site's wp-config.php with the same table prefix.
Note: You may want to use the --dry-run paremeter first to view which actions will happen without actually running the command.
$ pagely sync ~/sites/production-domain-name ~/sites/sandbox-domain-name
This will clone your existing production site to your specified sandbox domain name, along with importing the database and updating the "home" and "siteurl" in the database.
It a good idea to use the wp-cli search-replace function afterwards to clean up any old url references.
You can also review this article from our friends over at SkyVerge with further details using the pagely sync cloning process.