deploying fastAPI in railways
hey can someone tells me if railway only works with gunicorn ? i'm trying to deploy a project that is using fastapi but i'm having trouble deploying it, can someone help me ?
80 Replies
Project ID:
9cacd55d-79ea-4443-925b-ee55dad0dba2
9cacd55d-79ea-4443-925b-ee55dad0dba2
You should be starting gunicorn using the port env variable
deploy logs please https://bookmarklets.up.railway.app/log-downloader/
this is fastapi, that uses uvicorn right?
yeah
If you have a port specified, you would want to set that port in your service
Same diff! 🤣🤣
i'm doing this web: gunicorn -k uvicorn.workers.UvicornWorker api:app
Using a Procfile?
yeah
Use a railway.json file instead a good example of one is here
https://github.com/vfehring/fastapi
GitHub
GitHub - vfehring/fastapi
Contribute to vfehring/fastapi development by creating an account on GitHub.
But let’s get the logs with the bookmarklet so we can definitely debug better
i'm didnt get the way to use this, its kind of my first time using railway... sorry
https://bookmarklets.up.railway.app/log-downloader/
this
The log downloaded is made by Brody.
It’s 3 steps
1. Drag the link from the page to your bookmark bar
2. Open the fastapi service
3. Press the bookmarklet and it will download your logs
Then send the file it downloads here
i dunno if i'm doing something wrong, but it didnt work 😦
i did what you said, the url is inthe right
railway
you don't have a deployment open
i need to start a deploy and then i use this ?
you need to open a deployment
please read the alert message
I'm sorry, how can I open the deployment ? I'm from brazil... sorry
you click on the deployment
oh, I got it
sorry
There is nothing wrong with the deploy. There is an issue in your code
Based on the logs. You aren’t calling the function in sync.py properly
TypeError: __call__() missing 1 required positional argument: 'send'
could you please take a look at my code to see if there is a problem ?
I looked everything and used in postmand with the localhost and it worked
but when I deploy, it doesnt work
localhost = uvicorn app:app --reaload
I can give it a look and I’ll even deploy it, but it will be a few hours before I can due to it being my niece’s birthday
oh, its okay ! send my congratulations to her please ! thanks for your healp
this is the code
what's your current start command
@Brody
right but that was before you told them about the railway.json file
i'm not using the railway.json... i need to read about it
I'll do this later, i need to go to the hospital with my grandpa
Hey, I'm back
i'm making changes in my code to use jwt
i'm gonna send the new version here for you @Vin
have you a simple request to
/
working yet?using the uvicorn to use the code, all the / are working
but on railway i mean
no, on railway nothing work
whats your current start command?
all of them dont work
you talk aboout the procfile ?
i'm deployng this using the web not tthe cli
i just wanna know the start command railway is currently using to start your app, this doesnt have anything to do with deploying from github or the cli
i tried to deployy it again and i goot this
please tell me the start command
web: uvicorn main:app --host=0.0.0.0 --port=${PORT}
web: gunicorn -k uvicorn.workers.UvicornWorker api:app
i tried this two
what is your current start command
web: gunicorn -k uvicorn.workers.UvicornWorker api:app
try
web: uvicorn main:app --host=0.0.0.0 --port=${PORT}
instead, then tell me the errors you get from thatplease try the uvicorn command above
your logs still mention gunicorn
you want to use uvicorn
i tried...
i'm using your comman
do you have something set as a start command in the service settings?
i dont think
i didnt set anything
please check, you have gunicorn set as the start command still
i created a new projectt and im trying to deploy again
I got this now
looks good
does it work?
FUCKING GOD !!!! NOW ITS WORKKING !!!!!
AAAAAAAAAAAAAAA
there was something wrong with my last project
yeah you where overwriting the command in the Procfile somewhere else
bro, thanks for your help !!!
you are the best
no problem!
you and @Vin
thanksssssssssss
ah, I'm thinking abouut paying for raiway services
do you guuys have a referal that i can use to hellp youu ?
you will eventually run out of the trial credits and need to upgrade
I very much appreciate that, but both of us have unlimited credits
@Fragly give them your referral code
https://isdev.co/railway
<:chad_moment:758939193967378442>
thanks brody and aphelios!!! 🔥
your referral code is app??
yea!!!
isn't that cool?
someone already took
dev
though <:pensive_cry:805623704981733386>didn't know you could edit them
you should link to this https://railway.app/account/upgrade?referralCode=app
oh, okay
Imma make a
isdev.co/railway/upgrade
link 🤔no just change the redirect lol
oh
true!
i think i'm gonna use the higher plan that we have at the page
just using this link its ok ?
I don't think you need pro, are you planning on hosting business related stuff on railway?
just use this link and fragly will get whatever the kickback is
oohh, i dont know how many people will use this api...
hobby is what you want then