Skip to main content

Plant stack

The plant stack is the supported deployment for one factory with more than a pilot line. It is five images that together form one Console, one database, one historian and a Site Runtime.

Services​

The Compose project is named mi-plant. Images are ${MI_IMAGE_REGISTRY:-makeintelligent}/<name>:${MI_VERSION}.

ServiceRolePortVolumeHealth check
mi-dbHardened PostgreSQL 16. Creates the secrets once and applies migrations before it reports healthy.5432, internal onlypostgres-data, mii-secretspg_isready and the marker file $PGDATA/.mii_schema_ready
mi-tsdbPlant historian (ClickHouse). Database mi. Roles mi_writer, mi_reader, mi_admin.9000 and 8123, internalclickhouse-data, mii-secretsSELECT 1
mi-visualHistory query service. Uses the mi_reader role.8090, internalmii-secrets (read-only)GET /health
mi-consoleConsole API and web UI. Runs as user mii (uid 10001). Runs migrate, then console-api.8080, published as ${MI_CONSOLE_PORT:-8080}:8080mii-secrets (read-only)GET /health
mi-siterunSite Runtime: collector, OT protocol host, plugins and the rules engine.8081, internalsiterun-buffer-data at /opt/mii/dataGET /healthz

Start order: mi-db and mi-tsdb, then mi-visual, then mi-console, then mi-siterun. Two networks exist: public publishes only the Console port, and internal has no host ports.

The compose file has no mi-ingest and no mi-agent. Those are separate images for remote runtimes (Site Runtime) and the optional operator agent.

Variables​

VariableRequiredDefaultMeaning
MI_VERSIONyesthe version baked in the fileImage tag
MI_SITERUN_TOKENyesnoneRuntime token from the Console. Compose stops with "Create a runtime in Console and set MI_SITERUN_TOKEN" if unset.
MI_RUNTIME_IDnoruntime-1Runtime id
MI_BUFFER_RETENTIONno4hBuffer retention
MI_BUFFER_MAX_BYTESno40GiBBuffer disk cap
MI_CONSOLE_PORTno8080Published Console port
MI_IMAGE_REGISTRYnomakeintelligentRegistry prefix

Secrets​

mi-db creates these files once in the mii-secrets volume at /run/mii/secrets. They are mode 0440 and owned by postgres:10001.

FileContent
postgres_user, postgres_db, postgres_passwordDatabase login
auth_jwt_secretConsole token signing secret
master_keyMaster key that seals stored passwords, tokens and private keys (AES-256-GCM)
admin_username, admin_passwordFirst administrator
database_url, database_url_localConnection strings
tsdb_writer_password, tsdb_reader_password, tsdb_admin_password, tsdb_db, visual_tokenAdded by mi-tsdb
Keep the master key

The master key is at least 32 characters. If you lose it, every stored credential (for example broker passwords) must be entered again. Keep it with your backups. For rotation, put the old key in master_key_previous, restart once, then remove it.

Install​

  1. Pull the images:
    export MI_VERSION=<tag>
    docker compose -f compose.plant.yml pull
  2. The compose file needs MI_SITERUN_TOKEN to load, but the token only exists after the Console is up. Set a temporary value and start the stack:
    export MI_SITERUN_TOKEN=placeholder
    docker compose -f compose.plant.yml up -d mi-db mi-tsdb mi-visual mi-console
  3. Read the administrator password:
    docker compose -f compose.plant.yml exec mi-console cat /run/mii/secrets/admin_password
  4. Open http://localhost:8080 and sign in as admin.
  5. In Model create the Site. In Runtimes click Add runtime, use the Runtime id runtime-1 (or your MI_RUNTIME_ID) and copy the token. It has the form mi_runtime_... and is shown once.
  6. Start the Site Runtime with the real token:
    export MI_SITERUN_TOKEN=mi_runtime_...
    docker compose -f compose.plant.yml up -d
  7. In Runtimes, wait for the runtime to show Online.
Order

The order in steps 2 to 6 follows from how the compose file reads its variables. Create the first runtime from the Console, then pass its token to mi-siterun. The first runtime needs no licence feature. A second runtime needs the Enterprise feature edge.multi_runtime.

The Site Runtime reaches the Console at http://mi-console:8080 and advertises http://mi-siterun:8081. It writes the historian at mi-tsdb:9000 as mi_writer.

Operate​

TaskHow
Logsdocker compose -f compose.plant.yml logs -f mi-console (JSON lines)
HealthGET http://localhost:8080/health and /ready
BackupBack up the postgres-data, clickhouse-data, mii-secrets and siterun-buffer-data volumes. Take a pg_dump -Fc and check it with pg_restore -l.
UpgradeBack up, change MI_VERSION, pull, up -d. A Console older than the database schema refuses to start (MI-1009).

See Backup and restore and Upgrade.

Troubleshooting​

SymptomCauseFix
Compose says "Create a runtime in Console and set MI_SITERUN_TOKEN"Variable not setExport MI_SITERUN_TOKEN (step 2).
mi-console not healthymi-db still migratingWait; check mi-db health and logs.
Runtime stays offlineWrong token or runtime idRotate the token in Runtimes and restart mi-siterun with it.
MI-1011 at Console startNo master keyUse the generated master_key secret.
MI-1009 at Console startConsole older than the schemaUse the newer image.