我有一个使用芹菜的django应用程序,我正在迁移到AWS。我已经同时从Python 2.7升级到3.6。
我无法让celery在AWS上运行,出现以下错误:
Application deployment failed at 2018-08-06T14:02:02Z with exit status 127 and error: Hook /opt/elasticbeanstalk/hooks/appdeploy/post/run_supervised_celeryd.sh failed.
[program:django-celery-worker]
; Set full path to celery program if using virtualenv
command=/opt/python/run/venv/bin/python /opt/python/current/app/manage.py celery worker -A myapp --loglevel=INFO
directory=/opt/python/current/app
user=nobody
numprocs=1
stdout_logfile=/var/log/celery-worker.log
stderr_logfile=/var/log/celery-worker.log
autostart=true
autorestart=true
startsecs=10
; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs = 600
; When resorting to send SIGKILL to the program to terminate it
; send SIGKILL to its whole process group instead,
; taking care of its children as well.
killasgroup=true
; if rabbitmq is supervised, set its priority higher
; so it starts first
priority=998
environment=PYTHONPATH="/opt/python/current/app/:",PATH="/opt/python/run/venv/bin/:%(ENV_PATH)s",RDS_PORT="5432",RDS_PASSWORD="stmtrx321",RDS_DB_NAME="ebdb",RDS_USERNAME="postgres",RDS_HOSTNAME="aan9bvuq3a4wd1.cxzlzbczjyp1.us-east-1.rds.amazonaws.com"
/opt/elasticbeanstalk/hooks/appdeploy/post/run_supervised_celeryd.sh: line 47: supervisorctl: command not found
/opt/elasticbeanstalk/hooks/appdeploy/post/run_supervised_celeryd.sh: line 50: supervisorctl: command not found
/opt/elasticbeanstalk/hooks/appdeploy/post/run_supervised_celeryd.sh: line 53: supervisorctl: command not found.
Incorrect application version "app-b38e-180802_150757" (deployment 23). Expected version "app-0def-180806_140451" (deployment 26).
supervisor
已安装。
这是我的配置文件:
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/run_supervised_celeryd.sh" :
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
# Get django environment variables
celeryenv=`cat /opt/python/current/env | tr '\n' ',' | sed 's/export //g' | sed 's/$PATH/%(ENV_PATH)s/g' | sed 's/$PYTHONPATH//g' | sed 's/$LD_LIBRARY_PATH//g'`
celeryenv=${celeryenv%?}
# Create celery configuration script
celeryconf="[program:django-celery-worker]
; Set full path to celery program if using virtualenv
command=/opt/python/run/venv/bin/python /opt/python/current/app/manage.py celery worker -A myapp --loglevel=INFO
directory=/opt/python/current/app
user=nobody
numprocs=1
stdout_logfile=/var/log/celery-worker.log
stderr_logfile=/var/log/celery-worker.log
autostart=true
autorestart=true
startsecs=10
; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs = 600
; When resorting to send SIGKILL to the program to terminate it
; send SIGKILL to its whole process group instead,
; taking care of its children as well.
killasgroup=true
; if rabbitmq is supervised, set its priority higher
; so it starts first
priority=998
environment=$celeryenv"
# Create the celery supervisord conf script
echo "$celeryconf" | tee /opt/python/etc/celery.conf
# Add configuration script to supervisord conf (if not there already)
if ! grep -Fxq "[include]" /opt/python/etc/supervisord.conf
then
echo "[include]" | tee -a /opt/python/etc/supervisord.conf
echo "files: celery.conf" | tee -a /opt/python/etc/supervisord.conf
fi
# Reread the supervisord config
supervisorctl -c /opt/python/etc/supervisord.conf reread
# Update supervisord in cache without restarting all services
supervisorctl -c /opt/python/etc/supervisord.conf update
# Start/Restart celeryd through supervisord
supervisorctl -c /opt/python/etc/supervisord.conf restart django-celery-worker
container_commands:
01_celery_tasks_run:
command: "/opt/elasticbeanstalk/hooks/appdeploy/post/run_supervised_celeryd.sh"
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: myapp/wsgi.py
aws:elb:listener:443:
SSLCertificateId: arn:aws:acm:us-east-1:349705394408:certificate/5e94d3d2-039a-4ffc-bf7e-06995dc65fc9
ListenerProtocol: HTTPS
InstancePort: 80
我怎么了?