# FR24 ingest compose skeleton

This directory contains the Docker Compose skeleton for the RTL-SDR ingest contour.

## Services
- `postgres` — PostgreSQL 16 + PostGIS, single source of truth for ingest and API
- `capture` — RTL-SDR access and `raw_packets` writer
- `preprocess` — normalization, flights/tracks/track_points builder, recovery
- `api` — reader for noisemap UI and future viewer endpoints
- `monitoring` — separate container for healthchecks, disk/DB/capture status, alerts

## Layout
- `../db/postgres` — PostgreSQL data directory
- `../db/init` — bootstrap SQL for extensions and schema
- `../ingest` — capture and preprocess implementation
- `../frontend` — API/viewer implementation
- `../logs/*` — service logs
- `../backup` — pg_dump / restore artifacts

## Architecture notes
- `raw_packets` stores binary payloads as base64 plus metadata: timestamp, frequency, RSSI, SNR, samplerate.
- Raw retention is 3 days.
- Raw data is partitioned by date.
- `capture` and `preprocess` are separate containers.
- `api` is included now so the ingest↔API contract is fixed early.
- The contract between ingest and API is the PostgreSQL schema itself: ingest writes tables, API reads the same tables.

## API / data contract
The API reads:
- `captures`
- `raw_packets`
- `aircraft`
- `flights`
- `track_points`
- `tracks`
- `processing_state`
- `noise_results`

Planned endpoints:
- `GET /health` — service status
- `GET /captures` — capture sessions
- `GET /aircraft` — aircraft list and search
- `GET /flights` — flights with filters
- `GET /tracks/{track_id}` — a single track with points
- `GET /noise-results` — noise polygons and summaries
- `GET /dashboard/status` — ingest / recovery / backlog status for UI
- `GET /viewer/config` — map/UI bootstrap metadata

## Notes
- No runtime is started from this repository during preparation.
- The stack expects a `.env` file copied from `.env.example` in this directory.
