Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

Automatic GeoIP Plugin #115

Closed
mariusandra opened this issue Jan 26, 2021 · 1 comment
Closed

Automatic GeoIP Plugin #115

mariusandra opened this issue Jan 26, 2021 · 1 comment

Comments

@mariusandra
Copy link
Collaborator

As discussed in ops, we can go for the maxmind geoip redistributing license, pay them a bit of money and then distribute the geolite city database with the plugin server to offer effortless and "good enough" quality GeoIP information.

Things we need to make this work:

  • Get the commercial redistribution license and double check there's nothing there against using it in open source projects.
  • Create a new private Github repository that will:
    • Store the latest .mmdb (or compressed) geolite2 database
    • Deploy this to a custom subdomain on netlify or S3 or wherever, so we can access the database via HTTP on something like https://geoip.posthog.com/ip/latest.mmdb
    • Have a scheduled github action to update the database each month from maxmind
    • Also store the md5sum of the database in latest.md5sum or whatever, as we need to periodically update the database from the app and this helps quickly check if we're on the latest or not.
  • Expose a geoip global function object to plugin users
    • This would wrap this new Reader().get() line inside geoip.get(), just with a preconfigured database.
    • There needs to be a way to download the initial database and update it periodically. The plugin should be disabled until the database is downloaded... or it could await for it in geoip.get().
    • The database, once downloaded, needs to be stored in postgresql somewhere. That's the only persistent storage system we have. File system won't work. Reusing the plugin attachments table seems like an option?
    • The initial download could happen in the new geoip plugin's setupPlugin... and have a runEveryDay that checks if there are updates (basically just runs geoip.update()). Still we shouldn't have all teams or all threads updating it at the same time...
  • The main point is to have this geoip database reader running per-instance of the plugin server (or per worker thread), but not per enabled plugin in a team.
  • We should also not download the database for users who don't want geoip support.
  • I imagine "enable geoip" will be something added to the ingestion/preflight routine eventually, next to e.g. "enable session recording".

What did I miss?

@Twixes
Copy link
Member

Twixes commented Jan 26, 2021

Looks pretty reasonable to me.
I think that "Enable GeoIP" should practically be whether our built-in GeoIP plugin is on or off.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants