5 months ago
help somehow im not able to connect my flask app to postgres despite adding the DATABASE_URL variable
looking at the logs, it shows postgres:5432 - no response
strangely it was working fine past few days, but after i enabled serverless mode the issue happened. and it persists even though i have deleted and created new app and db services
2 Replies
5 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • 5 months ago
4 months ago
Did you try disabling serverless after it broke? Serverless doesn't really work with services that rely on databases or are themselves databases since the database connection will stop the app from sleeping.
4 months ago
the issue is likely due to DNS resolution and the way containerization works.
I am guessing when postgres goes to sleep and you try to access it from your flask app it doesn't even turn on automatically right like you expected it to right ?
Like erisa said, db's don't do well with serverless and i would also strongly advise against it. The serverless mode is handled purely by monitoring network packets so your db could be interacting with disk and railway might shut it off leading to data corruption and loss.
https://docs.railway.com/reference/app-sleeping
Turn off serverless mode for postgres.
Status changed to Solved chandrika • 3 months ago