simple is better
This commit is contained in:
104
ctrl/README.md
104
ctrl/README.md
@@ -1,82 +1,72 @@
|
||||
# Deployment Configurations
|
||||
|
||||
This directory contains deployment configurations for sysmonstm.
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
||||
│ Collector │────▶│ Hub │────▶│ Edge │────▶│ Browser │
|
||||
│ (mcrn) │ │ (local) │ │ (AWS) │ │ │
|
||||
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
|
||||
┌─────────────┐ │
|
||||
│ Collector │────────────┘
|
||||
│ (nfrt) │
|
||||
┌─────────────┐ ┌─────────────────────────────────────┐ ┌─────────────┐
|
||||
│ 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/
|
||||
├── collector/ # Lightweight agent for each monitored machine
|
||||
├── hub/ # Local aggregator (receives from collectors, forwards to edge)
|
||||
├── edge/ # Cloud dashboard (public-facing, receives from hub)
|
||||
└── dev/ # Full gRPC stack for development
|
||||
├── dev/ # Full stack for local development (docker-compose)
|
||||
└── edge/ # Cloud dashboard for AWS deployment
|
||||
```
|
||||
|
||||
## Production Deployment (3-tier)
|
||||
|
||||
### 1. Edge (AWS)
|
||||
Public-facing dashboard that receives metrics from hub.
|
||||
|
||||
```bash
|
||||
cd ctrl/edge
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### 2. Hub (Local Server)
|
||||
Runs on your local network, receives from collectors, forwards to edge.
|
||||
|
||||
```bash
|
||||
cd ctrl/hub
|
||||
EDGE_URL=wss://sysmonstm.mcrn.ar/ws EDGE_API_KEY=xxx docker compose up -d
|
||||
```
|
||||
|
||||
### 3. Collectors (Each Machine)
|
||||
Run on each machine you want to monitor.
|
||||
|
||||
```bash
|
||||
docker run -d --name sysmonstm-collector --network host \
|
||||
-e HUB_URL=ws://hub-machine:8080/ws \
|
||||
-e MACHINE_ID=$(hostname) \
|
||||
-e API_KEY=xxx \
|
||||
registry.mcrn.ar/sysmonstm/collector:latest
|
||||
```
|
||||
|
||||
## Development (Full Stack)
|
||||
|
||||
For local development with the complete gRPC-based architecture:
|
||||
## Local Development
|
||||
|
||||
```bash
|
||||
# From repo root
|
||||
docker compose up
|
||||
```
|
||||
|
||||
This runs: aggregator, gateway, collector, alerts, redis, timescaledb
|
||||
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=<local-gateway-ip>:50051 \
|
||||
-e MACHINE_ID=$(hostname) \
|
||||
registry.mcrn.ar/sysmonstm/collector:latest
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
### Collector
|
||||
- `HUB_URL` - WebSocket URL of hub (default: ws://localhost:8080/ws)
|
||||
- `MACHINE_ID` - Identifier for this machine (default: hostname)
|
||||
- `API_KEY` - Authentication key
|
||||
- `INTERVAL` - Seconds between collections (default: 5)
|
||||
|
||||
### Hub
|
||||
- `API_KEY` - Key required from collectors
|
||||
- `EDGE_URL` - WebSocket URL of edge (optional, for forwarding)
|
||||
- `EDGE_API_KEY` - Key for authenticating to edge
|
||||
### 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 hub
|
||||
- `API_KEY` - Key required from gateway
|
||||
|
||||
### Collector
|
||||
- `AGGREGATOR_URL` - gRPC URL of aggregator (e.g., localhost:50051)
|
||||
- `MACHINE_ID` - Identifier for this machine
|
||||
|
||||
Reference in New Issue
Block a user