fix: Make ADS-B history optional and add tests

- Use Docker Compose profiles to make Postgres optional
- Default `docker compose up` runs without history/Postgres
- Use `docker compose --profile history up` to enable history
- Add 11 unit tests for AdsbHistoryWriter and AdsbSnapshotWriter

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-01-25 13:18:33 +00:00
parent 88537c1119
commit d297f87115
2 changed files with 319 additions and 5 deletions

View File

@@ -1,12 +1,16 @@
# INTERCEPT - Signal Intelligence Platform
# Docker Compose configuration for easy deployment
#
# Basic usage:
# docker compose up -d
#
# With ADS-B history (Postgres):
# docker compose --profile history up -d
services:
intercept:
build: .
container_name: intercept
depends_on:
- adsb_db
ports:
- "5050:5050"
# Privileged mode required for USB SDR device access
@@ -20,6 +24,40 @@ services:
# - ./data:/app/data
# Optional: mount logs directory
# - ./logs:/app/logs
environment:
- INTERCEPT_HOST=0.0.0.0
- INTERCEPT_PORT=5050
- INTERCEPT_LOG_LEVEL=INFO
# ADS-B history is disabled by default
# To enable, use: docker compose --profile history up -d
# - INTERCEPT_ADSB_HISTORY_ENABLED=true
# - INTERCEPT_ADSB_DB_HOST=adsb_db
# - INTERCEPT_ADSB_DB_PORT=5432
# - INTERCEPT_ADSB_DB_NAME=intercept_adsb
# - INTERCEPT_ADSB_DB_USER=intercept
# - INTERCEPT_ADSB_DB_PASSWORD=intercept
# Network mode for WiFi scanning (requires host network)
# network_mode: host
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:5050/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# ADS-B history with Postgres persistence
# Enable with: docker compose --profile history up -d
intercept-history:
build: .
container_name: intercept
profiles:
- history
depends_on:
- adsb_db
ports:
- "5050:5050"
privileged: true
environment:
- INTERCEPT_HOST=0.0.0.0
- INTERCEPT_PORT=5050
@@ -30,8 +68,6 @@ services:
- INTERCEPT_ADSB_DB_NAME=intercept_adsb
- INTERCEPT_ADSB_DB_USER=intercept
- INTERCEPT_ADSB_DB_PASSWORD=intercept
# Network mode for WiFi scanning (requires host network)
# network_mode: host
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:5050/health"]
@@ -43,12 +79,13 @@ services:
adsb_db:
image: postgres:16-alpine
container_name: intercept-adsb-db
profiles:
- history
environment:
- POSTGRES_DB=intercept_adsb
- POSTGRES_USER=intercept
- POSTGRES_PASSWORD=intercept
volumes:
# Move this path to the USB drive later for larger retention
- ./pgdata:/var/lib/postgresql/data
restart: unless-stopped
healthcheck: