Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to configure GeoIP 2 to use country-only database #14385

Closed
mfb opened this issue Apr 29, 2019 · 9 comments
Closed

Unable to configure GeoIP 2 to use country-only database #14385

mfb opened this issue Apr 29, 2019 · 9 comments
Labels
wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.

Comments

@mfb
Copy link

mfb commented Apr 29, 2019

For privacy policy reasons, we need Matomo to log only the visitor's country, not their city.

Therefore, we have configured the country-only Geo IP 2 database at index.php?module=UserCountry&action=adminIndex by using https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz as the download URL.

Inexplicably, however, Matomo is reporting:

According to this provider, your current location is:

(37.735, -122.373)
San Francisco, CA
94124
United States

Note: This GeoIP implementation has access to the following types of databases: City.

No idea what could cause this, but I was thinking perhaps the plugin downloaded a City database and has failed to overwrite that with the Country database I specified? However, autoupdates have been running:

The updater was last run on 2019-04-29.

So, I'm stumped on how to properly setup country-only GeoIP lookup.

@sgiehl
Copy link
Member

sgiehl commented May 31, 2019

Do you still have that problem? Tried to reproduce that, but when I set up GeoIP with the country db url, it works like it should. Did you maybe set it up with the city database and changed to download url afterwards to the country db url? The task to update the database stored locally might not be automatically triggered when the url is changed...

@sgiehl sgiehl added the Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. label May 31, 2019
@mfb
Copy link
Author

mfb commented Jun 1, 2019

It was initially using the city database. So my question is, why is it not updating to use the country database when the autoupdate runs - it's now run several times on a weekly basis.

@sgiehl sgiehl removed the Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. label Aug 13, 2019
@sgiehl
Copy link
Member

sgiehl commented Aug 13, 2019

@mfb I've just investigated that one. The "issue" is quite simple. Once Matomo downloaded a database file, it's created in the folder misc. When changing the download url to another database type it will create a new file with this name.

So in your case you had the city database defined. So a GeoLite2-City.mmdb was created. Changing the download to country database created the file GeoLite2-Country.mmdb, but the city database file is not automatically removed. That way it will be used, until you remove it manually.

@tsteur @mattab any opinion if we should change the behavior here? Not sure if it's good to automatically remove other database files that might already exist...

@tsteur
Copy link
Member

tsteur commented Aug 13, 2019

I wouldn't delete any, but if a user has configured to download the country DB, can we prefer using that DB in matomo? (I don't know how it works)

@sgiehl
Copy link
Member

sgiehl commented Aug 14, 2019

It walks through this list and stops as soon as a file exists, which is then used. We could maybe manipulate it to prefer a specific db if autoupdate is configured.

@mfb
Copy link
Author

mfb commented Sep 12, 2019

I did some more research on this and I see that the city file is actually part of the docker build: https://github.com/matomo-org/docker/blob/master/Dockerfile-alpine.template

So this probably explains how the city file ended up in our instance in the first place.

Given that the city file is bundled with the container image, I think it'd be useful to change the logic somehow and/or add some additional configuration to the plugin?

@mattab
Copy link
Member

mattab commented Sep 24, 2019

Another solution could be to improve the text in the UI and list the filename used by the database. eg. write Note: This GeoIP implementation has access to the following types of databases: City (database in misc/GeoLite2-City.mmdb) or so.

@mfb
Copy link
Author

mfb commented Sep 24, 2019

I'd propose since GeoLite2-City.mmdb is built in to the image, that file could be last in the list, allowing any other file to override it.

@mattab
Copy link
Member

mattab commented Dec 24, 2019

we'll probably stop using Maxmind soon, so closing this issue now, see #15308

@mattab mattab closed this as completed Dec 24, 2019
@mattab mattab added the wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it. label Dec 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

4 participants