A fault-tolerant design for machine tracking and health management in regulated plants (pharma first). Machines publish through an outbound-only edge gateway; 13 microservices sit behind one api-gateway on a private GKE cluster; every database has a private address only; Mumbai runs across three zones and Delhi holds a scaled-down copy that can take over in about 30 minutes. Pick a flow below and press Play.
Service icons are the vendors' published diagram icons, shown only to identify each service.
api-gateway (Node.js, the existing main-server pattern) is the only thing the load balancer can reach. It verifies the Identity Platform token, checks the user's client, plant, line and role, applies rate limits, and calls the services over in-cluster HTTP. No service reads another service's database; they talk through the gateway, Pub/Sub events or RabbitMQ jobs.
| Service | Code | Owns | Talks to | Scales on |
|---|---|---|---|---|
| api-gateway | Node.js | no store (reads Redis) | all 12 services, Identity Platform keys | HPA on CPU and requests |
| Asset Registry | Node.js | MySQL: clients, plants, lines, machines, tags (ISA-95 tree) | gateway | HPA |
| Ingest | Python | TimescaleDB hypertables, Redis latest values | Pub/Sub telemetry subscription | KEDA on Pub/Sub backlog, Spot nodes |
| Machine Health | Python | TimescaleDB health scores, rules | publishes machine.health.changed | KEDA on backlog |
| Alarms & Events | Node.js | MongoDB alarms (ISA-18.2 states) | Pub/Sub in, RabbitMQ out | HPA |
| Predictive AI | Python | reads TimescaleDB features; model from Vertex AI registry | publishes machine.risk.predicted | 5-minute CronJob + HPA, CPU only |
| Work Orders | Node.js | MySQL CMMS tables | RabbitMQ in, ERP/MES sync | HPA |
| OEE | Python | TimescaleDB continuous aggregates | gateway | HPA |
| Calibration | Node.js | MySQL calibration, IQ/OQ/PQ records | Audit & e-Sign | HPA |
| Audit & e-Sign | Node.js | MongoDB audit (insert-only, hash-chained), sealed copies in a locked bucket | Identity Platform re-authentication | HPA, min 3 replicas |
| Reports | Python | PDFs in Cloud Storage | RabbitMQ jobs | KEDA on queue, Spot nodes |
| Notifications | Node.js | Redis de-duplication keys | RabbitMQ in; Teams, email, SMS out | KEDA on queue |
| AI Copilot | Python | pgvector database (on the TimescaleDB cluster), MongoDB conversations | Vertex AI Gemini; gateway APIs as tools | HPA, capped by token budget |
Tenancy: one platform for many client companies. Every row carries client_id, each client gets its own database in MySQL and MongoDB and its own schema in TimescaleDB, and the gateway rejects a token whose client does not match the request. A client that demands full isolation gets its own project from the same Terraform.
| Store | Runs as | Used by | Zone failure | Region failure | Access |
|---|---|---|---|---|---|
| Cloud SQL for MySQL | Enterprise Plus, private IP (private services access), CMEK | Assets, Work Orders, Calibration | HA standby in a second zone, automatic failover | DR replica in Delhi; the write endpoint follows a failover | IAM database auth through the Cloud SQL connector |
| MongoDB (self-hosted) | GKE StatefulSet via operator, 3 members in 3 zones, dedicated node pool | Alarms, Audit, Copilot history | majority writes survive one zone | 2 priority-0 members in Delhi, promoted by forced reconfig | NetworkPolicy to owner pods only, SCRAM + TLS |
| TimescaleDB | CloudNativePG cluster, 3 instances in 3 zones, WAL archived to Cloud Storage | Ingest, Health, OEE, Predictive AI; pgvector DB for Copilot | synchronous standby, operator failover | CNPG replica cluster in Delhi | per-service roles, NetworkPolicy |
| Memorystore for Redis Cluster | multi-zone, private connectivity | gateway, Ingest, Copilot cache | replica per shard | cross-region secondary (switchover) | IAM auth + in-transit TLS |
| RabbitMQ | Cluster Operator, 3 nodes, quorum queues | Alarms, Work Orders, Reports, Notifications | quorum keeps 2 of 3 | definitions in Git; producers re-drive open jobs | TLS, NetworkPolicy |
| Pub/Sub | global service, message storage policy limited to Mumbai and Delhi | Ingest, Health, Alarms, Predictive AI | Google-managed | keeps publishing; 7-day retention allows replay | Private Service Connect + VPC Service Controls |
| Cloud Storage | configurable dual-region IN (Mumbai + Delhi) | UI, exports, models, reports, audit seals, backups | — | data already in both regions | uniform access, public access prevention, CMEK |
Why TimescaleDB and not MySQL for telemetry: hypertables, native compression and continuous aggregates turn a billion points a day into small, fast rollups. Why RabbitMQ and Pub/Sub both: Pub/Sub carries high-volume telemetry and fan-out events; RabbitMQ carries work that must run exactly once in order (create this work order, render this report).
Inside Mumbai everything spans three zones, so a zone loss is absorbed automatically. For a region loss, Delhi already holds the data (continuous replication) and a small running cluster; the global load balancer and Pub/Sub are global, so users and plants need no DNS change.
| Layer | Zone loss | Region loss (to Delhi) | RPO | RTO |
|---|---|---|---|---|
| Plant telemetry | — | 72-hour edge buffer; standby tunnels to Delhi; Pub/Sub keeps accepting | 0 | 0 |
| GKE workloads | regional cluster, PodDisruptionBudgets, spread across zones | Delhi cluster at minimum size scales out; LB health checks shift traffic | — | 10–15 min |
| Cloud SQL MySQL | HA failover | replica failover of the DR replica; write endpoint moves | seconds | minutes |
| MongoDB | replica set election | forced reconfig to the Delhi members | seconds | ~10 min |
| TimescaleDB | CNPG failover | promote the Delhi replica cluster | seconds | ~10 min |
| Redis | replica promotion | switchover to the secondary (or rebuild from source) | seconds | minutes |
| RabbitMQ | quorum queues | cluster from Git definitions; open jobs re-driven from MySQL/MongoDB | 0 (re-driven) | 15 min |
| Cloud Storage | — | dual-region, nothing to do | 0–minutes | 0 |
| GitLab, Jenkins | daily snapshots | rebuilt in Delhi from Terraform + backups | 24 h | 4 h |
Drills: a zone-drain game day every month and a full Delhi switchover every quarter (Cloud SQL switchover returns with no data loss). A DR plan that has not been switched over is a guess.
Deadband filters, limits and a tiny anomaly model on the gateway. Most readings never need a cloud model, and fewer messages leave the plant.
Per machine-class anomaly and remaining-useful-life models run inside the Predictive AI pods on ordinary nodes every 5 minutes. No GPU, no always-on prediction endpoint.
Training on Spot capacity from Parquet in Cloud Storage; a new model is registered only if it beats the current one on last quarter's real failures. Drift is watched in Grafana.
Copilot answers with citations from SOPs and manuals, alarm-flood summaries per shift, handover notes and deviation drafts. Gemini Flash in Mumbai, where Google lists in-region ML processing for India; small-model routing, a semantic cache, context caching, batch mode for nightly summaries, and a monthly token budget per site.
Guardrails for GxP: AI suggests, people decide. It never signs, closes a deviation, schedules downtime or touches a machine; every prompt, source and answer is kept with the audit trail.
Assumed load: 25 plants, 1,500 machines, 40 tags per machine sampled every 5 s on average (12,000 points/s, about 1 billion a day), 400 concurrent users, about 5,000 copilot questions a day. Change these and the sizes below change with them.
| Line | Shape | USD / month |
|---|
Indicative list prices, Dec 2026. Compute prices are third-party trackers' asia-south1 figures; Cloud SQL and Memorystore use Google's published rates without confirming the Mumbai column; VPN is $0.05 per tunnel hour. Confirm in the Google Cloud Pricing Calculator before budgeting. INR at ₹93.5 per USD. Sentry SaaS is outside this total.
Monthly cost in USD (₹ at 93.5 per dollar). Money flows left to right: from where it is spent, to what it buys, to the monthly total. Switch between list price and the recommended set from step 9. Ribbon width is proportional to dollars; hover a ribbon for its amount.
Each option shows its saving against the list baseline and what it costs you in risk or effort. Savings multiply, so the total is not a plain sum of the rows.
| Requirement | How ONE MACHINE meets it |
|---|---|
| Audit trail (21 CFR Part 11, EU GMP Annex 11) | Audit & e-Sign: who, what, when, old and new value, reason; insert-only, hash-chained, sealed nightly to a locked bucket. |
| Electronic signatures | Re-authentication with MFA at the moment of signing; signature meaning (reviewed, approved) stored with the record and printed on the PDF. |
| Data integrity (ALCOA+) | Attributable users only (no shared accounts), server-side NTP time, originals kept (raw telemetry plus rollups), retention per client contract. |
| Validated state | Infrastructure only through Terraform and reviewed merge requests (the change record); plan/apply logs and test runs archived as qualification evidence. |
| Access reviews | Client IdP groups map to roles; quarterly review export from Identity Platform and IAM. |
| Business continuity | Section 5 targets, tested by quarterly switchover with a signed report. |