Sync Script
Version 1.3.0 • Updated August 1st, 2022
Synchronize your WordPress site database and uploads between environments with WP-CLI aliases and rsync.
$ ./sync.sh production development
🔄 Would you really like to ⚠️ reset the development database (https://example.test)
and sync down from production (https://example.com)? [y/N]
✅ Able to connect to production
✅ Able to connect to development
🔄 Sync from production to development complete.
This is a Bash script (not a WordPress plugin) that is compatible with Bedrock-based WordPress installs.
Avoid the need for a WordPress plugin that handles database and media library migrations/synchronization by using WP-CLI aliases and rsync
.
Sync in any direction:
- Development to staging
- Development to production
- Staging to development
- Production to development
- Staging to production
- Production to staging
Optionally sync only the database, or only your media library assets.
WP-CLI performs a search-replace
during the sync to make sure that your domain always matches the correct environment.
Optionally turn on a Slack notification when the sync direction is up or horizontal.
This script must be manually configured to fit your environment setup before it can properly work. Instructions are included, and the initial config should take just a few minutes and you won’t have to touch it again.
Examples include both Trellis and Kinsta based setups. Valet and other local development setups on host machines are also supported.
Oh my god this so much faster than WP Migrate DB Pro 🔥
This is so much faster and fluid than using the Delicious Brains plugin. I know they both offer different advantages and disadvantages as this needs Bedrock to function. Thanks for offering it at a good price. Highly recommended.
Requirements
- Bedrock-based WordPress install
- Working local development setup
- Deployed and installed remote environments
Troubleshooting
Unable to connect to production or staging
Make sure that you’re able to successfully connect with a SSH connection with the same details configured for the same WP-CLI alias.
If your SSH connection doesn’t fail, make sure WordPress is first already installed.
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.0