7 months ago
I'm in hackathon ending very soon, and railway is not working!
https://github.com/kiankyars/ned
is the repo, I'm getting this error:
Please let me know what other information you need to help me.
30 Replies
7 months ago
Help for a hacakthon
It's literally just fastapi, I use
cd backend
uv sync
uv run uvicorn app:app --reload
to run it locally, but it's not working to deploy

7 months ago
Your app is not responding to the healthcheck. Is it listening on the PORT environment variable?
7 months ago
Railway has docs for FastAPI here
I followed this
>
Deploy From a GitHub Repo
To deploy a FastAPI app on Railway directly from GitHub, follow the steps below:
Fork the basic FastAPI GitHub repo.
If you already have a GitHub repo you want to deploy, you can skip this step.
Create a New Project.
Click Deploy from GitHub repo.
Select the fastapi or your own GitHub repo.
Railway requires a valid GitHub account to be linked. If your Railway account isn't associated with one, you will be prompted to link it.
Click Deploy Now.
7 months ago
The best way forward here would be to clone the template repo and compare your setup and configuration. Copying over the railway.json should fix your issue
@Adam I have a backend directory though, I assume I have to use that as the root directory of the repository. And is it okay if I have a py project toml instead of a requirement txt? and does it have to be in backend?
7 months ago
Put the config files in whichever folder your app is served from. If it's backend, then put the files in the backend folder. You will need to change your root folder setting in Railway to ensure your project is deployed from the backend folder
7 months ago
both
this repo is much different than mine, can you please look at my backend directory?
7 months ago
Please create a PORT environment variable with a value of 8000
with this json file
{
"$schema": "https://railway.com/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"runtime": "V2",
"numReplicas": 1,
"startCommand": "uv run uvicorn app:app --host 0.0.0.0 --port 8000",
"healthcheckPath": "/health",
"sleepApplication": false,
"multiRegionConfig": {
"us-west2": {
"numReplicas": 1
}
},
"restartPolicyType": "ON_FAILURE",
"healthcheckTimeout": 300,
"restartPolicyMaxRetries": 1
}
}7 months ago
Please remove your pyproject.toml and replace it with a requirements.txt, then use the Railway.json in the template with no changes
7 months ago
Add hypercorn to the requirements.txt as well:
hypercorn==0.14.4
I got everything escept main:app, I changed it to app:app, since I have app.py wrapper
@Adam now' im getting errors on deploy side, it's werid since running it locally takes 1 second
7 months ago
Glad to hear it!
7 months ago
!s
Status changed to Solved adam • 8 months ago
