Skip to content

feat(rotor): support loading MaxMind databases from a local path#1401

Open
UditDewan wants to merge 1 commit into
jitsucom:newjitsufrom
UditDewan:feat/maxmind-local-path
Open

feat(rotor): support loading MaxMind databases from a local path#1401
UditDewan wants to merge 1 commit into
jitsucom:newjitsufrom
UditDewan:feat/maxmind-local-path

Conversation

@UditDewan

Copy link
Copy Markdown

What

Adds a MAXMIND_PATH environment variable to rotor so GeoIP databases can be loaded from the local filesystem, as an alternative to MAXMIND_LICENSE_KEY, MAXMIND_URL and MAXMIND_S3_BUCKET.

Closes #1080

How it works

MAXMIND_PATH can point to:

  • a directory containing <Edition>.mmdb or <Edition>.tar.gz files (e.g. GeoLite2-City.mmdb, GeoLite2-ASN.mmdb) — this is exactly the layout produced by MaxMind's official geoipupdate tool, so a volume shared with a geoipupdate sidecar works out of the box;
  • a single file named after its edition, e.g. /data/GeoLite2-City.mmdb or /data/GeoIP2-City.tar.gz.

Missing editions degrade the same way they do for the URL/S3 loaders: the existing paid→free fallback logic in download() is reused unchanged, and if nothing can be loaded rotor falls back to the dummy resolver with a warning instead of crashing.

Testing

  • New unit tests in services/rotor/__tests__/maxmind-path.test.ts cover directory lookup, single-file lookup, tar.gz extraction and error cases (vitest run __tests__/maxmind-path.test.ts — 4 passed).
  • pnpm typecheck and eslint pass on the touched files.

Adds MAXMIND_PATH env var as an alternative to MAXMIND_LICENSE_KEY,
MAXMIND_URL and MAXMIND_S3_BUCKET. The path can point to a directory
containing <Edition>.mmdb or <Edition>.tar.gz files (the layout produced
by MaxMind's geoipupdate tool) or to a single such file.

Closes jitsucom#1080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[@jitsu/rotor]: add support for Maxmind local file

1 participant