YOu need to rebuild at the command line, twice. See PostgreSQL 15 update
Hmm. It’s possible that you have a non-standard bind in your app.yml. Your OS is almost certainly out of date too. I recommend moving to a new VM and restoring the database there. See Move a Discourse site to another VPS with rsync.
Don’t copy the database. It’s easier to restore a backup.