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}.
| Service | Role | Port | Volume | Health check |
|---|---|---|---|---|
mi-db | Hardened PostgreSQL 16. Creates the secrets once and applies migrations before it reports healthy. | 5432, internal only | postgres-data, mii-secrets | pg_isready and the marker file $PGDATA/.mii_schema_ready |
mi-tsdb | Plant historian (ClickHouse). Database mi. Roles mi_writer, mi_reader, mi_admin. | 9000 and 8123, internal | clickhouse-data, mii-secrets | SELECT 1 |
mi-visual | History query service. Uses the mi_reader role. | 8090, internal | mii-secrets (read-only) | GET /health |
mi-console | Console API and web UI. Runs as user mii (uid 10001). Runs migrate, then console-api. | 8080, published as ${MI_CONSOLE_PORT:-8080}:8080 | mii-secrets (read-only) | GET /health |
mi-siterun | Site Runtime: collector, OT protocol host, plugins and the rules engine. | 8081, internal | siterun-buffer-data at /opt/mii/data | GET /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
| Variable | Required | Default | Meaning |
|---|---|---|---|
MI_VERSION | yes | the version baked in the file | Image tag |
MI_SITERUN_TOKEN | yes | none | Runtime token from the Console. Compose stops with "Create a runtime in Console and set MI_SITERUN_TOKEN" if unset. |
MI_RUNTIME_ID | no | runtime-1 | Runtime id |
MI_BUFFER_RETENTION | no | 4h | Buffer retention |
MI_BUFFER_MAX_BYTES | no | 40GiB | Buffer disk cap |
MI_CONSOLE_PORT | no | 8080 | Published Console port |
MI_IMAGE_REGISTRY | no | makeintelligent | Registry 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.
| File | Content |
|---|---|
postgres_user, postgres_db, postgres_password | Database login |
auth_jwt_secret | Console token signing secret |
master_key | Master key that seals stored passwords, tokens and private keys (AES-256-GCM) |
admin_username, admin_password | First administrator |
database_url, database_url_local | Connection strings |
tsdb_writer_password, tsdb_reader_password, tsdb_admin_password, tsdb_db, visual_token | Added by mi-tsdb |
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
- Pull the images:
export MI_VERSION=<tag>docker compose -f compose.plant.yml pull
- The compose file needs
MI_SITERUN_TOKENto load, but the token only exists after the Console is up. Set a temporary value and start the stack:export MI_SITERUN_TOKEN=placeholderdocker compose -f compose.plant.yml up -d mi-db mi-tsdb mi-visual mi-console - Read the administrator password:
docker compose -f compose.plant.yml exec mi-console cat /run/mii/secrets/admin_password
- Open
http://localhost:8080and sign in asadmin. - In Model create the Site. In Runtimes click Add runtime, use the Runtime id
runtime-1(or yourMI_RUNTIME_ID) and copy the token. It has the formmi_runtime_...and is shown once. - Start the Site Runtime with the real token:
export MI_SITERUN_TOKEN=mi_runtime_...docker compose -f compose.plant.yml up -d
- In Runtimes, wait for the runtime to show Online.
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
| Task | How |
|---|---|
| Logs | docker compose -f compose.plant.yml logs -f mi-console (JSON lines) |
| Health | GET http://localhost:8080/health and /ready |
| Backup | Back 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. |
| Upgrade | Back 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
| Symptom | Cause | Fix |
|---|---|---|
| Compose says "Create a runtime in Console and set MI_SITERUN_TOKEN" | Variable not set | Export MI_SITERUN_TOKEN (step 2). |
mi-console not healthy | mi-db still migrating | Wait; check mi-db health and logs. |
| Runtime stays offline | Wrong token or runtime id | Rotate the token in Runtimes and restart mi-siterun with it. |
| MI-1011 at Console start | No master key | Use the generated master_key secret. |
| MI-1009 at Console start | Console older than the schema | Use the newer image. |