Adding ngx_http_geoip2_module to Nginx (version 1 DBs are no longer available upstream)
Hello,
Earlier this year, MaxMind stopped providing the legacy databases (used by package geoip) and it is no longer possible to use Nginx’s geoip modules (unless one saved copies of the old databases). However, it seems ngx_http_geoip2_module handles version 2, and that very few changes would be needed to include it in the nginx package.
Would this be a reasonable addition?
I’m not sure it really counts as a bug (it’s more that something was deprecated upstream), but it would be really nice to have it officially available, and although I don’t know enough to make an actual pull request, I tried to gather all the info I could to make it easier to evaluate.
The module requires libmaxminddb (which is already available) and people who intend to use the data files can obtain/update them by running /etc/periodic/weekly/libmaxminddb.
The module itself is https://github.com/leev/ngx\_http\_geoip2\_module, the author is at Cloudflare, and there are commits by people from Nginx and MaxMind. The license is the same as Nginx’s. This is also the module Nginx recommends for its Plus subscribers.
I think geoip and libmaxminddb don’t interact, so adding libmaxminddb shouldn’t break anything for people who have the legacy data files and keep using geoip.
As far as I can tell (I have no experience generating packages or anything like that, so I’m doing some guesswork on how the build process uses the config files), the changes would be all on https://git.alpinelinux.org/aports/tree/main/nginx/APKBUILD:
-
add libmaxminddb-dev or libmaxminddb (I think the first is what’s needed for the module compilation) to makedepends
-
some _add_module entries like this _add_module "http-geoip2" "3.2" "https://github.com/leev/ngx_http_geoip2_module" _add_module "stream-geoip2" "3.2" "https://github.com/leev/ngx_http_geoip2_module"
(it is the same repo for both modules, and both .so files need to be added to the _extra_flags list of —add-dynamic-module)
-
the sha sum for the modules 84b26955234e29dbfbf2431b652fcc453c5e86b95f837296df4f3d6c730e3e0773223dae890eebfc9b5763f46082bde6f38d6505b8bf78133b89e7297016cc5d nginx-http-geoip2-module-3.2.tar.gz 84b26955234e29dbfbf2431b652fcc453c5e86b95f837296df4f3d6c730e3e0773223dae890eebfc9b5763f46082bde6f38d6505b8bf78133b89e7297016cc5d nginx-stream-geoip2-module-3.2.tar.gz
Again, I’m mostly guessing, and I’ve had no chance to figure the details of the build process.
Would this be a reasonable update?
Thanks,
João Pedro Boavida
(from redmine: issue id 9860, created on 2019-01-16)