Timeout when restoring a backup

I’m working on migrating a decently large Discourse installation from a single instance (3 years going strong!) to managed Digital Ocean databases and separate frontends. Everything is fine for the initial installation once I boot up the new frontends, there’s a fresh, working installation of Discourse.

However, once I go to restore a backup, it always eventually fails while “restoring dump file”

[2020-11-14 04:56:16] Creating missing functions in the discourse_functions schema...
[2020-11-14 04:56:17] Restoring dump file... (this may take a while)
[2020-11-14 04:58:27] psql: error: could not connect to server: could not connect to server: Connection timed out

I’m pretty confused as to what could be happening here. The connection seems to be fine since Discourse otherwise works, and I don’t see anything in the DB logs or charts that would lead me to believe there’s a problem on that end of things.

Any ideas?

Edit: Just noticed something odd in the logs. In my config file the Postgres port is set to 25060, but the logs talking about the timeout mention port 5432.

[2020-11-14 18:20:23] Is the server running on host "[host]" ([ip]) and accepting
[2020-11-14 18:20:23] TCP/IP connections on port 5432?

Is it possible that the restore process isn’t respecting the configured port for some reason?


Ah nevermind, finally came across this post, looks like I needed to set DISCOURSE_BACKUP_DB_PORT.