Skip to content

fadelbay/plantio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Plantio - Industrial IoT Data Pipeline

🎯 Status: PRODUCTION READY βœ…

Plantio is a complete industrial IoT data pipeline that simulates sensor data and publishes it to MQTT brokers. The system is now fully operational with both local and Kubernetes deployments working.

πŸ—οΈ Architecture

[Plantio Feeder] β†’ [MQTT Broker] β†’ [Data Consumers]
  • Feeder Service: Rust-based service generating realistic industrial sensor data
  • MQTT Broker: Mosquitto broker for data distribution
  • Data Consumers: Python subscribers, dashboards, analytics

πŸš€ Quick Start

Option 1: Local Development

# 1. Start MQTT broker (local)
docker run -d -p 1883:1883 eclipse-mosquitto:2.0.15

# 2. Run feeder
cd services/feeder
export RUST_LOG=debug
cargo run

# 3. Test data flow
python test-mqtt-subscriber.py

Option 2: Kubernetes Deployment

# 1. Deploy MQTT broker
kubectl apply -f deployments/mqtt/mosquitto-deployment.yaml

# 2. Deploy feeder
kubectl apply -f deployments/feeder/feeder-deployment.yaml

# 3. Port forward for local access
kubectl port-forward -n mosquitto svc/mosquitto-service 1884:1883

# 4. Test data flow
cd services/feeder
python test-k8s-subscriber.py

πŸ“ Project Structure

plantio/
β”œβ”€β”€ services/
β”‚   └── feeder/                 # Rust feeder service
β”‚       β”œβ”€β”€ src/main.rs         # Main application
β”‚       β”œβ”€β”€ Dockerfile          # Container build
β”‚       β”œβ”€β”€ README.md           # Service documentation
β”‚       └── test-*.py           # Test scripts
β”œβ”€β”€ deployments/
β”‚   β”œβ”€β”€ mqtt/                   # MQTT broker deployment
β”‚   β”‚   β”œβ”€β”€ mosquitto-deployment.yaml
β”‚   β”‚   └── README.md
β”‚   └── feeder/                 # Feeder deployment
β”‚       β”œβ”€β”€ feeder-deployment.yaml
β”‚       └── README.md
β”œβ”€β”€ docs/                       # Documentation
β”œβ”€β”€ scripts/                    # Deployment scripts
└── SIMPLIFIED_PROJECT_GUIDE.md # Quick reference

πŸ”§ Configuration

Environment Variables

MQTT_BROKER=localhost          # MQTT broker hostname
MQTT_PORT=1883                 # MQTT broker port
MQTT_TOPIC=plantio-iot-sensors-raw     # MQTT topic
PUBLISH_INTERVAL=5             # Seconds between publishes
RUST_LOG=info                  # Log level

Kubernetes Configuration

  • MQTT Broker: mosquitto-service.mosquitto.svc.cluster.local:1883
  • Feeder Service: plantio-feeder-service.plantio-feeder.svc.cluster.local
  • Namespaces: mosquitto, plantio-feeder

πŸ“Š Data Format

The feeder publishes JSON data with this structure:

{
  "device": {
    "device_id": "MOTOR001",
    "name": "Industrial Motor",
    "type": "industrial_asset",
    "location": "Plant A",
    "asset_type": "motor"
  },
  "sensor_data": {
    "measurements": {
      "temperature": 45.2,
      "vibration": 2.36,
      "current": 14.89,
      "voltage": 511.17,
      "power": 7.35,
      "speed": 1611.53,
      "efficiency": 86.96,
      "status": 1.0,
      "uptime_hours": 3426.27
    }
  },
  "timestamp": "2025-08-06T15:26:50.380771500Z"
}

🏭 Supported Assets

  1. Industrial Motor - Temperature, vibration, current, voltage, power, speed
  2. Gas Turbine - Temperature, pressure, fuel flow, exhaust temp, power output
  3. Forced Draft Fan - Temperature, pressure, air flow, vibration, power
  4. Induced Draft Fan - Temperature, pressure, air flow, vibration, power
  5. Condensate Pump - Temperature, pressure, flow rate, vibration, power

πŸ§ͺ Testing

Test Scripts

  • test-mqtt-subscriber.py - Basic MQTT subscriber
  • test-k8s-subscriber.py - Kubernetes-specific subscriber
  • test-mqtt-broker-working.sh - MQTT broker connectivity test
  • test-local-feeder-k8s-mqtt-python.sh - Local feeder + K8s MQTT test

Quick Tests

# Test MQTT broker
./test-mqtt-broker-working.sh

# Test local feeder + K8s MQTT
./test-local-feeder-k8s-mqtt-python.sh

# Monitor K8s feeder logs
kubectl logs -f deployment/plantio-feeder -n plantio-feeder

πŸš€ Deployment

Docker Build & Push

cd services/feeder
./push-image.sh

Kubernetes Deployment

# Deploy everything
kubectl apply -f deployments/mqtt/mosquitto-deployment.yaml
kubectl apply -f deployments/feeder/feeder-deployment.yaml

# Check status
kubectl get pods -n mosquitto
kubectl get pods -n plantio-feeder

πŸ“ˆ Monitoring

Kubernetes Resources

# Check pod status
kubectl get pods -n mosquitto -n plantio-feeder

# View logs
kubectl logs -f deployment/mosquitto -n mosquitto
kubectl logs -f deployment/plantio-feeder -n plantio-feeder

# Check services
kubectl get svc -n mosquitto -n plantio-feeder

Data Flow Monitoring

  • MQTT Messages: Monitor topic plantio-iot-sensors-raw
  • Publish Rate: Every 5-10 seconds per asset
  • Data Volume: ~5 assets Γ— 9 sensors = 45 measurements per cycle

πŸ”’ Security

Current Setup

  • MQTT: Anonymous access (development)
  • Kubernetes: Default security contexts
  • Network: Internal cluster networking

Production Recommendations

  • Enable MQTT authentication
  • Add TLS encryption
  • Implement network policies
  • Use secrets for sensitive data

πŸ› οΈ Development

Local Development

cd services/feeder
cargo run

Building

# Debug build
cargo build

# Release build
cargo build --release

# Docker build
docker build -t plantio-feeder .

πŸ“š Documentation

  • Service Guide: services/feeder/README.md
  • Deployment Guide: deployments/feeder/README.md
  • MQTT Guide: deployments/mqtt/README.md
  • Quick Reference: SIMPLIFIED_PROJECT_GUIDE.md

🎯 Next Steps

  1. Add Authentication - MQTT username/password
  2. Enable TLS - Secure MQTT connections
  3. Add Monitoring - Prometheus metrics, Grafana dashboards
  4. Scale Deployment - Horizontal Pod Autoscaler
  5. Add Consumers - Data processing pipelines, analytics

πŸ“„ License

This project is part of the Plantio industrial IoT platform.


Status: βœ… Production Ready | Last Updated: August 2025

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •