IP Location Address related

AI-generated summary

In a discussion titled ‘IP Location Address related’ under the ‘Installation’ category, Hyan reports that despite adding a Maxmind license key and rebuilding their Discourse site, users’ IP addresses still show as ‘(unknown)’. They also encounter a rebuild error involving a 401 HTTP error when the key is present, which disappears when the key is commented out. Falco clarifies that only a rebuild (not destroy/start) will apply the license key. Ed_S identifies this as a known issue, linking to a meta.discourse.org thread about invalid MaxMind API keys. Hyan confirms the problem was indeed due to an invalid license key and apologizes for the inconvenience. They also share a workaround: users can verify their license key’s validity by manually downloading MaxMind DBs via curl or wget using the instructions at MaxMind’s official guide. Hyan ends by noting they are now researching how to get Maxmind to return localized (non-English) location text.

I have added Maxmind license key (DISCOURSE_MAXMIND_LICENSE_KEY) and rebuild (or destroy/start) my site. But still users IP address show (unknown). How can I debug or verify if my Maxmind license key works?

Just to be clear a destroy/start won’t work, it must be a rebuild.

There’s below error if I rebuild with Maxmind license key in my container web config. I can rebuild successfully if I comment out Maxmind license key.

rake aborted!
NameError: undefined local variable or method `name' for main:Object
/var/www/discourse/lib/tasks/assets.rake:288:in `rescue in block (2 levels) in <main>'
/var/www/discourse/lib/tasks/assets.rake:280:in `block (2 levels) in <main>'

Caused by:
OpenURI::HTTPError: 401 Error
/var/www/discourse/lib/file_helper.rb:77:in `block in download'
/var/www/discourse/lib/final_destination.rb:494:in `block (3 levels) in safe_get'
/var/www/discourse/lib/final_destination.rb:494:in `catch'
/var/www/discourse/lib/final_destination.rb:494:in `block (2 levels) in safe_get'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.0.0/lib/patches/net_patches.rb:19:in `block in request_with_mini_profiler'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.0.0/lib/mini_profiler/profiling_methods.rb:46:in `step'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.0.0/lib/patches/net_patches.rb:18:in `request_with_mini_profiler'
/var/www/discourse/lib/final_destination.rb:455:in `block in safe_get'
/var/www/discourse/lib/final_destination.rb:518:in `block in safe_session'
/var/www/discourse/lib/final_destination.rb:511:in `safe_session'
/var/www/discourse/lib/final_destination.rb:450:in `safe_get'
/var/www/discourse/lib/final_destination.rb:161:in `get'
/var/www/discourse/lib/file_helper.rb:69:in `download'
/var/www/discourse/lib/discourse_ip_info.rb:40:in `mmdb_download'
/var/www/discourse/lib/tasks/assets.rake:281:in `block (3 levels) in <main>'
/var/www/discourse/lib/tasks/assets.rake:281:in `each'
/var/www/discourse/lib/tasks/assets.rake:281:in `block (2 levels) in <main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
I, [2023-03-17T04:47:55.908408 #1]  INFO -- : yarn run v1.22.19
$ /var/www/discourse/app/assets/javascripts/node_modules/.bin/ember build -prod
WARNING: Node v18.15.0 is not tested against Ember CLI on your platform. We recommend that you use the most-recent "Active LTS" version of Node.js. See https://git.io/v7S5n for details.
Environment: production
cleaning up...
Built project successfully. Stored in "dist/".
File sizes:
 - dist/assets/activate-account.js: 641 B (323 B gzipped)
 - dist/assets/admin.js: 942.87 KB (143.62 KB gzipped)
 - dist/assets/auto-redirect.js: 207 B (173 B gzipped)
 - dist/assets/browser-detect.js: 1001 B (579 B gzipped)
 - dist/assets/browser-update.js: 3.06 KB (1.4 KB gzipped)
 - dist/assets/chunk.13.4e7138edf04d01853515.js: 325.34 KB (99.81 KB gzipped)
 - dist/assets/chunk.143.866024f2070944c8068d.js: 3.83 KB (1.36 KB gzipped)
 - dist/assets/chunk.178.0c434e9ed79f6e7671b2.js: 2.06 KB (1.01 KB gzipped)
 - dist/assets/chunk.682.76d5109d950484255de3.js: 834.41 KB (282.19 KB gzipped)
 - dist/assets/core-tests.js: 2.5 MB (323.78 KB gzipped)
 - dist/assets/discourse.js: 3.1 MB (623.59 KB gzipped)
 - dist/assets/embed-application.js: 1.87 KB (757 B gzipped)
 - dist/assets/google-tag-manager.js: 1.01 KB (558 B gzipped)
 - dist/assets/google-universal-analytics-v3.js: 942 B (499 B gzipped)
 - dist/assets/google-universal-analytics-v4.js: 702 B (349 B gzipped)
 - dist/assets/highlightjs/highlight-test-bundle.min.js: 133.83 KB (42.86 KB gzipped)
 - dist/assets/markdown-it-bundle.js: 129.78 KB (43.63 KB gzipped)
 - dist/assets/onpopstate-handler.js: 265 B (206 B gzipped)
 - dist/assets/plugins/chat.js: 576.64 KB (98.02 KB gzipped)
 - dist/assets/plugins/discourse-details.js: 1.32 KB (674 B gzipped)
 - dist/assets/plugins/discourse-local-dates.js: 34.7 KB (9.34 KB gzipped)
 - dist/assets/plugins/discourse-narrative-bot.js: 1.66 KB (791 B gzipped)
 - dist/assets/plugins/discourse-presence.js: 10.95 KB (2.63 KB gzipped)
 - dist/assets/plugins/docker_manager_admin.js: 36.42 KB (6.96 KB gzipped)
 - dist/assets/plugins/lazy-yt.js: 4.12 KB (1.89 KB gzipped)
 - dist/assets/plugins/poll.js: 56 KB (15.31 KB gzipped)
 - dist/assets/plugins/styleguide.js: 93.27 KB (12.69 KB gzipped)
 - dist/assets/plugins/test/chat_tests.js: 174.2 KB (22.76 KB gzipped)
 - dist/assets/plugins/test/discourse-details_tests.js: 3.94 KB (1.13 KB gzipped)
 - dist/assets/plugins/test/discourse-local-dates_tests.js: 28.71 KB (5.54 KB gzipped)
 - dist/assets/plugins/test/discourse-presence_tests.js: 5.55 KB (1.24 KB gzipped)
 - dist/assets/plugins/test/docker_manager_tests.js: 6.16 KB (1.74 KB gzipped)
 - dist/assets/plugins/test/poll_tests.js: 58.71 KB (8.42 KB gzipped)
 - dist/assets/print-page.js: 118 B (130 B gzipped)
 - dist/assets/scripts/discourse-boot.js: 449 B (312 B gzipped)
 - dist/assets/scripts/discourse-test-listen-boot.js: 99 B (101 B gzipped)
 - dist/assets/scripts/discourse-test-load-dynamic-js.js: 637 B (400 B gzipped)
 - dist/assets/scripts/discourse-test-trigger-ember-cli-boot.js: 110 B (104 B gzipped)
 - dist/assets/scripts/module-shims.js: 944 B (471 B gzipped)
 - dist/assets/scripts/start-app.js: 201 B (174 B gzipped)
 - dist/assets/splash-screen.js: 1.8 KB (690 B gzipped)
 - dist/assets/start-discourse.js: 798 B (462 B gzipped)
 - dist/assets/test-helpers.js: 1.02 MB (149.22 KB gzipped)
 - dist/assets/test-i18n.js: 508.39 KB (119.66 KB gzipped)
 - dist/assets/test-site-settings.js: 9.46 KB (3.67 KB gzipped)
 - dist/assets/vendor.css: 0 B
 - dist/assets/vendor.js: 1.11 MB (302.23 KB gzipped)
 - dist/assets/wizard.js: 113.27 KB (34.56 KB gzipped)
 - dist/javascripts/@json-editor/json-editor/2.6.1/jsoneditor.js: 425.11 KB (79.36 KB gzipped)
 - dist/javascripts/ace.js/1.4.13/ace.js: 363.09 KB (98.66 KB gzipped)
 - dist/javascripts/ace.js/1.4.13/ext-searchbox.js: 11.63 KB (3.49 KB gzipped)
 - dist/javascripts/ace.js/1.4.13/mode-html.js: 59.46 KB (17.82 KB gzipped)
 - dist/javascripts/ace.js/1.4.13/mode-scss.js: 23.47 KB (7.79 KB gzipped)
 - dist/javascripts/ace.js/1.4.13/mode-sql.js: 4.73 KB (1.82 KB gzipped)
 - dist/javascripts/ace.js/1.4.13/mode-yaml.js: 4.97 KB (1.73 KB gzipped)
 - dist/javascripts/ace.js/1.4.13/theme-chaos.js: 3.11 KB (1.01 KB gzipped)
 - dist/javascripts/ace.js/1.4.13/theme-chrome.js: 2.97 KB (1.03 KB gzipped)
 - dist/javascripts/ace.js/1.4.13/worker-html.js: 203.22 KB (46.33 KB gzipped)
 - dist/javascripts/ace/ace.js: 362.06 KB (98.41 KB gzipped)
 - dist/javascripts/ace/ext-searchbox.js: 11.63 KB (3.49 KB gzipped)
 - dist/javascripts/ace/mode-html.js: 59.46 KB (17.82 KB gzipped)
 - dist/javascripts/ace/mode-scss.js: 23.47 KB (7.79 KB gzipped)
 - dist/javascripts/ace/mode-sql.js: 2.16 KB (1009 B gzipped)
 - dist/javascripts/ace/mode-yaml.js: 4.97 KB (1.73 KB gzipped)
 - dist/javascripts/ace/theme-chrome.js: 2.97 KB (1.03 KB gzipped)
 - dist/javascripts/ace/worker-html.js: 203.22 KB (46.33 KB gzipped)
 - dist/javascripts/chart.js/3.5.1/chart.min.js: 183.95 KB (63.67 KB gzipped)
 - dist/javascripts/chartjs-plugin-datalabels/2.0.0/chartjs-plugin-datalabels.min.js: 12.59 KB (5.09 KB gzipped)
 - dist/javascripts/count.js: 1.41 KB (636 B gzipped)
 - dist/javascripts/diffhtml/1.0.0-beta.20/diffhtml.min.js: 26.98 KB (9.88 KB gzipped)
 - dist/javascripts/embed-topics.js: 1.31 KB (630 B gzipped)
 - dist/javascripts/embed.js: 2.41 KB (1010 B gzipped)
 - dist/javascripts/magnific-popup/1.1.0/jquery.magnific-popup.min.js: 19.74 KB (7.18 KB gzipped)
 - dist/javascripts/media-optimization-worker.js: 4.89 KB (1.71 KB gzipped)
 - dist/javascripts/pikaday/1.8.2/pikaday.js: 41.55 KB (9.44 KB gzipped)
 - dist/javascripts/squoosh/mozjpeg_enc.js: 38.12 KB (10.49 KB gzipped)
 - dist/javascripts/squoosh/squoosh_resize.js: 4.42 KB (1.26 KB gzipped)
 - dist/javascripts/workbox/workbox-cacheable-response.dev.js: 6.58 KB (1.73 KB gzipped)
 - dist/javascripts/workbox/workbox-cacheable-response.prod.js: 579 B (345 B gzipped)
 - dist/javascripts/workbox/workbox-core.dev.js: 48.27 KB (11.21 KB gzipped)
 - dist/javascripts/workbox/workbox-core.prod.js: 5.75 KB (2.42 KB gzipped)
 - dist/javascripts/workbox/workbox-expiration.dev.js: 20.83 KB (5.48 KB gzipped)
 - dist/javascripts/workbox/workbox-expiration.prod.js: 2.82 KB (1.22 KB gzipped)
 - dist/javascripts/workbox/workbox-routing.dev.js: 31.54 KB (7.58 KB gzipped)
 - dist/javascripts/workbox/workbox-routing.prod.js: 3.32 KB (1.44 KB gzipped)
 - dist/javascripts/workbox/workbox-strategies.dev.js: 34.65 KB (4.79 KB gzipped)
 - dist/javascripts/workbox/workbox-strategies.prod.js: 4.75 KB (1.16 KB gzipped)
 - dist/javascripts/workbox/workbox-sw.js: 1.3 KB (741 B gzipped)
Done in 140.64s.
Downloading MaxMindDB...
Compressing Javascript and Generating Source Maps



FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile' failed with return #<Process::Status: pid 283 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"assets_precompile", "cmd"=>["su discourse -c 'bundle exec rake themes:update assets:precompile'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
e485abe8ea1b2a03c9f55845203412d810bc8189b3744e11b084667f6a2244a4
[root@stage discourse]# Done-c 'bundle exec rake themes:update assets:precompile' failed with return #<Process::Status: pid 283 exit 1>
bash: Done-c: command not found
[root@stage discourse]# Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
> exec failed with the params {"cd"=>"$home", "hook"=>"assets_precompile", "cmd"=>["su discourse -c 'bundle exec rake themes:update assets:precompile'"]}
> bootstrap failed with exit code 1
> ** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
> ./discourse-doctor may help diagnose the problem.
>

This is now a known problem - see
Rebuild is failing with a wrong MaxMindDB API key

Yes. @Ed_S It turns out the license key issue. I’m sorry wasting anyone who taking time to answer the post. For anyone who wants to verify if their Maxmind license key valid, one can follow this instruction Updating GeoIP and GeoLite Databases | MaxMind Developer Portal by curl or wget MaxMind DB. Failure/success tells your license key’s validation.

I’m now researching how can the Maxmind location return localized text rather than in English.