# Deployment Configurations ## Architecture ``` ┌─────────────┐ ┌─────────────────────────────────────┐ ┌─────────────┐ │ Collector │────▶│ Aggregator + Gateway + Redis + TS │────▶│ Edge │────▶ Browser │ (mcrn) │gRPC │ (LOCAL) │ WS │ (AWS) │ WS └─────────────┘ └─────────────────────────────────────┘ └─────────────┘ ┌─────────────┐ │ │ Collector │────────────────────┘ │ (nfrt) │gRPC └─────────────┘ ``` - **Collectors** use gRPC to stream metrics to the local aggregator - **Gateway** forwards to edge via WebSocket (if `EDGE_URL` configured) - **Edge** (AWS) relays to browsers via WebSocket ## Directory Structure ``` ctrl/ ├── dev/ # Full stack for local development (docker-compose) └── edge/ # Cloud dashboard for AWS deployment ``` ## Local Development ```bash # From repo root docker compose up ``` Runs: aggregator, gateway, collector, alerts, redis, timescaledb ## Production Deployment ### 1. Deploy Edge to AWS ```bash cd ctrl/edge docker compose up -d ``` ### 2. Run Full Stack Locally with Edge Forwarding ```bash EDGE_URL=wss://sysmonstm.mcrn.ar/ws EDGE_API_KEY=xxx docker compose up ``` ### 3. Run Collectors on Other Machines ```bash docker run -d --name sysmonstm-collector --network host \ -e AGGREGATOR_URL=:50051 \ -e MACHINE_ID=$(hostname) \ registry.mcrn.ar/sysmonstm/collector:latest ``` ## Environment Variables ### Gateway (for edge forwarding) - `EDGE_URL` - WebSocket URL of edge (e.g., wss://sysmonstm.mcrn.ar/ws) - `EDGE_API_KEY` - Authentication key for edge ### Edge - `API_KEY` - Key required from gateway ### Collector - `AGGREGATOR_URL` - gRPC URL of aggregator (e.g., localhost:50051) - `MACHINE_ID` - Identifier for this machine