Skip to main content

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​

  1. 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.
  2. Read the release notes for your target version (Release notes).
  3. Back up. mii Lite does it for you (see below). For a plant stack, do it yourself (Backup and restore).
  4. 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.

In an elevated PowerShell:

.\mii-lite-4.0.1-windows-amd64.exe install
& "C:\Program Files\MakeIntelligent\mii.exe" status

What happens at the first start of the new version:

  1. The new payload is unpacked next to the old one (app/<version>/).
  2. mii makes an automatic backup auto-preupgrade-<old>-to-<new>-<timestamp>.zip in the backups folder. If the backup fails, the start is aborted and nothing is changed.
  3. The database is migrated.
  4. The services start. The version is recorded in state/last-version (the previous one in state/previous-version).
  5. 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 status shows the service running and a 200 OK health 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​

  1. Stop the service: mii stop.
  2. Run mii rollback. It restores the pre-upgrade backup and pins the previous app version (state/pin-version). It asks you to confirm; --yes skips the question, and --allow-unknown-version allows a version that cannot be compared.
  3. Start the service: mii start.
caution

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.sql with 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.

  1. Back up everything. A database dump (pg_dump -Fc, check with pg_restore -l), the historian data, all volumes including mii-secrets, and the image tags you run now.

  2. Stop the Console (scale it to 0 on k3s). An old Console refuses a migrated database.

  3. Pull the new images: set MI_VERSION to the new tag.

    export MI_VERSION=<new tag>
    docker compose -f compose.plant.yml pull
  4. Start the database first. mi-db applies its migrations and reports healthy only when the schema is ready (the marker .mii_schema_ready). The Console entrypoint also runs migrate unless SKIP_MIGRATE=true.

  5. Start the Console with the same MI_MASTER_KEY and JWT secret (they live in the mii-secrets volume).

  6. Start the Site Runtime (mi-siterun), then the historian reader (mi-visual) if it was stopped.

    docker compose -f compose.plant.yml up -d
  7. 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_ADDRESS set, /metrics and /ready move to that listener (404 on the UI port unless MI_METRICS_PUBLIC=true). MI_METRICS_TOKEN adds a bearer token.
  • Saved secrets show as "saved" in the API. Send nothing to keep one, null to 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​

SymptomCauseFix
The start is aborted and the log mentions the backupThe 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-1009The Console is older than the databaseStart the new Console, or restore the old database
Licence state is invalid after the upgradeThe licence was signed with the development keyAsk for a re-issued licence, then upload it in Settings → License
Free mode banner appearsNo .lic is presentUpload the licence
Devices do not connectSecrets cannot be opened because the master key changedRestore master.key
mii rollback failsNo usable pre-upgrade backup exists, or the service is still runningStop the service. Otherwise restore a manual backup with mii restore