feat(geoip): in-app database refresh — GeoLite2 with DB-IP Lite fallback, console-managed key - #149
Merged
Merged
Conversation
…ack, admin surface 🤖 Built with SMT <smt@agora.build>
…oads with a timeout 🤖 Built with SMT <smt@agora.build>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the cron-based
scripts/geoip-refresh.shwith an in-app GeoIP database manager, so redeploys are hands-off (Coolify containers have ephemeral filesystems — the old cron-managed./geoipdir vanished on every redeploy).What
server/geoip-refresh.ts: source selection — console-managed MaxMind key >MAXMIND_LICENSE_KEYenv > DB-IP Lite fallback (same MMDB format, no account/key, CC-BY 4.0, monthly builds with previous-month 404 fallback). Download → validate (size +maxmind.open) → atomic rename to canonicalCity.mmdb/ASN.mmdb→ hot reader reload. Failures keep the serving databases untouched (proven live against a real bogus-key 401).PUT/DELETE /api/admin/geoip/maxmind-key— stored encrypted insystemConfigvia the existing credential encryption, never echoed, save triggers an immediate GeoLite2 refresh), and the DB-IP attribution line when on the fallback source.DOWNLOAD_TIMEOUT_MS = 120sso a hung fetch can never wedge the refresh state.scripts/geoip-refresh.shdeleted; CLAUDE.md env docs updated (MAXMIND_LICENSE_KEYnow optional/bootstrap-only).Verification
npm run check+ eslint clean.Generated with SMT smt@agora.build