feat(admin): IP2Proxy/IP2Location dataset refresh + freshness readout (BUNYIP-474) #470
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/BUNYIP-474-dataset-age-and-refresh"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes BUNYIP-474 (BUNYIP-437 follow-up): automate the offline IP dataset refresh and make its age observable. Approach confirmed with the team lead: script + scheduled cron (not a compose sidecar).
The datasets are IP2Location LITE
.BINfiles bunyip reads viaIP2LOCATION_DB_PATH(login country) andIP2PROXY_DB_PATH(ASN/VPN enrichment). Theip2locationlibrary never fetches them, so the deployment owns keeping them fresh.Refresh (script + cron)
scripts/refresh-ip2-datasets.shdownloads and installs both LITE.BINfiles from IP2Location using a free download token:.BIN.curl --fail, recursive-not-forced temp cleanup.docs/ip2-dataset-refresh.mddocuments the token, the env wiring, and a monthly cron / systemd-timer / Kubernetes CronJob example.Observability
GET /v1/admin/healthnow returns adatasetsblock. For each file it reads the on-disk mtime and returns(configured, present, age_days, stale), distinguishing three real states: "operator did not deploy it", "path set but file missing", and "deployed but overdue" (stale past 40 days, a week of grace over the monthly cadence). The admin dashboard renders a Datasets card with a per-file age and a Fresh / Stale / Missing / Not configured badge, so a missed refresh is visible without reading logs. The card degrades to absent if the health call fails and never blocks the dashboard. Screenshot below.Acceptance criteria
scripts/refresh-ip2-datasets.sh+ documented monthly schedule./admin/healthdatasets block.Tests / verification
dataset_healthstates.just check-containergreen (fmt, clippy-D warnings, 182 tests).scripts/refresh-ip2-datasets.shpassessh -n. Screenshot of the card:Notes
The
.BINis opened at api startup, so a refresh is picked up on the next restart/deploy; the enrichment/geoip lookups always read the file that was open at boot. This is documented in the runbook.🤖 Generated with Claude Code
https://claude.ai/code/session_018TXaT3P192nDsZzbzHETb9