Free Pro
A MikroWizard server keeps its data in two places: the PostgreSQL database (inside the MikroWizard-postgre container) and files on the host, mostly under /opt/mikrowizard. A complete backup needs both.
MikroWizard-postgre container. Removing that container, running the installer again, or docker volume prune can lose it. Always keep a database dump.What to back up #
| What | Where (default) | Why | Needed? |
|---|---|---|---|
| Database | MikroWizard-postgre container, database MikroWizardDB | Devices, users, groups, permissions, settings, tasks, logs, vault entries, PAM policies, customer data | Yes |
server-conf.json | /opt/mikrowizard/server-conf.json | The encryption keys PYSRV_CRYPT_KEY and PYSRV_KEK, plus the addon tokens. Without these keys, the device passwords and vault entries in the database can’t be decrypted. | Yes |
| Router configuration backups | The backup folder chosen at install (/opt/mikrowizard/backup, older installs /opt/mikrowizard/backups) | Every backup file and configuration version. The database only points to these files. | Yes |
| Session recordings (Pro) | /opt/mikrowizard/terminal_recordings, /opt/mikrowizard/webfig_recordings | Replays of SSH, RDP, VNC, WebBox and WebFig sessions | Yes, if you keep recordings for audits |
| SSL certificates | /opt/mikrowizard/ssl, nginx-ssl-server.conf, nginx-ssl-redirect.conf | Let’s Encrypt account and certificates, or your own certificate | Yes, if you use HTTPS |
| Terminal Gateway (Pro) | /opt/mikrowizard/terminal-gateway/gateway.env | Gateway settings and its API token | Yes, if installed on this server |
| WireGuard addon (Pro) | /opt/mikrowizard/wireguard | The server’s private key, the addon token and peer state. With a new key, every peer’s configuration has to be replaced. | Yes, if installed |
| MikroSpeed addon | /opt/mikrowizard/speedtest | The addon token | Yes, if installed |
| Firmware files | The firmware folder chosen at install (/opt/mikrowizard/firmwares) | Downloaded RouterOS packages | Optional: they can be downloaded again |
Not needed: drives (temporary per-session drives of the Terminal Gateway), logs (service log files), wireguard-addon (addon program files, reinstalled by its installer), recreate-ssl.sh (created again by MikroWizard), front-update-last-check, crontab and old *.bak / -b copies. The Redis container holds only temporary data such as sign-in sessions, queues and the state of running jobs.
Check your folders #
Your backup and firmware folders may not be the defaults. Show the folders the backend container uses:
sudo docker inspect -f '{{range .Mounts}}{{.Source}} -> {{.Destination}}{{println}}{{end}}' mikromanThe folder mounted on /backups holds the router backups, the one on /firms the firmware files.
Show the database user and name:
sudo grep -E '"PYSRV_DATABASE_(USER|NAME)"' /opt/mikrowizard/server-conf.jsonBack up #
Run on the MikroWizard server. Replace DBUSER with the database user shown above and MikroWizardDb with database DATABASE_NAME . If your backup folder is outside /opt/mikrowizard, add it at the end of the tar command.
sudo mkdir -p /root/mw-backup
sudo sh -c 'docker exec MikroWizard-postgre pg_dump -U DBUSER -Fc MikroWizardDB > /root/mw-backup/MikroWizardDB.dump'
sudo tar czf /root/mw-backup/mikrowizard-files.tgz --exclude=/opt/mikrowizard/drives --exclude=/opt/mikrowizard/logs /opt/mikrowizardTo leave out firmware files, add --exclude=/opt/mikrowizard/firmwares.
Check the result with sudo ls -lh /root/mw-backup. A dump of only a few kilobytes means it failed.
Copy /root/mw-backup to another machine and keep it safe: it contains the encryption keys and device credentials.
Restore #
Restore onto the same MikroWizard version. A new installation installs the latest version, so upgrade the old server to the latest version before you take the backup.
- Install MikroWizard on the target server: see Install MikroWizard. Use the same backup and firmware folders as before.
- Copy the backup to
/root/mw-backupon the target server and stop the backend:
sudo docker stop mikroman- Keep a copy of the new configuration file, then restore the files:
sudo cp /opt/mikrowizard/server-conf.json /root/server-conf.new.json
sudo tar xzpf /root/mw-backup/mikrowizard-files.tgz --numeric-owner -C /- The restored
server-conf.jsonhas the old keys, which you need, but also the old database and Redis passwords. Put the new installation’s database user and passwords back into it:
sudo python3 -c '
import json
p = "/opt/mikrowizard/server-conf.json"
new = json.load(open("/root/server-conf.new.json"))
conf = json.load(open(p))
for k in ("PYSRV_DATABASE_USER", "PYSRV_DATABASE_PASSWORD", "PYSRV_REDIS_PASSWORD"):
conf[k] = new[k]
json.dump(conf, open(p, "w"), indent=4)
'
sudo chmod 600 /opt/mikrowizard/server-conf.json- Restore the database. Replace
DBUSERwith the database user of the new installation andMikroWizardDbwith database DATABASE_NAME :
sudo sh -c 'docker exec -i MikroWizard-postgre pg_restore -U DBUSER -d MikroWizardDB --clean --if-exists --no-owner --no-acl < /root/mw-backup/MikroWizardDB.dump'- Start MikroWizard again:
sudo docker restart mikrofront
sudo docker start mikroman- Addons: run the installer of each addon you used: Terminal Gateway, WireGuard, MikroSpeed. They use their restored folders and write their settings into
server-conf.json. The WireGuard addon keeps the restored private key, so peers keep working. - Schedules: open each scheduled task in the Task Planner and save it again. Do the same for the Password Vault settings and for Sync & Clone profiles that run on a schedule. These schedules are kept inside the backend container, not in the database, so a new container doesn’t have them until they are saved again.
- Sign in and check: devices come online, Password Vault › Reveal shows a password (this proves the keys match), backups and recordings open.
Common problems #
| Problem | Cause and fix |
|---|---|
| The backend doesn’t start after the restore | Wrong database or Redis password in server-conf.json. Repeat step 4. |
| Devices fail with authentication errors, vault passwords can’t be revealed | server-conf.json is not the one from the backup, so the keys don’t match the database. |
| Backups are listed but don’t open | The router backup folder wasn’t restored, or the backend uses another folder. Check with docker inspect as above. |
| Scheduled tasks don’t run | Save each task again (step 8). |
pg_restore reports an unsupported version | The dump is from a newer PostgreSQL than the target. Use the same or a newer PostgreSQL image on the target. |