How to set GEOIP_PATH_MMDB?

Hi,

I set GEOIP_PATH_MMD in docker-compose.yml, but the following warning is printed:

[WARNING] sentry.utils.geo: settings.GEOIP_PATH_MMDB not configured.

What’s wrong?

  • docker-compose.yml
x-sentry-defaults: &sentry_defaults
  (snip)
  environment:
    SENTRY_CONF: '/etc/sentry'
    SNUBA: 'http://snuba-api:1218'
    GEOIP_PATH_MMD: '/geoip/GeoLite2-City.mmdb'
    SENTRY_REDIS_HOST: 'redis'
  volumes:
    - 'sentry-data:/data'
    - './sentry:/etc/sentry'
    - './geoip:/geoip'
1 Like

@mzch

Have you managed to solve the GEOIP issue?

No, I haven’t. Could you tell me any hints?

Still figuring out, will inform here if I get more into this.

@mzch
Also I think this is a good start: https://django.readthedocs.io/en/2.2.x/ref/contrib/gis/geoip2.html#std:setting-GEOIP_PATH

I think you will need to copy that file into the correct container in the docker-compose for the post-process-forwarder service.

I think that can be managed in the x-sentry-defaults: &sentry_defaults section, but you’ll need to specify the source and target.

We don’t need this for our setup, but this may be a helpful start for you.

My guess is
volumes:
- ‘sentry-data:/data’
- ‘./sentry:/etc/sentry’
- type: bind
read_only: true
source: /geoip/GeoLite2-City.mmdb
target: /data/geoip/GeoLite2-City.mmdb

and then maybe your export should reference the new /data/geoip/GeoLite2-City.mmdb

Please let me know if this is helpful. I’m sorry I don’t have more time to test it myself.

Thanks for your hint, but I have not resolved this yet.

Did you update your GEOIP_PATH_MMD: ‘/geoip/GeoLite2-City.mmdb’ to point to where it would be on the volume within that container?

My docker-compose.yml is:

--- docker-compose.yml.orig	2020-10-07 11:18:33.146661804 -0700
+++ docker-compose.yml	2020-10-07 11:12:10.331445687 -0700
@@ -24,12 +24,12 @@
   environment:
     SENTRY_CONF: '/etc/sentry'
     SNUBA: 'http://snuba-api:1218'
-    GEOIP_PATH_MMD: '/geoip/GeoLite2-City.mmdb'
+    GEOIP_PATH_MMD: '/data/geoip/GeoLite2-City.mmdb'
     SENTRY_REDIS_HOST: 'redis'
   volumes:
     - 'sentry-data:/data'
     - './sentry:/etc/sentry'
-    - './geoip:/geoip'
+    - './geoip:/data/geoip'
 x-snuba-defaults: &snuba_defaults
   << : *restart_policy
   depends_on:

I logged in sentry_onpremise_post-process-forwarder_1 or sentry_onpremise_web_1…etc, and I found there was /data/geoip/GeoLite2-City.mmdb and GEOIP_PATH_MMD was defined.

Oh, sorry I corrected GEOIP_PATH_MMD to GEOIP_PATH_MMDB and worked well.
Thanks.

2 Likes

I just saw that I had introduced the typo, and I wanted to apologize. Glad it worked though!