FAILED to rebuild discourse -- OpenURI::HTTPError: 401 Error: Invalid license key

This means your MaxMind license key is invalid.

Try adding a # before on the line that contains that and rebuilding.