From a623e72e7e995a321493e4459d0515322034684a Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Mon, 14 Dec 2020 11:56:04 -0500 Subject: [PATCH] Integrate with MaxMind out of the box (#766) Integrate with MaxMind out of the box --- .gitignore | 3 +++ docker-compose.yml | 13 +++++++++++ geoip/GeoLite2-City.mmdb.empty | Bin 0 -> 1055 bytes install.sh | 4 ++++ install/geoip.sh | 39 +++++++++++++++++++++++++++++++++ nginx/nginx.conf | 2 +- relay/config.example.yml | 1 + sentry/sentry.conf.example.py | 8 ++++++- 8 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 geoip/GeoLite2-City.mmdb.empty create mode 100755 install/geoip.sh diff --git a/.gitignore b/.gitignore index b8ee807d52..707622f425 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,6 @@ sentry/requirements.txt relay/credentials.json relay/config.yml symbolicator/config.yml +geoip/GeoIP.conf +geoip/*.mmdb +geoip/.geoipupdate.lock diff --git a/docker-compose.yml b/docker-compose.yml index 5909226ae4..160ae6294c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,6 +31,7 @@ x-sentry-defaults: &sentry_defaults volumes: - 'sentry-data:/data' - './sentry:/etc/sentry' + - './geoip:/geoip:ro' x-snuba-defaults: &snuba_defaults << : *restart_policy depends_on: @@ -126,6 +127,14 @@ services: # If you have high volume and your search return incomplete results # You might want to change this to a higher value (and ensure your host has enough memory) MAX_MEMORY_USAGE_RATIO: 0.3 + geoipupdate: + image: 'maxmindinc/geoipupdate:latest' + # Override the entrypoint in order to avoid using envvars for config. + # Futz with settings so we can keep mmdb and conf in same dir on host + # (image looks for them in separate dirs by default). + entrypoint: ['/usr/bin/geoipupdate', '-d', '/sentry', '-f', '/sentry/GeoIP.conf'] + volumes: + - './geoip:/sentry' snuba-api: << : *snuba_defaults # Kafka consumer responsible for feeding events into Clickhouse @@ -233,6 +242,10 @@ services: read_only: true source: ./relay target: /work/.relay + - type: bind + read_only: true + source: ./geoip + target: /geoip depends_on: - kafka - redis diff --git a/geoip/GeoLite2-City.mmdb.empty b/geoip/GeoLite2-City.mmdb.empty new file mode 100644 index 0000000000000000000000000000000000000000..94f6921fd1c885fac56dcb689bf4467b25d9d78d GIT binary patch literal 1055 zcmZ9`*;dm)0LJmpS~uKxRMfh!RKd~H_-}(2OHXUFNupTG?i-Ebo3{a%=fQ7((_5zw6W$#6%J4|Hb5@0E? z8dzq=<-iK|O1jGI`9s$5<664T9CZQ**&Be3X50jH0lR_CX4%5nN=tMb-A;GVopcw? z{&5duFWpD?(*rcWQaA7kD04Xk#K2)-3^>B2haLs)0>^-Bz;P}o=t+8to~CE$S$dA1 zrx$21y+|(s13(|UpI)X{=vA8EFn7=_6-E^pVp#M#y+O0@-((B}w-~qSh&jDu;+~27 zzys3{fl>A&v*Z_e4A@+rP(dA_#&7|TA!+;Ob)dmTnSGow0r+NVGBgk{LbE>wBGcIe z6VolmB=C$eMN>LWpVJrgC4EI-)9g`i7;ou2;6395{YcyQ&*I