Deployment

1. Project Overview

Purpose and Scope:
This deployment setup provisions a containerized MQTT server and subscriber application for Freeport FMI, supporting development, pre-production, and production environments. It orchestrates the Mosquitto MQTT broker and a Python-based subscriber (which bridges MQTT to Google Cloud Pub/Sub and BigQuery) using Docker and Supervisor, and deploys the stack to Google Cloud Platform (GCP) using flexible environment configurations.

Primary Use Cases:

Explicitly Not Handled:


2. System Architecture

Core Components and Responsibilities:

Data and Control Flow:

  1. MQTT clients publish sensor data to Mosquitto broker (port 1883).
  2. Python subscriber listens to MQTT topics, processes messages, and forwards them to Pub/Sub and BigQuery.
  3. GCP manages container lifecycle, health checks, and network routing.

External Services and Dependencies:


3. Core Concepts & Domain Logic

Key Abstractions and Domain Terms:

Business/Technical Invariants:

Mental Model:


4. Codebase Structure

High-level Layout:

Responsibility Boundaries:

What Changes Together:


5. Configuration & Environment

Environment Variables:

Configuration Files:

Differences Between Local, Staging, and Production:


6. Runtime Behavior

Startup Sequence:

Normal Execution Flow:

Error Handling and Logging Strategy:


7. Deployment & Operations

Build Process:

Deployment Method:

Runtime Dependencies:

Scaling and Rollback Considerations:


8. Extending the System

Where and How to Add New Features:

Recommended Patterns:

Anti-patterns and Risk Areas:

Testing Strategy:


9. Security & Compliance

Authentication and Authorization:

Secrets Handling:

Data Sensitivity Considerations:


10. Common Pitfalls & Gotchas