Test & activation emails are sent with port 4000 included

Why didn’t you use the backup/restore feature in Discourse?

The discourse remap script might help you here.