Changes to Accessing and Using GeoLite2 Databases

Your software
My Mautic version is: 2.15.3
My PHP version is: 7.2

Your problem
My problem is: GeoLite2 City Download, Automatically fetching the IP lookup data failed.

This message is from Maxmind.com
*Starting December 30, 2019, we will be requiring users of our GeoLite2 databases to register for a MaxMind account and obtain a license key in order to download GeoLite2 databases.
*Starting December 30, 2019, downloads will no longer be served from our public GeoLite2 page, from geolite.maxmind.com/download/geoip/database/

I can update the database manually, hoping to do this automatically.

These errors are showing in the log:
[2020-01-02 13:17:02] mautic.ERROR: Failed to fetch remote IP data: Could not resolve host: geolite.maxmind.com
[2020-01-02 13:17:02] mautic.NOTICE: PHP Notice - Undefined variable: data - in file **\wordpress\mautic\app\bundles\CoreBundle\IpLookup\AbstractLocalDataLookup.php - at line 90 {“connector”:"[object] (Joomla\Http\Http: {})",“package”:“http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz",“exception”:"[object] (RuntimeException(code: 0): Could not resolve host: geolite.maxmind.com at **\wordpress\mautic\vendor\joomla\http\src\Transport\Curl.php:185)”,“tempTarget”:" **\wordpress\mautic\app\cache\prod/GeoLite2-City.mmdb.gz",“tempExt”:“gz”,“localTarget”:" **\wordpress\mautic\app\cache\prod/…/ip_data/GeoLite2-City.mmdb",“localTargetExt”:“mmdb”,“success”:false,“memLimit”:134217728,“freeMem”:91146192}
[2020-01-02 13:17:02] mautic.NOTICE: PHP Notice - Trying to get property ‘body’ of non-object - in file
**\wordpress\mautic\app\bundles\CoreBundle\IpLookup\AbstractLocalDataLookup.php - at line 90 {“connector”:"[object] (Joomla\Http\Http: {})",“package”:“http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz",“exception”:"[object] (RuntimeException(code: 0): Could not resolve host: geolite.maxmind.com at \wordpress\mautic\vendor\joomla\http\src\Transport\Curl.php:185)",“tempTarget”:"\wordpress\mautic\app\cache\prod/GeoLite2-City.mmdb.gz”,“tempExt”:“gz”,“localTarget”:"*\wordpress\mautic\app\cache\prod/…/ip_data/GeoLite2-City.mmdb",“localTargetExt”:“mmdb”,“success”:false,“memLimit”:134217728,“freeMem”:91146192}

Steps I have tried to fix the problem:
I registered for a MaxMind account and obtained a license key. Entered IP lookup service authentication using format username:password. I’ve tried username:password to access maxmind.com and userID:Licenscekey (they are different)

Reading my log i thought it might be a memory issue. Increase my PHP limit to 256M and i get error log to show my this now:
[2020-01-02 14:51:39] mautic.WARNING: PHP Warning - gzdecode(): data error - in file **\wordpress\mautic\app\bundles\CoreBundle\IpLookup\AbstractLocalDataLookup.php - at line 91 {“connector”:"[object] (Joomla\Http\Http: {})",“package”:“http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz",“exception”:"[object] (RuntimeException(code: 0): Could not resolve host: geolite.maxmind.com at **\wordpress\mautic\vendor\joomla\http\src\Transport\Curl.php:185)”,“tempTarget”:" **\millwrightsites.com\wordpress\mautic\app\cache\prod/GeoLite2-City.mmdb.gz",“tempExt”:“gz”,“localTarget”:" **\wordpress\mautic\app\cache\prod/…/ip_data/GeoLite2-City.mmdb",“localTargetExt”:“mmdb”,“success”:false,“memLimit”:268435456,“freeMem”:225364000}

Hi all,

I am quite new with Mautic. And first time playing with this platform. However, when i finished set up Mautic I am stucked at the GeoIP GeoLite2 City from maxmind. I could not fetch it to update the new data.

I follow this tips https://github.com/mautic/mautic/issues/8275

