Help for a hacakthon
kiankyars
HOBBYOP

a year 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

a year ago

af4f16fe-2a73-4c35-bc22-faa9139ab764


a year ago

Help for a hacakthon


kiankyars
HOBBYOP

a year 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


a year ago

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


kiankyars
HOBBYOP

a year ago

How could I check?


a year ago

Railway has docs for FastAPI here


kiankyars
HOBBYOP

a year 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

a year ago

no avail


a year 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

a year 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

a year ago

someone keeps deleting my message in chit chat


a year 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

a year ago

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


a year ago

both


kiankyars
HOBBYOP

a year ago

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


a year ago

Please create a PORT environment variable with a value of 8000


kiankyars
HOBBYOP

a year ago

done thanks, trying now


kiankyars
HOBBYOP

a year ago

@Adam no luck

1401587429239947404


kiankyars
HOBBYOP

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

a year ago

Please remove your pyproject.toml and replace it with a requirements.txt, then use the Railway.json in the template with no changes


a year ago

Add hypercorn to the requirements.txt as well:

hypercorn==0.14.4


kiankyars
HOBBYOP

a year ago

thanks, doing now


kiankyars
HOBBYOP

a year ago

🤞


kiankyars
HOBBYOP

a year ago

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


kiankyars
HOBBYOP

a year ago

I'm praying to god this works


kiankyars
HOBBYOP

a year ago

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


kiankyars
HOBBYOP

a year ago

hold on!


kiankyars
HOBBYOP

a year ago

I think it's fixed


a year ago

Glad to hear it!


a year ago

!s


Status changed to Solved adam 11 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...