ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "groups" does not exist LINE 1: SELECT "groups"."id", "groups"."name" FROM "groups" WHERE
yellow
Failed to handle exception in exception app middleware : PG::UndefinedTable: ERROR: relation "groups" does not exist LINE 1:
MaxMindDB (/var/www/discourse/vendor/data/GeoLite2-City.mmdb) could not be found: No such file or directory @ rb_sysopen - /var/www/discourse/vendor/data/GeoLite2-City.mmdb
MaxMindDB (/var/www/discourse/vendor/data/GeoLite2-ASN.mmdb) could not be found: No such file or directory @ rb_sysopen - /var/www/discourse/vendor/data/GeoLite2-ASN.mmdb
We are using Discourse behind a reverse proxy, so all users have the same IP, and we would need the GeoIP lookup - I do not see the option to disable the IP lookup altogether, instead of going through the registration process and obtaining a license for something that we are not needed, only in order to eliminate the errors from the logsā¦
Wouldnāt it be reasonable to hide and skip the GeoIP lookup from user admin settings, if no license key was configured? Or instead show an info/placeholder that GeoIP lookup would be possible by setting a license key following Configure MAXMIND for reverse IP lookups?
Looping through error logs to monitor system operation is good practice, and itās annoying to spend time on investigating errors, just to find out that they are expected because an operation is attempted which is expected to fail by default and which could be skipped easily by checking a single setting .
I can try open a PR on GitHub, if you basically agree. But probably Iām overlooking something and it isnāt that easy or has downsides Iām not seeing.
MaxMindDB (/var/www/discourse/vendor/data/GeoLite2-ASN.mmdb) could not be found: No such file or directory @ rb_sysopen - /var/www/discourse/vendor/data/GeoLite2-ASN.mmdb
MaxMindDB (/var/www/discourse/vendor/data/GeoLite2-City.mmdb) could not be found: No such file or directory @ rb_sysopen - /var/www/discourse/vendor/data/GeoLite2-City.mmdb
ā¦but just came looking for a way to suppress them.
It was reverted again since it was too complicated to adjust automated tests for them. An attempt was made, but those re-added the warnings, breaking the purpose of my PR in the first place:
Hence both reverted:
The problem most likely was to make reading the database depending of the existence of a MaxMind key. The database however can be added other ways. On our own instance, in the meantime we add free DB-IP databases, which do not require an account. So my own PR would have broken the way we do it now. The same caused failing tests which I fixed in my PR. But on the main branch and/or in certain plugins this likely caused other issues.
A better solution, if someone wants to approach this again, would be to check whether the database files exist, before attempting to load them, instead of whether the license key is defined. So here:
Only if File.join(path, "GeoLite2-City.mmdb") exists, mmdb_load it.
The adjusted GUI output might have been an issue as well for some tests, but it should be possible to add it without breaking tests, as a fallback only if no location is available and then the respective flag is true (the one I set with ret[:no_license] = true in my PR). But should be renamed to no_db or so to indicate that it is not about whether a MaxMind license key has been defined, but whether the actual database files exist or not. That way, unit tests can inject a location to test the output without requiring an actual database, and no license key anyway.
Thanks for the info! Seems sensible to check for files before trying to load them. Iām not the guy to develop a fix, so Iāll try enabling MaxMind to declutter my log.