However, I am still stucked at the last step. Put in the folder. I put the file exactly where the path shown with File Manager in Cpanel and grand the permission for read/write etc… Put the issue can not solve yet. Any ideas please. Thank you so much. :innocent:

Quang

1 Like

This solution does not fix the fetch button. This solution takes place of the fetch. Everything your doing in theses steps is what the fetch button does automatically. Mautic will update there code soon to give us a solution.

1 Like

For those administering their Mautic instance from the command line, the best way to transfer the GeoLite2-City.mmdb file to the app/cache/ip_data/ folder is using the scp command line utility.

First, comment out the automatic update cron job in /etc/crontab (system-wide crontab) or user-specific crontab, crontab -u www-data -e with a # symbol.

Then, simply upload the .tar.gz file downloaded from your MaxMind account to your home directory (e.g. /home/ubuntu/GeoLite2-City_20200107.tar.gz) then using the tar -xvzf command, extract the archive. Inside the extracted folder, you will find the GeoLite2-City.mmdb which you should cp to /path/to/mautic/app/cache/ip_data/. If asked to overwrite, type y to indicate “yes.”

Finally, change ownership of the file to the web server user (e.g. apache or www-data) for good measure. chown -R www-data:www-data /path/to/mautic/app/cache/ip_data/GeoLite2-City.mmdb

1 Like

Just a note.
After you have manually copy-paste the database and disabled the cron job, DON’T click on the button “Update IP lookup data store” anymore because it will empty the database that you have just copied.

Does anybody maybe know how we can trigger the Location update for the contacts that are now without the location??
Thanks,
Davor

1 Like

Thanks Davor. That would be the issue which I did. After manually copy-paste and disable cron job. I immediately click the update button to refresh lookup data!!!

I setup account at Maxmind for the geoip database geolite2-city; got License key and account/user ID

This is where Mautic says I should get the file:
http://geolite.maxmind.com/download/geoip/database/geolite2-city.mmdb.gz

I will be uploading to CPanel; ip_data

Below are the databases Maxmind lists to download. So Which of these database do I download?

|GeoLite2-ASN|GeoLite2 ASN|GeoIP2 Binary (APIs)|2020-02-04|GZIP (MD5)|
|GeoLite2-ASN-CSV|GeoLite2 ASN: CSV Format|GeoIP2 CSV (docs)|2020-02-04|ZIP (MD5)|
|GeoLite2-City|GeoLite2 City|GeoIP2 Binary (APIs)|2020-02-04|GZIP (MD5)|
|GeoLite2-City-CSV|GeoLite2 City: CSV Format|GeoIP2 CSV (docs)|2020-02-04|ZIP (MD5)|
|GeoLite2-Country|GeoLite2 Country|GeoIP2 Binary (APIs)|2020-02-04|GZIP (MD5)|
|GeoLite2-Country-CSV|GeoLite2 Country: CSV Format|GeoIP2 CSV (docs)|2020-02-04|ZIP (MD5)|

I have made a step by step guide to help Mautic users with the Madmind GeoIP and Geolite2 automated database updates.

2 Likes

Thank you SO much… your guide worked perfectly!

1 Like

Glad it was of help @cottercat, I try to keep it updated as much as I can…

Thanks very much for this. One question though, so there’s nothing that we need to do to let Mautic know how/where to access the DB’s?

My install is not typical in that I use Runcloud to manage my VPS. The webroot dir’s are different from a dedicated server. I modified the paths when it came to ip_data (/home/mautic/webapps/Mautic/app/cache/ip_data) but noticed I didn’t have that folder in the existing Mautic install, I had to create it. So how does Mautic know to get the geo data from that folder? Or am I missing something?

***EDIT:

On further inspection. I do have a ip_data folder but that is in Mautic/var/cache/ip_data

Another point, does making ip_data chmod 777 not scare the crap out of you?


I’ve got this problem. Can anyone help?

1 Like

I have the same problem, used to work but doesn’t anymore with the correct authentication code from the license.

Make sure you are using the correct format: