Help for a hacakthon
kiankyars
HOBBYOP

10 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.

Solved$10 Bounty

30 Replies

kiankyars
HOBBYOP

10 months ago

af4f16fe-2a73-4c35-bc22-faa9139ab764


10 months ago

Help for a hacakthon


kiankyars
HOBBYOP

10 months ago

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

1401579965601808435


10 months ago

Your app is not responding to the healthcheck. Is it listening on the PORT environment variable?


kiankyars
HOBBYOP

10 months ago

How could I check?


10 months ago

Railway has docs for FastAPI here


kiankyars
HOBBYOP

10 months ago

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.


kiankyars
HOBBYOP

10 months ago

no avail


10 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


kiankyars
HOBBYOP

10 months ago

@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?


kiankyars
HOBBYOP

10 months ago

someone keeps deleting my message in chit chat


10 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


kiankyars
HOBBYOP

10 months ago

so pyproject toml as well? or just railway.json?


10 months ago

both


kiankyars
HOBBYOP

10 months ago

this repo is much different than mine, can you please look at my backend directory?


10 months ago

Please create a PORT environment variable with a value of 8000


kiankyars
HOBBYOP

10 months ago

done thanks, trying now


kiankyars
HOBBYOP

10 months ago

@Adam no luck

1401587429239947404


kiankyars
HOBBYOP

10 months ago

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
  }
}

10 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


10 months ago

Add hypercorn to the requirements.txt as well:

hypercorn==0.14.4


kiankyars
HOBBYOP

10 months ago

thanks, doing now


kiankyars
HOBBYOP

10 months ago

🤞


kiankyars
HOBBYOP

10 months ago

I got everything escept main:app, I changed it to app:app, since I have app.py wrapper


kiankyars
HOBBYOP

10 months ago

I'm praying to god this works


kiankyars
HOBBYOP

10 months ago

@Adam now' im getting errors on deploy side, it's werid since running it locally takes 1 second


kiankyars
HOBBYOP

10 months ago

hold on!


kiankyars
HOBBYOP

10 months ago

I think it's fixed


10 months ago

Glad to hear it!


10 months ago

!s


Status changed to Solved adam 10 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...