Ok. I’d take it step by step, so first confirm the database is actually running and so can be connected to. Check its status and logs to check all is well.
If so, see if you can connect to it.
If so, then yes the issue must be between the app and postgres. I’d check the app machine’s logs to see where it’s failing. Look for any recent “connection failed”-type message? Or a hostname not resolved? I’d assume Medusa would throw some kind of exception (you may need to enable logs within it - no idea). There should be an error.
I see various other mentions of database issues, but unfortunately no consistent solution e.g