2 years ago
I am encountering an issue with my Railway deployment. Upon deploying my application, all dependencies specified in the requirements.txt file are successfully installed, and the application compiles without any errors. However, when attempting to access the API, I am greeted with the error message "Application failed to respond." Unfortunately, the deployment logs provide minimal insight into the root cause of this issue, as they only display the message: "No deployment logs. All output sent to stdout will be displayed here."
9 Replies
2 years ago
Sorry, yes it's a Python application, I'm using the FastAPI framework.
2 years ago
I'm using the default commands and it detects my Dockerfile. I added this file because without it, I get the same error. I was trying with basic Docker commands but it doesn't work either.
FROM python:3.9-slim
WORKDIR /app
RUN apt-get update && apt-get install -y libpq-dev gcc
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "main.py"]
2 years ago
Try changing the CMD line to -
CMD uvicorn main:app --host 0.0.0.0 --port $PORTStatus changed to Solved Railway • over 1 year ago
2 years ago
I have a file called Procfile with the same command
web: uvicorn main:app --host 0.0.0.0 --port $PORT
2 years ago
A Procfile is a heroku thing, go ahead and delete that and try my suggested change.
2 years ago
This worked for me:
CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port $PORT"]
Thank you very much for your assistance.
2 years ago
Writing out CMD without the brackets also evaluates the command in the shell before running it.