Skip to content

Simple Platform for OTA update

Tamtikorn Kietipungchai edited this page Mar 11, 2025 · 7 revisions

On-premise IoT Infrastructure

{B4A273FF-EC17-4543-84A2-AD98AD1E3639}

  • IAQ Sensor: A Python agent that simulates IoT sensor data to publish to an event streaming bus every 5 seconds.

  • Datalogger: A Python agent that subscribes to IoT data payloads from IoT sensor agents and stores them in a SQL database.

  • RabbitMQ: A service for Agents to PUB-SUB data payloads.

  • PostgreSQL: A SQL database for storing historical data from IoT sensors with the following schema

    • timestamp (INTEGER): Unix timestamp of the data point
    • datetime (TIMESTAMPTZ): Datetime of the data point
    • device_id (TEXT): Unique identifier of the device
    • datapoint (TEXT): Type of measurement (e.g., temperature, humidity)
    • value (TEXT): Measured value (use TEXT type because some value is string)

    {69D6476F-10BD-44B3-AFB3-056BC3656624} Simple Data

  • API (Add-on): A FastAPI web application for querying data from an SQL database.

    {E832DC68-7F1D-4D23-8CE9-7247678B157A} API Swagger

Docker-Compose Deployment

The infrastructure can be deployed easily with minimal effort using a Docker Compose script to set up and run the entire system.

docker compose up --build -d

Cloud-to-Device Deployment Pipeline through Azure IoT Edge

  • Container Registry Integration

    • Set up Azure Container Registry (ACR) for image storage

      {08340286-294D-47B0-BD12-BD018970F538}

      Azure Container Registry

    • Configure Jenkins Job to:

      • Build container images
      • Push images to ACR

      https://github.com/Ganthepro/iot-infrastructure/blob/main/Jenkinsfile

      {0663321C-D709-44B2-AC38-2FA76FDAB54F} Jenkins CI Pipeline

    • Trigger deployment updates

      Trigger an OTA deployment update to Azure IoT Hub using an Azure Function when an image is pushed.

      {B983FA30-A846-4CB4-9C24-5E595201FB20}

  • Azure IoT Edge Integration

    • Configure Azure IoT Edge runtime environment to target On-premise devices

      Create IoT Edge device on Linux using symmetric keys - Azure IoT Edge

    • Set up Azure IoT Edge modules for container deployment

      • edgeAgent (default container from Azure)
      • edgeHub (default container from Azure)
      • IAQ Agent
      • DataLogger Agent
      • PostgreSQL
      • RabbitMQ
      • API

      {861C7619-23A5-4E93-97BE-6CF6F1892A56} Azure IoT Edge modules

  • Deployment Management

    • Implement a Cloud-to-Device (C2D) command using the Azure IoT Service SDK to trigger deployment on on-premise device(s)

      npm: azure-iothub

    • Create deployment & configuration manifests for IoT Edge modules

      {9DB94393-A252-4FAA-9E0D-D843246AC523} IoT Deployment Platform (Web Application)

      Create configuration manifest in the Web App.

      {13850D9F-84E0-4DEF-9E61-C9AAF42BB372}

      After creating a configuration manifest in the Web App, you can check it on the Azure Portal.

      {C91D53F4-89AF-43A6-9596-942AA69EAEE5}

    • Implement deployment tracking and logging

      {3C6FC69F-1EDB-4D9E-8AC2-A7E9A45E0A4D} Configuration Logging

      Deployment Logging and Tracking with Success/Failure status

      {BE0DEA01-4082-4148-B634-E6215AA16B5E}

Centralized Deployment Platform

  • Web Development

    Using React.js for the frontend, NestJS (Node.js) for the backend, and MongoDB as the database, with a CI/CD pipeline implemented using Jenkins to deploy containers to the target web server.

    • GitHub tag integration

      Display service versions alongside their corresponding site deployments with connection state on the website.

      {F2F73144-AEC7-4E55-B5B4-DAD7D8C2EB56}

    • Version management

      Display available software versions that haven't been deployed yet.

      {A8833F09-4E8A-4188-B0A6-CDA0BF6C24EF} configuration page

  • Deployment Command

    • Support single or multiple deployment target devices and separate agent installation for each deployment target

      {06080E8A-5460-4C8F-A070-4CA0DCB4FCCA}

  • Database and Deployment's Event Logs

    mermaid-diagram-2025-03-11-124452

    ER Diagram

    mermaid-diagram-2025-03-11-124523

    Logical Data Modeling

    • Maintain a record of service versions currently deployed across different sites

      View all configuration modules, services, and their versions.

      {27437D92-0337-4409-A729-C85B0107B2E1}

    • Track and store deployment logs with success/failure status information

      {65305215-A8D1-4BBE-8D7A-AD3B9E65B854} deployment page

Sequence Diagram

  • On-premise IoT Infrastructure

    mermaid-diagram-2025-03-04-100736

  • Cloud-to-Device Deployment Pipeline through Azure IoT Edge

    mermaid-diagram-2025-03-04-101640

  • Centralized Deployment Platform

    mermaid-diagram-2025-03-04-103716

System Architecture

devops engineer test Functional Architecture

Untitled diagram-2025-03-05-052502 Software Architecture

Source Code

Demo