Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Celery run on Elastic Beanstalk?

I'm looking for a straight-forward way to run Celery on an Elastic Beanstalk environment. Does this exist, or do I need to use SQS instead?

I have tried putting a line in the the .config file without good results. This is my .config file:

container_commands:   
  01_syncdb:
    command: "django-admin.py syncdb --noinput"
    leader_only: true   
  02_collectstatic:
    command: "./manage.py collectstatic --noinput"   
  03_migrate:
    command: "./manage.py migrate --noinput"   
  04_start_celery:
    command: "./manage.py celery worker &"

When I ssh to the EC2 server and run ps -ef | grep celery it shows that Celery isn't running.

Any help appreciated. Thanks!

like image 509
Krishan Gupta Avatar asked Nov 10 '14 19:11

Krishan Gupta


1 Answers

Celery doesn't show up because the container commands are run prior to reboot of the webserver during deployment. Basically, your celery workers get wiped out after the machine restarts.

I would suggest starting celery by using post deployment hooks.

See http://junkheap.net/blog/2013/05/20/elastic-beanstalk-post-deployment-scripts/ and How do you run a worker with AWS Elastic Beanstalk?

like image 80
Victor J Wang Avatar answered Sep 29 '22 07:09

Victor J Wang