Skip to content

feat(backend): download IP lookup databases at build time - #683

Merged
JuliusHenke merged 1 commit into
masterfrom
claude/project-thread-0s3fec
Nov 4, 2026
Merged

JuliusHenke merged 1 commit into
masterfrom
claude/project-thread-0s3fec

Conversation

@JuliusHenke

@JuliusHenke JuliusHenke commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Requested by ju · project thread

Stops storing the IP lookup databases in git, so the repo no longer grows by about 65 MB with every monthly update. The databases now come from the immutable monthly releases of TorMap/ip-lookup-data. The first one, 2026-11, is published.

Changes

  • New Gradle task downloadIpLookupDatabases replaces unpackIpLookupDatabases. It downloads the release named by ipLookupDataVersion in backend/gradle.properties from https://github.com/TorMap/ip-lookup-data/releases/download/<version>/, checks both files against the release's SHA256SUMS, and unpacks them to location.mmdb and autonomous-system.mmdb in the same generated resource folder as before. It has no new dependencies or repositories. -PipLookupDataUrl=file:///<dir> builds offline.
  • backend/ip-lookup/*.zip removed (the history keeps the existing ~50 MB; no rewrite).
  • Autonomous systems now come from DB-IP ASN Lite (CC BY 4.0) instead of MaxMind GeoLite2 ASN. That removes the MaxMind account, license key and EULA, which requires deleting old copies within 30 days. Attribution is updated in the README and About dialog.
  • Renovate: a regex custom manager tracks GitHub releases of TorMap/ip-lookup-data (YYYY-MM, year = major) with no release-age delay, because the releases are immutable.
  • IpLookupServiceTest now runs without a Spring context or database, and also checks the AS organization.
  • THREAT_MODEL supply-chain line and backend README updated.

Data quality

I looked up all 9,479 running relays from Onionoo (Tor Project, IPFire-based AS data) on 2026-11-04:

Check DB-IP Lite 2026-11 GeoLite2 ASN 2023-12 (current repo)
AS found 99.98% 82.93%
AS number matches Onionoo 99.96% (2 differ) 63.64%
AS name matches Onionoo 99.02%
Country matches Onionoo (City Lite) 95.94%

Testing

  • backend_test CI passes against the published 2026-11 release, with the full test suite.
  • Locally, the release's SHA-256 checksums match a direct download from db-ip.com. IpLookupServiceTest passes 7/7, which confirms the GeoIP2 reader accepts the DB-IP ASN database (DBIP-ASN-Lite (compat=GeoLite2-ASN)).
  • A wrong checksum fails with SHA-256 mismatch for …/dbip-asn-lite.mmdb.gz. A missing release fails with Could not download …/SHA256SUMS. The task is up to date on a second run.
  • I didn't run the Renovate config validator.

Deployment notes

Published images are unaffected. Anyone building the backend needs access to github.com on the first build, or must use -PipLookupDataUrl. The unpacked location database is now about 127 MB (the 2026-11 edition), so the JAR and image grow accordingly.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SWRrkPsxib5FkfeDUyteh5

Stop storing the IP lookup databases in git. The build downloads the
release pinned by ipLookupDataVersion from TorMap/ip-lookup-data, an
immutable monthly mirror of DB-IP Lite, and verifies it against the
release's SHA256SUMS. Renovate updates the version.

Autonomous system data now comes from DB-IP ASN Lite instead of MaxMind
GeoLite2 ASN, so no MaxMind account or EULA is needed. It matched
Onionoo's AS numbers for 9,475 of 9,477 running relays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SWRrkPsxib5FkfeDUyteh5
@JuliusHenke JuliusHenke added enhancement New feature or request frontend backend deployment Operators must take action when deploying labels Nov 4, 2026 — with Claude
@JuliusHenke JuliusHenke self-assigned this Nov 4, 2026

Copy link
Copy Markdown
Member Author

backend_test fails at downloadIpLookupDatabases, as expected for this draft: https://github.com/TorMap/ip-lookup-data/releases/download/2026-11/SHA256SUMS returns 404 because the TorMap/ip-lookup-data repo and its first release don't exist yet. The PR can't fix this. It's blocked until that repo is created and its release workflow has published 2026-11. Then a re-run should pass, and I'll mark the PR ready.


Generated by Claude Code

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit dba5b6c):

https://tormap-36f44--pr683-claude-project-threa-ag0tajr7.web.app

(expires Sat, 07 Nov 2026 10:44:45 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 0c1f71965de18e60b0e686b0d0356977fec090dc

@JuliusHenke
JuliusHenke marked this pull request as ready for review November 4, 2026 10:57
@JuliusHenke
JuliusHenke merged commit 66b10a9 into master Nov 4, 2026
17 of 18 checks passed
@JuliusHenke
JuliusHenke deleted the claude/project-thread-0s3fec branch November 4, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend deployment Operators must take action when deploying enhancement New feature or request frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants