Help · Your Mygration server
Restoring a backup and rebuilding a server
Putting a backup back over Mygration's data, and building a new server from the last backup when the old one is gone.
Last updated
You restore a backup on the server's command line. Everything comes back with it: customers, connections, migrations, history and settings.
Important
A restore replaces all of Mygration's data with the backup's. Everything changed since that backup is lost, and running migrations stop. A backup of the data as it is now is taken first, just in case.
Restore a backup on the same server #
Sign in to the server.
List the backups, newest first:
sudo mygration restoreBackup files are named by the date and time they were made, like
mygration-20261012-020000.dump.gpg(ones from before 0.39.1 start withmailmigrator-).Restore the one you want:
sudo mygration restore mygration-20261012-020000.dump.gpgRead the warning, then type
RESTOREand press Enter. Anything else changes nothing.Wait for Restored. The panel and workers start again by themselves.
If the restore fails, your data is left as it was, the panel and workers start again, and the message says why.
After a restore, open the panel and check:
- The customers and batches you expect are there.
- Tenant → Backups runs as before.
- Any pass that was running when you restored: run it again. Each pass copies only what isn't there yet.
Rebuild a server that's gone #
When the old server is lost, build a new one and restore the last backup onto it. You need:
- The backup passphrase from your password manager.
- The data-protection certificate (
data-protection.pfx) and its password, from where you kept them: backups don't include them, and without them the restored server can't read the stored passwords (see Backups). - The newest backup file: from the copy off the server, or one you downloaded from Tenant → Backups.
- The same hostname, pointed at the new server in DNS.
- Your license key.
Then:
Install Mygration on the new server as in Getting started, with the same hostname. Don't sign in or set anything up in the panel yet.
Put the old passphrase in place of the new one. Edit the settings file:
sudo nano /opt/mygration/.envand change the
BACKUP_PASSPHRASE=line to the old passphrase. Save, then:sudo mygration startCopy the backup file into the new server's backups folder (with
scp, for example).sudo mygration restoresays which folder it reads:/opt/mygration/backupsunless you chose another.Restore it:
sudo mygration restore mygration-20261012-020000.dump.gpgand type
RESTORE.Sign in at
https://<your hostname>with your usual account.
[!IMPORTANT] In step 2, also put the old data-protection certificate back: copy the old
.pfxinto/opt/mygration/certs(sudo chown root:1654andsudo chmod 640it), and set theDATA_PROTECTION_CERT_FILE(its file name) andDATA_PROTECTION_CERT_PASSWORDlines in.envto the old server's, in place of the new ones the installer made, beforesudo mygration start.
After a rebuild #
- Backups: on Tenant → Backups, click Back up now, and set up the copy off this server again.
- Workers at customer sites reconnect by themselves once the hostname points at the new server. If the old server used its own certificate (not Let's Encrypt), give them the new one, as when you first set them up.
- Your license carries on with the same key. Check System → License says Licensed.
- Run
sudo mygration doctorto check the server, its certificate and its connections.