4 months ago
Problem
When I try running my full stack app (all services on the same railway project) in production I get a ERR_CONNECTION_TIMED_OUT
error at the time the FastAPI server is trying to connect to the PostgreSQL database.
I've also tried updating the credentials on my FastAPI server to use the public host and public port for the PostgreSQL database but it doesn't seem to work. Fwiw, things work smoothly when running locally so I'm certain I have an issue with my setup somewhere but I've tried a few different combinations that haven't changed much.
Monorepo Project Setup
NextJS Frontend as one service on railway
Python FastAPI Backend as another service on the same railway project
hypercorn main:app --bind [::]:8000
PostgreSQL Vector DB as another service on the same railway project
Data Flow
User makes a request on the frontend (i.e. client side) which triggers a call to the backend for some data via the public network
The FastAPI server then tries to connect to the PostgreSQL database via the private network. For this I'm using the private host and private port that I see within the PostgreSQL Vector DB.
Other
Also side note my FastAPI build times are quite long (5+ mins) and deployment takes another 5-10 mins and this isn't a big app by any means. Not sure if I'm missing anything for the build/deployment, I was under the impression it automatically looks through the pyproject.toml file to get the relevant packages but I also see things like this during the build process.
Downloading virtualenv-20.24.0-py3-none-any.whl.metadata (4.5 kB)
Mar 10 13:51:08
Downloading virtualenv-20.23.1-py3-none-any.whl.metadata (4.5 kB)
Mar 10 13:51:09
Downloading virtualenv-20.23.0-py3-none-any.whl.metadata (4.3 kB)
Mar 10 13:51:09
Downloading virtualenv-20.22.0-py3-none-any.whl.metadata (4.1 kB)
Mar 10 13:51:09
Downloading virtualenv-20.21.1-py3-none-any.whl.metadata (4.1 kB)
2 Replies
4 months ago
Hello,
Looks like you are no longer getting that timeout error, and you have switched to Railpack and that has significantly reduced build and deploy times.
Seems like you are all good here?
Am I good to mark this as solved?
Best,
Brody
Status changed to Awaiting User Response railway[bot] • 4 months ago
brody
Hello,Looks like you are no longer getting that timeout error, and you have switched to Railpack and that has significantly reduced build and deploy times.Seems like you are all good here?Am I good to mark this as solved?Best,Brody
4 months ago
Should be all good for now!
Status changed to Awaiting Railway Response railway[bot] • 4 months ago
Status changed to Solved brody • 4 months ago