"Key is stored in legacy trusted.gpg keyring" warning

Take a full backup, set up a fresh instance of discourse and restore your backup there.

That way you don’t need to mess with anything and in 99% of cases your issue will be gone.