R
Railway

✋|help

How do you add a worker to a Procfile?

Iiceman42308/24/2023
It seems that Railway only accepts "web", so how can I add a "worker" to a Procfile?
Bbrody1928/24/2023
show me your desired procfile you wish to run on railway
Iiceman42308/24/2023
web: python manage.py migrate && gunicorn linguoai.wsgi
worker: celery -A linguini worker --loglevel=info
I've tried this but it didn't work:
celery -A linguoai worker --loglevel=info && python manage.py collectstatic && gunicorn linguoai.wsgi --bind 0.0.0.0:$POR
Bbrody1928/24/2023
yeah wouldnt be possible, you would need to run the worker in a separate service
that would only run the celery
Iiceman42308/24/2023
how can you set it up in a separate service?
I'm trying to run the worker with Redis
Bbrody1928/24/2023
yeah thats where this all falls apart because i have never done it myself
aka, i dont know
Iiceman42308/24/2023
ah ok
no worries
https://dev.to/techbychoiceorg/django-celery-and-redis-on-railway-214h
I was following this tutorial and she seemed pretty confident but it didn't work
Bbrody1928/24/2023
let me look
yeah i see what they did to make it work
you could do the same, but its not the most ideal way
Iiceman42308/24/2023
how? I couldn't get it to work
Bbrody1928/24/2023
you copied the procfile command wrong
after the celery command you have two and symbols, they only have one
Iiceman42308/24/2023
should it be POR or PORT?
I was using PORT
I think I've tried it with one & already but I'll have another go
Bbrody1928/24/2023
lol it would be PORT but you dont need --bind 0.0.0.0:$PORT since thats already the default bind
Iiceman42308/24/2023
celery -A linguoai worker --loglevel=info & python manage.py collectstatic && gunicorn linguoai.wsgi
so this then?
Bbrody1928/24/2023
well you need web: but yeah
Iiceman42308/24/2023
web: celery -A linguoai worker --loglevel=info & python manage.py collectstatic && gunicorn linguoai.wsgi
?
I tried it prefixed by web but it was erroring out
Bbrody1928/24/2023
yep, also please enclose any single line code in single backticks
well you do have the log downloader
Iiceman42308/24/2023
web: celery -A linguoai worker --loglevel=info & python manage.py collectstatic && gunicorn linguoai.wsgi
Bbrody1928/24/2023
yep that should start celery in the background and then python in the foreground
Iiceman42308/24/2023
okay, I'll give it a go
Bbrody1928/24/2023
but why thats not ideal, railway wont be able to restart your service if celery where to crash, since youve ran it as a background task
Iiceman42308/24/2023
What's the best solution?
Bbrody1928/24/2023
something that would run those commands in parallel and exit if any command fails, so that railway would be able to restart for any commands crash
a program like this https://nicolas-van.github.io/multirun/
i have used it in the past in a dockerfile and its the most ideal thing to use to run multiple commands at once on railway, but i used it in a dockerfile, and you are using nixpacks
Iiceman42308/24/2023
Okay, I'll take a look
Btw, that procfile command worked
so I guess this is solved
Thanks for your help again!
Bbrody1928/24/2023
like i said, its not exactly applicable for you, unless you wanna be my Guine pig?
Iiceman42308/24/2023
I'm just happy to get Celery working as I couldn't get the APIs to respond when I was running it locally
Bbrody1928/24/2023
fair enough, happy i could help

Looking for more? Join the community!

Recommended Posts
Cannot create code snapshot right nowUnable to deploy across multiple services, both using CLI and branch-triggered deploys. The deploy lhosting fivem (https://fivem.net) server on railwaywould it be possible to host fivem on railway? there is linux binaries for hosting the server. is thHelp configuring express app for use with storage volumeHi, I hope this is the right forum for this question. I have an express app that is using middlewareNo waiving of $5 dollar fee, even though qualified.Can someone clarify the rules for having the fee waived? Based on the blog article from Railway, my Environment Merging Doesn't WorkI created a new project and accidentally started an environment fork / merge thing. Now my staging hHow to remove files/foldersHi, im new in railway and i have to remove my node_modules folder because i get some issues. It seemcan't access deployed serviceSeems deployment completed when trying to access can't open page displayed. Tried with https://whizsAfter redeploying, I lost the uploaded images in the directoryAfter redeploying, I lost the uploaded images in the directory. My project uses Spring Boot v3.1.2 +help gettiing www subdomain wokringI have had a long discussions with railway team on working of www subdomain on my account ssdo.org.pSimple next.js build faildeployment ID 6b59c99d-f9d1-42bb-9733-67e02909cdc5 Repo: https://github.com/ballermatic/nextjs-shadcDatabase credentialsHello, my Railway starter plan has expired and I want to make a copy of my postgres database but iRunning python script [userbot]Hello so I have this python script that is used to automate something with email account can i use I need help on deploying my development database to production without losing any dataI mistakenly ran the command `npx prisma migrate dev` on my production env but did not accept when tNpgsql.npgsqlException (0x80004005) Failed to connect to 76.76.21.21:5432Hi! im trying to connect to an ASP.Net core 6 to railway.app for the first time and i receive the inDeploying for the first timeHi, I am new to railroad and I am trying to deploy my flask app. I am getting this error: ``` DockI can't seem to be able to use the mariadb app i'm running in my PHP projectI want to be able to connect my mariadb app deployed on railway in my PHP script but when I try to uRailway too slowI have an issue with my railwat app. The app is too slow once update my github project. Making it alTrying to communicate over private network and not workingI have a service that has just private networking enabled and listens on ipv6 (http server). When I How is Redis instance pricing calculatedDoes the per vCPU and per GB memory pricing apply to a Redis database? Would like to know before I svolume permissionsMy docker run script is trying to install as a user owned file into volume mount point but getting p