Upgrade
An upgrade replaces the software and migrates the database. Your data, secrets and licence stay. In mii Lite you upgrade with the same command you used to install. In a plant stack you replace the images in a fixed order.
How it works
- Migrations run at every start. They are idempotent, so running them again is safe.
- A Console that is older than the database refuses to start (
MI-1009, "database schema mismatch with this binary"). You cannot run an old Console on a migrated database. - Site Runtimes keep collecting and buffering while the Console is down.
Before you start
- Check the licence. Version 4.0 trusts only the production licence key. A licence signed earlier (with the development key, every 3.x licence and 4.0.0-dev) is refused. Ask for a re-issued licence (same customer, installation id and limits) before you upgrade to 4.x. Configuration is never wiped because of an invalid licence. See Licensing.
- Read the release notes for your target version (Release notes).
- Back up. mii Lite does it for you (see below). For a plant stack, do it yourself (Backup and restore).
- Keep the master key and the JWT secret. The new version must use the same ones.
Upgrade mii Lite
Install the new package over the old one. Install and upgrade are the same command. Your data is kept.
- Windows
- Linux
- Docker
In an elevated PowerShell:
.\mii-lite-4.0.1-windows-amd64.exe install
& "C:\Program Files\MakeIntelligent\mii.exe" status
sudo apt install ./mii-lite_<version>_amd64.deb # Debian, Ubuntu
# or, from the tarball
sudo ./mii install
sudo /opt/makeintelligent/mii status
Keep the data volume and start a new container from the new image.
docker stop mii && docker rm mii
docker run -d --name mii --restart unless-stopped --network host -v mii-data:/data localhost/makeintelligent/mii-lite:4.0.1
What happens at the first start of the new version:
- The new payload is unpacked next to the old one (
app/<version>/). miimakes an automatic backupauto-preupgrade-<old>-to-<new>-<timestamp>.zipin thebackupsfolder. If the backup fails, the start is aborted and nothing is changed.- The database is migrated.
- The services start. The version is recorded in
state/last-version(the previous one instate/previous-version). - After a successful start, older payloads are removed. The current and the previous version are kept.
If a migration did not finish, the old payloads are not removed and the log tells you to run mii rollback.
The first start after an upgrade can take longer than usual because of the migration. Wait for mii status to show a healthy Console.
Check the result (go or no-go)
mii statusshows the service running and a200 OKhealth line.- You can sign in.
- Settings → License: state is valid, edition and installation id are unchanged.
- No "Free tier reset" in the audit log within 5 minutes, and row counts are stable.
- Devices are unchanged and connect again. Connectivity → Devices shows Connected.
- History returns data in Trends.
- Stored secrets still work (a device with a password still connects).
If any check fails, roll back.
Roll back
mii Lite
- Stop the service:
mii stop. - Run
mii rollback. It restores the pre-upgrade backup and pins the previous app version (state/pin-version). It asks you to confirm;--yesskips the question, and--allow-unknown-versionallows a version that cannot be compared. - Start the service:
mii start.
Rollback restores the data as it was at the moment of the upgrade. Everything written after the upgrade is lost, including history collected since.
Plant stack
- Safe: restore the dump and the volumes you took before, and start the old images.
- Fast: run
migrate --down-to 014_process.sqlwith the new binary, then start the previous Console image. Data written by v4 in the new tables (OEE, governance, the audit chain and others) is lost.
Upgrade a plant stack (Docker Compose, k3s)
Downtime is the Console only, about 2 to 3 minutes without image pulls. Collection continues and buffers in the Site Runtime. Rehearse on a copy first.
Order of images: mi-db and mi-tsdb, then mi-visual, then mi-console, then mi-siterun. The compose file starts them in this order.
-
Back up everything. A database dump (
pg_dump -Fc, check withpg_restore -l), the historian data, all volumes includingmii-secrets, and the image tags you run now. -
Stop the Console (scale it to 0 on k3s). An old Console refuses a migrated database.
-
Pull the new images: set
MI_VERSIONto the new tag.export MI_VERSION=<new tag>docker compose -f compose.plant.yml pull -
Start the database first.
mi-dbapplies its migrations and reports healthy only when the schema is ready (the marker.mii_schema_ready). The Console entrypoint also runsmigrateunlessSKIP_MIGRATE=true. -
Start the Console with the same
MI_MASTER_KEYand JWT secret (they live in themii-secretsvolume). -
Start the Site Runtime (
mi-siterun), then the historian reader (mi-visual) if it was stopped.docker compose -f compose.plant.yml up -d -
Run the go or no-go checks above.
Remote runtimes
Upgrade mii-runtime by installing the new package on the host. Polling pauses for about 9 seconds. Version 4.0 needs, on the Console, MI_INGEST_PUBLIC_URL and MI_CONSOLE_PUBLIC_URL, and the DNS name of the ingest gateway.
What changes for users (4.0)
- Metrics: with
MI_METRICS_ADDRESSset,/metricsand/readymove to that listener (404 on the UI port unlessMI_METRICS_PUBLIC=true).MI_METRICS_TOKENadds a bearer token. - Saved secrets show as "saved" in the API. Send nothing to keep one,
nullto clear it. - Webhook delivery stays off for existing webhooks until you enable it in Uplinks.
- An OPC UA server uplink listens after the upgrade with writes off.
- Proposals older than 24 hours expire.
- Agent keys (
mii_ac_*) are refused on Console REST routes outside a short list. Use MCP or the public API. - A stored topic prefix is not applied until you apply it.
- Nothing is deleted by retention until you save a rule.
- The store port
MI_LITE_STORE_PORT(UDP 17001 by default) is configurable.
Limits and good practice
- Upgrade at a quiet time. Alarm evaluation and collection run in the Site Runtime, but the Console UI is unavailable for a few minutes.
- Upgrade one plant first, then the others.
- Do not skip a backup because the upgrade "worked last time".
- Keep the licence file and the installation id in a safe place.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| The start is aborted and the log mentions the backup | The automatic pre-upgrade backup could not be written (disk full or no rights) | Free disk space in the data folder and start again |
| Console exits with MI-1009 | The Console is older than the database | Start the new Console, or restore the old database |
| Licence state is invalid after the upgrade | The licence was signed with the development key | Ask for a re-issued licence, then upload it in Settings → License |
| Free mode banner appears | No .lic is present | Upload the licence |
| Devices do not connect | Secrets cannot be opened because the master key changed | Restore master.key |
mii rollback fails | No usable pre-upgrade backup exists, or the service is still running | Stop the service. Otherwise restore a manual backup with mii restore |