I have a staging domain that I am happy to go live.
It is a WooCommerce site.
What’s the right procedure?
I have a staging domain that I am happy to go live.
It is a WooCommerce site.
What’s the right procedure?
I’m using always a second fresh site. Configure the domain + SSL and migrate with all in one migration.
If the domain is used for a previous site, edit your local hosts file.
In that case you need a real SSL certificate to get it working.
Please don’t install any plugins you don’t need. There is no need for any third-party plugins for migrating a site. WP-CLI does the trick!
I normally have those environments:
Install WordPress on all environments (I prefer and highly recommend using Bedrock). Make sure WP-CLI is on all environments, as it’s critical for migrating. Furthermore, ensure the ssh keys are set, so the servers can communicate easily.
In your project, create a wp-cli.yml config file and specify your environments (enter your IP and path to the wp install behind it):
@production:
ssh: username@{{IP_PRODUCTION}}/home/username/path/to/wp
@staging:
ssh: username@{{IP_STAGING}}/home/username/path/to/wp
@local:
ssh: vagrant:default
@remote:
- @production
- @staging
Migrate DB and replace URL (enter yours, obviously):
wp @production db export --default-character-set=utf8mb4 && wp @production db reset --yes && wp @staging db export --default-character-set=utf8mb4 - | wp @production db import - && wp @production search-replace "https://staging.domain.tld" "https://domain.tld" --all-tables-with-prefix
Migrating asset procedure using rsync (replace with your IP’s and paths to assets):
ssh -o ForwardAgent=yes {{IP_STAGING}} "rsync -aze 'ssh -o StrictHostKeyChecking=no' --progress '/home/username/path/to/wp/web/app/uploads' {{IP_PRODUCTION}}:'/home/username/path/to/wp/web/app/uploads'"
And there you go No third-party plugins which may put your shop under risk, and the migration is way faster than using any migration plugin. Beyond that, it’s very convenient as you can automate everything!