Capture Service
Reads RTL-SDR (or generates fake test data) and writes raw ADS-B packets to PostgreSQL.
What it does
- Waits for PostgreSQL to be ready
- Creates a row in
fr24.captureswith session metadata - Writes fake
fr24.raw_packetsrows every ~2 seconds (14-byte DF17 Mode-S format) - Touches
/tmp/capture-readyfor Docker healthcheck - On SIGTERM: marks the capture session as
stopped
In production, replace the fake packet loop in main.py with real RTL-SDR / dump1090 input.
Dependencies
psycopg2-binary— PostgreSQL driver
Environment variables
| Variable | Default | Description |
|---|---|---|
POSTGRES_HOST |
required | DB host |
POSTGRES_PORT |
5432 |
DB port |
POSTGRES_DB |
required | DB name |
POSTGRES_USER |
required | DB user |
POSTGRES_PASSWORD |
required | DB password |
RTLSDR_CENTER_FREQUENCY |
1090000000 |
Center freq Hz |
RTLSDR_SAMPLE_RATE |
2000000 |
Sample rate Hz |
RTLSDR_DEVICE_INDEX |
0 |
RTL-SDR device index |
RTLSDR_GAIN |
auto |
Gain dB or auto |
PACKET_INTERVAL_SECONDS |
2.0 |
Interval between fake packets |
Run locally
pip install -r requirements.txt
export POSTGRES_HOST=localhost POSTGRES_DB=fr24 POSTGRES_USER=fr24 POSTGRES_PASSWORD=change-me
python main.py
Build & run via Docker
docker build -t fr24-capture .
docker run --env-file ../../compose/.env fr24-capture