mikenikles / your-analytics

Web analytics platform. Open source, privacy-focused and simple.
https://your-analytics.org
40 stars 8 forks source link

Fix the world map #203

Closed mikenikles closed 4 years ago

mikenikles commented 4 years ago
Error: [Error: ENOENT: no such file or directory, open './geo-db/GeoLite2-City.mmdb']

This is due to https://github.com/mikenikles/your-analytics/pull/188/files#diff-ebd337fffbdad21b4b3ca730397efe30R14. The events-api root directory is the monorepo root, so the following code can no longer open the GEO db:

readGeoFromIp = await Geo2IpReader.open(
  "./geo-db/GeoLite2-City.mmdb"
);

As part of this fix, also remove the GEO db from the source code and instead download and install it in the Dockerfile directly. This ensures it stays up-to-date with each rebuild of the events-api. Important: Make sure the service throws an exception and does not start if the GEO db is missing.