Koed00 / django-q

A multiprocessing distributed task queue for Django
https://django-q.readthedocs.org
MIT License
1.83k stars 285 forks source link

How to deploy to Railway.app #731

Closed valeriuv closed 11 months ago

valeriuv commented 11 months ago

I've searched all over the web, still can't figure out how to deploy django-q to Railway.

Right now I have a Procfile (apparently Railway only reads one line):

web: python manage.py migrate && python manage.py collectstatic --no-input && gunicorn fleetdata.wsgi & python manage.py qcluster

But the qcluster does not start. If I connect to Railway through the CLI railway up python manage.py qcluster, it works. But how do I sturt the qcluster so that it always works?

Thanks!

GDay commented 11 months ago

You will need to split the wsgi and the background worker. So like this:

web: python manage.py migrate && python manage.py collectstatic --no-input && gunicorn fleetdata.wsgi 
worker: python manage.py qcluster

This will create two services, so just be aware that it will add some extra costs.

valeriuv commented 11 months ago

You will need to split the wsgi and the background worker. So like this:

web: python manage.py migrate && python manage.py collectstatic --no-input && gunicorn fleetdata.wsgi 
worker: python manage.py qcluster

This will create two services, so just be aware that it will add some extra costs.

Thank you! This is exactly what I did. For someone looking for the answer in the future: make 2 services (which will be exact copies) from the same github branch, and in Settings under Deploy/Start Command for each service put start command (one line for each) like this:

Service Django: python manage.py migrate && python manage.py collectstatic --no-input && gunicorn fleetdata.wsgi

Service Django-Q: python manage.py qcluster

and remove the Procfile.