OpenTrack Engine is a high-performance ML inference orchestration system designed for Industrial IoT (IIoT) environments. It leverages the Web of Things (WoT) standard for device interaction and uses Kubernetes to manage ephemeral, scheduled, and on-demand inference workloads. Results are published to Apache Kafka following the CloudEvents v1.0 specification.
The system follows a control-plane/data-plane separation:
- Control Plane (REST API): Built with FastAPI, it manages the lifecycle of automations, persisting metadata in SQLite and orchestrating Kubernetes resources.
- Data Plane (Ephemeral Worker): Lightweight Python-based containers triggered by Kubernetes
CronJobsorJobs. They fetch real-time telemetry from WoT "Things", run inference, and terminate. - Messaging Layer (Kafka): A reliable bus for distributing inference results to downstream consumers (e.g., Dashboards, ERPs, Alert Systems).
- Native K8s Orchestration: Automations are translated into
CronJobs. Manual triggers create instantJobs. - WoT Integration: Dynamic data collection based on Thing Descriptions (TD).
- Standardized Messaging: Native support for CloudEvents over Kafka.
- Concurrency Control: Prevents job overlap using Kubernetes
Forbidpolicy. - Full Observability: Track execution history and logs directly via the API.
- Kubernetes Cluster: Docker Desktop, Minikube, or a production-grade cluster.
- Apache Kafka: Accessible brokers for message publication.
- Python 3.11+: For local development and API execution.
- Docker: For building worker images.
The system uses a .env file for environment-specific settings.
| Variable | Description | Default |
|---|---|---|
KUBERNETES_NAMESPACE |
K8s namespace for worker execution | (Required) |
KAFKA_BROKERS |
Comma-separated list of Kafka brokers | (Required) |
THINGS_SERVICE_URL |
Base URL for the WoT Things Service | (Required) |
WORKER_IMAGE |
Docker image for the worker | opentrack-worker:latest |
DATABASE_URL |
SQLite database path | sqlite:///./automations.db |
# Clone and enter the repo
cd opentrack-engine
# Create and configure .env
cp .env.example .env # Edit with your laboratory IPs
# Install dependencies
pip install -r requirements.txtdocker build -t opentrack-worker:latest ./workerkubectl apply -f rbac.yaml$env:PYTHONPATH = "."
uvicorn src.main:app --port 8000 --reloadAccess the interactive documentation at http://localhost:8000/docs.
POST /api/v1/automations/
{
"name": "Machine Temperature Monitor",
"cron_expression": "*/5 * * * *",
"ml_model": "temp-anomaly-v1",
"source_things": {
"urn:dev:ops:sensor-01": [
{ "property": "temperature", "mapping_key": "t1" }
]
},
"target_events": [
{ "topic": "alerts.temperature", "event_type": "io.opentrack.anomaly" }
]
}Run the test suite to verify the integration:
pytest tests/- RUNBOOK.txt: Technical deployment and troubleshooting guide.
- PROJECT_EXPLANATION.txt: Architectural deep-dive.