This guide will detail the final steps required to finish your migration to MDOQ hosting, before following this guide you should have already carried out the steps in Migrating an existing Magento 2 site MDOQ.
The process of finishing the migration to MDOQ, is fairly straight forward. We recommend that you carry out the Staging Migration a few times before you commit to the migration, so that you have an accurate idea of the timings and steps involved.
Prerequisites
- If you currently have an SSL for you existing site, please raise a support ticket with the subject "Upload existing SSL certificate(s)", and ask for it to be added to your MDOQ production instance. (This will allow you to serve HTTPS traffic from the moment you switch)
- If you would like a Letsencrypt SSL certificate generating and maintained for your MDOQ production site, please raise a support request, with the subject "Letsencrpyt SSL setup" confirming the domains you will want to be using. (We won't be able to generate one until the DNS is swapped, but by informing us in advance we can make sure everything is in place for you)
- The IP address of your MDOQ production instance.
- Ensure that your MDOQ production instance is on the same tag/commit as your existing production server.
- MDOQ CLI installed on your production server
- Your MDOQ production instance is in Development state. You can validate this by making sure there is a "Go Live" button next to the "Perform Release" button on your production site.
- Access to your DNS settings
- Reducing the TTL on your domain(s) to the lowest possible setting.
Staging Migration
This will allow you to test the migration process and your MDOQ production instance without effecting your current production. We recommend carrying this process out multiple times before committing to the final migration.
1. Create MySQL backup and push to MDOQ
- SSH into your webserver
- Change directory to the web root, and change user to the Magento web user.
- Create .sql.gz of the database
php bin/magento setup:backup --db
This will create a db backup in the "var/backups" directory - You will then need to compress this backup
gzip path/to/backup
for examplegzip var/backups/1634286600_db.sql
- Pushing the db backup
mdoq backups:push --instance-id=INSTANCE_ID --backup-type=full-db-backup --file=/path/to/backup.sql.gz
- Once this has been pushed you can verify they are in MDOQ by:
- selecting your production instance
- clicking "toolbelt" > "snapshots"
- Then clicking "manage" on each backup type to validate the backups are there.
2. Sync MySQL
To use the newly uploaded backup
- Select your production instance
- Click "Sync"
- Select "MySQL"
- Click "Proceed"
3. Test
Once the Sync has finished you should be able to test the MDOQ production site.
You will need to add an entry to your hosts file.
Final Migration
The process will commit to the process of migrating to MDOQ. We recommend that you carry out Staging Migration a few times before carrying out this process.
Reverting the migration
Sometimes even the most thoroughly tested processes throw curve balls.
If customers HAVEN'T placed orders on the MDOQ site
You just need to:
- Disable maintenance mode on the original site
- Swap the DNS back to the original site.
If customers HAVE placed order on the MDOQ site
At this point it very difficult to return to the original site. We would recommend working through the issues on the MDOQ instance rather then returning to the old infrastructure.
1. Enable maintenance mode (existing site)
- SSH into your webserver
- Change directory to the web root, and change user to the Magento web user.
- Enable maintenance mode.
php bin/magento maintenance:enable
2. Enable maintenance mode (MDOQ site)
- SSH into your MDOQ instance
- Change directory to the web root.
- Enable maintenance mode.
php bin/magento maintenance:enable --ip=YOUR_IP
replacing YOUR_IP with a comma separated list of IPs you would like to allow through to the MDOQ site to test, before opening up to customers.
3. Create MySQL backup and push to MDOQ
- SSH into your webserver
- Change directory to the web root, and change user to the Magento web user.
- Create .sql.gz of the database
php bin/magento setup:backup --db
This will create a db backup in the "var/backups" directory - You will then need to compress this backup
gzip path/to/backup
for examplegzip var/backups/1634286600_db.sql
- Pushing the db backup
mdoq backups:push --instance-id=INSTANCE_ID --backup-type=full-db-backup --file=/path/to/backup.sql.gz
- Once this has been pushed you can verify they are in MDOQ by:
- selecting your production instance
- clicking "toolbelt" > "snapshots"
- Then clicking "manage" on each backup type to validate the backups are there.
4. Sync MySQL
To use the newly uploaded backup
- Select your production instance
- Click "Sync"
- Select "MySQL"
- Click "Proceed"
5. Test
Once the Sync has finished you should be able to test the MDOQ production site.
You will need to add an entry to your hosts file.
6. Change the DNS
Point your domain(s) at the new server.
7. Disable Maintenance Mode
Disable maintenance mode on your MDOQ production instance.
php bin/magento maintenance:disable
8. Enable MDOQ production state
This is not the same as Magento production mode
Select your production site, and click the "Go Live" button. MDOQ won't carry out any actions, you are just informing MDOQ to treat this instance a live production instance. (Which adds safety nets around certain actions)