Setting DISCOURSE_MAXMIND_LICENSE_KEY breaks docker image/container build

Hey people,

When running a docker based install, and setting DISCOURSE_MAXMIND_LICENSE_KEY the image creation process aborts with this error:

/var/www/discourse/lib/discourse_ip_info.rb:48:in `mmdb_download': undefined method `path' for nil:NilClass (NoMethodError)

    filename = File.basename(gz_file.path)
        from /var/www/discourse/lib/tasks/maxminddb.rake:67:in `block (3 levels) in <main>'
        from /var/www/discourse/lib/tasks/maxminddb.rake:65:in `each'
        from /var/www/discourse/lib/tasks/maxminddb.rake:65:in `block (2 levels) in <main>'

When leaving DISCOURSE_MAXMIND_LICENSE_KEY empty, everything works fine.
Tested with versions: stable and tests-passed

The Maxmind license works – so both URLs provide access to the .mmdb files:

Just a guess (I’m not a ruby guys; so please go easy on me) – maybe the ‘.mmdb’ extension causes problems in a couple of lines below :

Adding “.mmdb” to the links provided above causes an Invalid edition ID error.

Hope this helps narrowing down the issue.


1 Like

Hello and welcome @cbreit :slight_smile:

I think we’ve had a couple of reports of some rebuilds failing over a Maxmind key issue:

Update from 3.0.0.beta16 to 3.1.0.beta2 - #17 by vmsman
My Discourse is Down. Certificate Issue? - #27 by JammyDodger

This may be the extra info we need to figure out what’s going on. :+1: Thanks for digging. :slight_smile:

Are you sure that your license key is valid and entered correctly?

1 Like

You’re welcome.
Just let me know if I shall try something or if you need additional info. :slightly_smiling_face:

The key id definitely valid.
And it’s also entered correctly as the whole stuff is fully automated via Ansible.

The same key works at other locations in the playbook like a charm (and there are also no rate-limiting issues).

Feels like the URL is just not working.

1 Like

Since I have been having the same problem and can confirm that when clearing out the license key, my rebuild problems magically goes away.

I have even over a couple of days, tried my best to dig into the problem.

I think I have it right, but I might aswell be wrong.

During build, it seems like the mmdb files are missing, perhaps due to them not being present in the base image, or more likely, that they are being deleted and/or not even downloaded prior to them being loaded, hence the build fails…

Come to think of it, mmdb_download being called points to code trying to download the file.

I’ve successfully downloaded the files manually (from the within the docker container) with wget, so the license is working as expected.

1 Like