After migration database of redis my api is broken
The api is working on locally on my computer which is connected to railway redis database and it is working perfectly but on the railway it is not working. I have also changed the environment variable.
36 Replies
Project ID:
3aab35c7-7d7e-441a-b845-39e22b14d35d
deploy logs please https://bookmarklets.up.railway.app/log-downloader/
those are the build logs
It is not building only. after migration
deploy logs please
this is an issue with your code
ok
After fixing the code issue I am getting this error
can you connect to the database on railway locally?
yes
in the dockerfile, can you try adding a 3 second sleep before starting your app
okay
even after adding sleep for 3 seconds it is giving me the same error
show me the how you've added the sleep?
FROM python:3.11-alpine
WORKDIR /app
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
RUN sleep 3
CMD ["gunicorn", "api:app"]
that's just a sleep during build, add the sleep to the cmd
Sorry, I am not understanding. Can you give me an example
getting the same error...😔
show me how you are connecting to the database in code
do you have all those variables in your service variables?
yes
do they show properly when you click the eye icon?
yes, they are showing
then this is also looking like a code issue, can you get your app to print an actually reason for the connection failure instead of a panic?
But it is working locally
that does not mean its not a code issue, for example, you are running it in development mode in that screenshot, but in your dockerfile you run it with gunicorn, you absolutely do want to run it with gunicorn when on railway, but these types of things can cause discrepancies
It solved
awesome, what was the solution
don't know It automatically solved... 😅
oh that's not ideal
I just redeploy
interesting