我在django项目中使用主管。这是我的supervisor.config文件看起来像
[unix_http_server]
file=/tmp/supervisor.sock
[supervisord]
logfile=/tmp/supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
loglevel=info
pidfile=/tmp/supervisord.pid
nodaemon=false
minfds=1024
minprocs=200
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
[program:run_django]
environment=DJANGO_SETTINGS_MODULE=%(ENV_DJANGO_SETTINGS_MODULE)
command=/home/ubuntu/www/project-venv/bin/gunicorn project.wsgi:application -w 1 -b 127.0.0.1:8000 -t 300 --max-requests=100
directory=/home/ubuntu/www/project/
user=ubuntu
stdout_logfile=/home/ubuntu/www/project/logs/django_stdout.log
stderr_logfile=/home/ubuntu/www/project/logs/django_stderr.log
autorestart=true
redirect_stderr=true
但是我尝试通过CodeDeploy
部署到AWS EC2实例时遇到以下错误[stderr]/opt/codedeploy-agent/deployment-root/f57f7cd1-e8f9-457e-8a00-ae66d494c068/d-SYX2MO8SP/deployment-archive/supervisor/default.conf:
line 1: [unix_http_server]: command not found
[stderr]/opt/codedeploy-agent/deployment-root/f57f7cd1-e8f9-457e-8a00-ae66d494c068/d-SYX2MO8SP/deployment-archive/supervisor/default.conf:
line 3: [supervisord]: command not found
[stderr]/opt/codedeploy-agent/deployment-root/f57f7cd1-e8f9-457e-8a00-ae66d494c068/d-SYX2MO8SP/deployment-archive/supervisor/default.conf:
line 13: [rpcinterface:supervisor]: command not found
[stderr]/opt/codedeploy-agent/deployment-root/f57f7cd1-e8f9-457e-8a00-ae66d494c068/d-SYX2MO8SP/deployment-archive/supervisor/default.conf:
line 14: supervisor.rpcinterface_factory: command not found
[stderr]/opt/codedeploy-agent/deployment-root/f57f7cd1-e8f9-457e-8a00-ae66d494c068/d-SYX2MO8SP/deployment-archive/supervisor/default.conf:
line 16: [supervisorctl]: command not found
[stderr]/opt/codedeploy-agent/deployment-root/f57f7cd1-e8f9-457e-8a00-ae66d494c068/d-SYX2MO8SP/deployment-archive/supervisor/default.conf:
line 19: [program:run_django]: command not found
[stderr]/opt/codedeploy-agent/deployment-root/f57f7cd1-e8f9-457e-8a00-ae66d494c068/d-SYX2MO8SP/deployment-archive/supervisor/default.conf:
line 20: syntax error near unexpected token `('
[stderr]/opt/codedeploy-agent/deployment-root/f57f7cd1-e8f9-457e-8a00-ae66d494c068/d-SYX2MO8SP/deployment-archive/supervisor/default.conf:
line 20:
`environment=DJANGO_SETTINGS_MODULE=%(ENV_DJANGO_SETTINGS_MODULE)'
我在这里想念的是什么?
答案 0 :(得分:0)
我已将其作为apppec.yml文件中的脚本执行..我已将其包含在start_application.sh中。这是我的示例start_application脚本,它从appspec.yml文件
运行DJANGO_SETTINGS_MODULE=project.settings supervisord -c /home/ubuntu/www/project/supervisor/default.conf