speedtest icon indicating copy to clipboard operation
speedtest copied to clipboard

Support for specifying local mmdbs for ASN, city, country

Open GlenNicholls opened this issue 1 month ago • 0 comments

Description

I already have a maxmindinc/geoipupdate Docker image and would like to map local .mmdb files in my librespeed config.

Why it should be implemented

  • Would simplify librespeed deployment when local IP info DBs are already present
  • Privacy - I don't need to give a third party every DB query
  • I control the update frequency
  • Provides another option aside from ipinfo.io

Optional: implementation suggestions

Looks like ipinfo.io also supports downloading relevant DBs, so I think it makes sense to allow the user to volume map .mmdb and have environment variables define the ASN, city, and country DBs. The default would be what currently exists, but the code wouldn't attempt an external query if it finds what it needs locally.

The below docker-compose.yml is what I think this could look like from the config perspective:

volumes:
  geoip-data:

services:
  geoip:
    image: maxmindinc/geoipupdate
    volumes:
      - geoip-data:/geoip
    environment:
      GEOIPUPDATE_ACCOUNT_ID: ${MAXMIND_ID}
      GEOIPUPDATE_LICENSE_KEY: ${MAXMIND_API_KEY}
      GEOIPUPDATE_EDITION_IDS: GeoLite2-ASN GeoLite2-City GeoLite2-Country
      GEOIPUPDATE_FREQUENCY: 168
    
  speedtest:
    image: librespeed/speedtest
    volumes:
      - geoip-data:/geoip:ro
    environment:
      MODE: standalone
      DISABLE_IPINFO: false
      DISTANCE: "mi"
      IPINFO_ASN_DB: /geoip/GeoLite2-ASN.mmdb # default /var/www/html/backend/country_asn.mmdb
      IPINFO_CITY_DB: /geoip/GeoLite2-City.mmdb # default "" - would query externally if this isn't set
      IPINFO_COUNTRY_DB: /geoip/GeoLite2-Country.mmdb # default /var/www/html/backend/country_asn.mmdb
      # ... remainder of config

GlenNicholls avatar Dec 08 '25 18:12 GlenNicholls