GeoWatch

Interface for location, monitoring and controlling devices

Your Docker Compose architecture is designed to facilitate a constant data flow from sensor devices (like ESP32) to a backend system, where data is processed and stored in a PostgreSQL/PostGIS database. The following outlines the key components and their interactions based on your provided configuration:

Architecture Overview

1. Sensor Devices

  • Function: These devices act as data sources, sending their schema and sensor data via MQTT.
  • Data Flow:
    • Schema sent to: /box/boxname/schema
    • Sensor data sent to: /box/boxname/data

2. MQTT Broker

  • Service: mqtt
  • Image: eclipse-mosquitto
  • Role: Acts as the messaging hub for receiving data from sensors and distributing it to the backend service.
  • Ports: Exposes port 1883 for MQTT communication.

3. Backend Service

  • Service: backend
  • Build Context: Located in ./backend
  • Role:
    • Subscribes to MQTT topics to receive sensor data.
    • Processes and saves this data into the PostgreSQL database.
  • Environment Variables:
    • Configured with MQTT broker details and database credentials.

4. PostgreSQL with PostGIS

  • Service: db
  • Image: postgis/postgis
  • Role:
    • Stores geospatial data and sensor readings.
    • Allows for advanced queries on spatial data.
  • Volumes: Persists data in a defined volume.

5. Grafana

  • Service: grafana
  • Image: grafana/grafana
  • Role: Visualizes the data stored in PostgreSQL.
  • Ports: Exposes port 3000 for web access.
  • Plugins Installed: Includes various plugins for enhanced visualization capabilities.

6. Streamlit

  • Service: streamlit
  • Build Context: Located in ./frontend
  • Role: Provides an interactive web application for displaying device locations and statistics.
  • Ports: Exposes port 8501 for user access.

Data Flow Diagram

[ESP32 Sensors] --(MQTT)--> [MQTT Broker] --(Data)--> [Backend]
         |                          |                      |
         |                          |                      |
         +------------------------->+                      |
                                 (Schema)                |
                                                       [PostgreSQL]
                                                         |
                                                         |
                                                      [Grafana]
                                                         |
                                                      [Streamlit]

Key Features

  • Real-time Data Processing: The architecture allows for immediate processing of incoming sensor data through the backend service.
  • Geospatial Capabilities: Using PostGIS enables advanced geospatial queries, making it suitable for applications in precision agriculture and environmental monitoring.
  • Visualization Tools: Grafana and Streamlit provide robust platforms for visualizing and interacting with the collected data.