R
Railway•13mo ago
Z3R0

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
Percy
Percy•13mo ago
Project ID: 9cacd55d-79ea-4443-925b-ee55dad0dba2
Z3R0
Z3R0OP•13mo ago
9cacd55d-79ea-4443-925b-ee55dad0dba2
MantisInABox
MantisInABox•13mo ago
You should be starting gunicorn using the port env variable
Brody
Brody•13mo ago
deploy logs please https://bookmarklets.up.railway.app/log-downloader/ this is fastapi, that uses uvicorn right?
Z3R0
Z3R0OP•13mo ago
yeah
MantisInABox
MantisInABox•13mo ago
If you have a port specified, you would want to set that port in your service Same diff! 🤣🤣
Z3R0
Z3R0OP•13mo ago
i'm doing this web: gunicorn -k uvicorn.workers.UvicornWorker api:app
MantisInABox
MantisInABox•13mo ago
Using a Procfile?
Z3R0
Z3R0OP•13mo ago
yeah
MantisInABox
MantisInABox•13mo ago
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.
MantisInABox
MantisInABox•13mo ago
But let’s get the logs with the bookmarklet so we can definitely debug better
Z3R0
Z3R0OP•13mo ago
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
MantisInABox
MantisInABox•13mo ago
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
Z3R0
Z3R0OP•13mo ago
i dunno if i'm doing something wrong, but it didnt work 😦
Z3R0
Z3R0OP•13mo ago
i did what you said, the url is inthe right
No description
Z3R0
Z3R0OP•13mo ago
railway
Z3R0
Z3R0OP•13mo ago
No description
Brody
Brody•13mo ago
you don't have a deployment open
Z3R0
Z3R0OP•13mo ago
i need to start a deploy and then i use this ?
Brody
Brody•13mo ago
you need to open a deployment please read the alert message
Z3R0
Z3R0OP•13mo ago
I'm sorry, how can I open the deployment ? I'm from brazil... sorry
Brody
Brody•13mo ago
you click on the deployment
Z3R0
Z3R0OP•13mo ago
oh, I got it sorry
MantisInABox
MantisInABox•13mo ago
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'
Z3R0
Z3R0OP•13mo ago
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
MantisInABox
MantisInABox•13mo ago
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
Z3R0
Z3R0OP•13mo ago
oh, its okay ! send my congratulations to her please ! thanks for your healp
Z3R0
Z3R0OP•13mo ago
Z3R0
Z3R0OP•13mo ago
this is the code
Brody
Brody•13mo ago
what's your current start command
MantisInABox
MantisInABox•13mo ago
@Brody
Brody
Brody•13mo ago
right but that was before you told them about the railway.json file
Z3R0
Z3R0OP•13mo ago
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
Z3R0
Z3R0OP•13mo ago
Brody
Brody•13mo ago
have you a simple request to / working yet?
Z3R0
Z3R0OP•13mo ago
Z3R0
Z3R0OP•13mo ago
using the uvicorn to use the code, all the / are working
Brody
Brody•13mo ago
but on railway i mean
Z3R0
Z3R0OP•13mo ago
no, on railway nothing work
Brody
Brody•13mo ago
whats your current start command?
Z3R0
Z3R0OP•13mo ago
all of them dont work you talk aboout the procfile ? i'm deployng this using the web not tthe cli
Brody
Brody•13mo ago
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
Z3R0
Z3R0OP•13mo ago
i tried to deployy it again and i goot this
Z3R0
Z3R0OP•13mo ago
No description
Brody
Brody•13mo ago
please tell me the start command
Z3R0
Z3R0OP•13mo ago
web: uvicorn main:app --host=0.0.0.0 --port=${PORT} web: gunicorn -k uvicorn.workers.UvicornWorker api:app i tried this two
Brody
Brody•13mo ago
what is your current start command
Z3R0
Z3R0OP•13mo ago
web: gunicorn -k uvicorn.workers.UvicornWorker api:app
Brody
Brody•13mo ago
try web: uvicorn main:app --host=0.0.0.0 --port=${PORT} instead, then tell me the errors you get from that
Z3R0
Z3R0OP•13mo ago
No description
Brody
Brody•13mo ago
please try the uvicorn command above your logs still mention gunicorn you want to use uvicorn
Z3R0
Z3R0OP•13mo ago
i tried...
Z3R0
Z3R0OP•13mo ago
No description
Z3R0
Z3R0OP•13mo ago
i'm using your comman
Brody
Brody•13mo ago
do you have something set as a start command in the service settings?
Z3R0
Z3R0OP•13mo ago
i dont think i didnt set anything
Brody
Brody•13mo ago
please check, you have gunicorn set as the start command still
Z3R0
Z3R0OP•13mo ago
i created a new projectt and im trying to deploy again
Z3R0
Z3R0OP•13mo ago
I got this now
No description
Brody
Brody•13mo ago
looks good does it work?
Z3R0
Z3R0OP•13mo ago
FUCKING GOD !!!! NOW ITS WORKKING !!!!! AAAAAAAAAAAAAAA there was something wrong with my last project
Brody
Brody•13mo ago
yeah you where overwriting the command in the Procfile somewhere else
Z3R0
Z3R0OP•13mo ago
bro, thanks for your help !!! you are the best
Brody
Brody•13mo ago
no problem!
Z3R0
Z3R0OP•13mo ago
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 ?
Brody
Brody•13mo ago
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
Fragly
Fragly•13mo ago
https://isdev.co/railway <:chad_moment:758939193967378442> thanks brody and aphelios!!! 🔥
Brody
Brody•13mo ago
your referral code is app??
Fragly
Fragly•13mo ago
yea!!! isn't that cool? someone already took dev though <:pensive_cry:805623704981733386>
Brody
Brody•13mo ago
didn't know you could edit them you should link to this https://railway.app/account/upgrade?referralCode=app
Fragly
Fragly•13mo ago
oh, okay Imma make a isdev.co/railway/upgrade link 🤔
Brody
Brody•13mo ago
no just change the redirect lol
Fragly
Fragly•13mo ago
oh true!
Z3R0
Z3R0OP•13mo ago
i think i'm gonna use the higher plan that we have at the page just using this link its ok ?
Brody
Brody•13mo ago
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
Fragly
Fragly•13mo ago
yessir
Z3R0
Z3R0OP•13mo ago
oohh, i dont know how many people will use this api...
Brody
Brody•13mo ago
hobby is what you want then
Want results from more Discord servers?
Add your server