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 #

  1. Sign in to the server.

  2. List the backups, newest first:

    sudo mygration restore

    Backup files are named by the date and time they were made, like mygration-20261012-020000.dump.gpg (ones from before 0.39.1 start with mailmigrator-).

  3. Restore the one you want:

    sudo mygration restore mygration-20261012-020000.dump.gpg
  4. Read the warning, then type RESTORE and press Enter. Anything else changes nothing.

  5. 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:

  1. 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.

  2. Put the old passphrase in place of the new one. Edit the settings file:

    sudo nano /opt/mygration/.env

    and change the BACKUP_PASSPHRASE= line to the old passphrase. Save, then:

    sudo mygration start
  3. Copy the backup file into the new server's backups folder (with scp, for example). sudo mygration restore says which folder it reads: /opt/mygration/backups unless you chose another.

  4. Restore it:

    sudo mygration restore mygration-20261012-020000.dump.gpg

    and type RESTORE.

  5. 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 .pfx into /opt/mygration/certs (sudo chown root:1654 and sudo chmod 640 it), and set the DATA_PROTECTION_CERT_FILE (its file name) and DATA_PROTECTION_CERT_PASSWORD lines in .env to the old server's, in place of the new ones the installer made, before sudo 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 doctor to check the server, its certificate and its connections.