Local Development — Ingestor
Prerequisites
Section titled “Prerequisites”- Go (matching version in
ingestor/go.mod) - SQL Server accessible locally (same instance as Cloud Backend, different schema)
- Cloud Backend running locally to register a test device and get a
device_key
cd ingestorcp .env.example .env# Edit .envgo mod downloadgo run .Environment variables
Section titled “Environment variables”| Variable | Example | Notes |
|---|---|---|
DATABASE_URL | sqlserver://sa:Pass@localhost:1433?database=monozu&encrypt=disable | Same DB as Cloud or separate |
PORT | 8081 | Ingestor listen port (avoid conflict with Cloud:8000 and Management:8080) |
HOST_AGENT_BLOB_LOCAL_ROOT | ./.data/host-agent-blobs | Local-disk host_inventory blob store for dev; skips needing AZURE_STORAGE_ACCOUNT |
AZURE_STORAGE_ACCOUNT / AZURE_STORAGE_KEY | — | Azure Blob Storage for host_inventory snapshots in non-local envs |
Get a test device key
Section titled “Get a test device key”Use the claim-code flow or seed a test device via Backend test helpers / repository InsertTestDevice. Registration keys and POST /devices/register are removed.
For integration tests, see Backend/internal/domain/devices/handlers_test.go (TestCommandsFlow seeds devices directly).
Example after you have a device_key from claim-complete or test seed:
Send a test event batch
Section titled “Send a test event batch”curl -X POST http://localhost:8081/v1/ingest \ -H "X-Device-Key: <device_key>" \ -H "Content-Type: application/json" \ -d '{ "device_id": "<device-uuid>", "items": [ { "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "kind": "telemetry", "payload": { "cpu_percent": 12.5, "ts": "2026-06-06T10:00:00Z" } } ] }'
# Expected: 200 OKSend a test host_inventory snapshot (Bearer auth)
Section titled “Send a test host_inventory snapshot (Bearer auth)”Requires an approved Host Agent — approve one via Cloud UI/API to get a host_token, then:
curl -X POST http://localhost:8081/v1/ingest \ -H "Authorization: Bearer hta_<token>" \ -H "Content-Type: application/json" \ -d '{ "items": [ { "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "kind": "host_inventory", "payload": { "host_id": "<host-uuid>", "agent_version": "0.1.0", "os": {"family": "linux"}, "network_interfaces": [] } } ] }'
# Expected: 200 OK, snapshot written to HOST_AGENT_BLOB_LOCAL_ROOT / host_inventory_snapshotsTesting security alert broadcast
Section titled “Testing security alert broadcast”To verify that a security_alert event triggers the WebSocket broadcast:
- Open the Cloud SPA Security module in the browser (connects to
/api/ws/security) - Send a
security_alertingest event (as above) - The alert should appear in the SOC alert inbox within seconds