feat(vessels): VesselAPI quota-capped AIS poller for Middle East blind spot
Add a server-side REST poller for VesselAPI (free tier 150 calls/mo) that upserts last-known positions into the shared vessel_last_known store when AISStream is unset. Default box is the Strait of Hormuz (span 3.6 <= 4 deg), never CONUS/NC (AISStream owns US coasts). - app/vesselapi.py: worker loop, 4deg span validator, position->marker transform (skip suspected_glitch), durable Postgres daily-quota table. - Local hard cap 5 successful 2xx/UTC day (VESSELAPI_MAX_CALLS_PER_DAY), monthly floor from X-RateLimit-Remaining, single request limit=50, no nextToken, no filter.sat, no retry-storm. - keystore VESSELAPI_API_KEY registry entry; config + compose env passthrough (app + ingest); wired next to AISStream in main.py lifespan + run_ingester. - GET /api/vessels docstring notes AISStream and/or VesselAPI cache. - tests/test_vesselapi.py: 20 unit tests (no network/DB).
This commit is contained in:
parent
30a9c9e9b1
commit
1f23083351
8 changed files with 806 additions and 3 deletions
16
.env.example
16
.env.example
|
|
@ -59,6 +59,22 @@ FIRMS_INTERVAL=900
|
|||
# Set to 0 to disable the fire loop entirely.
|
||||
INGEST_FIRES=1
|
||||
|
||||
# ── VesselAPI (quota-capped REST AIS poller — free tier 150 calls/mo) ─────
|
||||
# AISStream keeps US coasts live; VesselAPI fills the Middle East blind spot.
|
||||
# The poller idles when VESSELAPI_API_KEY is unset. Never called from the map
|
||||
# pans (GET /api/vessels serves the shared last-known cache only).
|
||||
VESSELAPI_API_KEY=
|
||||
# Bounding box(es) as minlat,minlon,maxlat,maxlon (lat/lon order). Semicolon-
|
||||
# separated for multiple boxes. Default = Strait of Hormuz (span 3.6 ≤ 4° cap).
|
||||
VESSELAPI_BBOX=25.5,55.4,27.3,57.2
|
||||
# Poll cadence in seconds (17280 = 4.8h → 5 polls/day = 150/mo).
|
||||
VESSELAPI_INTERVAL=17280
|
||||
# Local hard cap on successful 2xx calls per UTC day (persisted in Postgres).
|
||||
VESSELAPI_MAX_CALLS_PER_DAY=5
|
||||
# 1 = run the poller inside the dashboard process (default); ingester off.
|
||||
VESSELAPI_IN_APP=1
|
||||
VESSELAPI_IN_INGEST=0
|
||||
|
||||
# ── API keys (managed from the dashboard UI) ──────────────────────────────
|
||||
# Keys such as NOUS_API_KEY and TELEGRAM_TOKEN are stored in the Postgres
|
||||
# `api_keys` table and managed from the dashboard's "Keys" tab
|
||||
|
|
|
|||
Loading…
Reference in a new issue