First, see Change the domain name or rename your Discourse (though another solution is to backup and then restore with the new hostname).
My guess is that you’re running out of connections to the database, but that isn’t quick the error I would expect.
Is this a standard install or are you using some other PG server?