How to run my django app and celery simultaneously?
I have django web app which I deploy in railway.app. My app using celery + redis to run tasks. In my local machine I have two commands for run my app and celery separately in Makefile:
PORT ?= 8000
start:
poetry run gunicorn -w 5 -b 0.0.0.0:$(PORT) site_checker.wsgi:application
celery:
poetry run celery -A site_checker worker --loglevel=info
However, in the railway.app settings, I can only specify one start command. What is the best way to run both my app and Celery simultaneously? id: 6bdec234-7b62-42c0-9818-25372e1f4e09
However, in the railway.app settings, I can only specify one start command. What is the best way to run both my app and Celery simultaneously? id: 6bdec234-7b62-42c0-9818-25372e1f4e09
5 Replies
Project ID:
6bdec234-7b62-42c0-9818-25372e1f4e09
You need to split this into multiple services. Setup one for web, and one for the celery queue
how to do that?
can this method work with multiple workers? Suppose I have 4 celery workers, one way is to set 1 worker and concurrency=4.
Another way is to literally run the line 4 times with 4 different queue name.
For the 2nd case, does that mean I should run 4 separate service for each worker?
What would the overhead in memory cost be with this method?
one service with concurrency set to 4 will do just fine