在我的最新提交之前,我一直在部署我的应用程序而没有任何问题到beanstalk环境。
现在我明白了
Time Type Details
2013-09-01 10:19:12 UTC+0800 ERROR Failed to deploy application.
2013-09-01 10:19:11 UTC+0800 ERROR Responses from [i-50f40d06] were received, but the commands failed.
2013-09-01 10:19:11 UTC+0800 ERROR Your requirements.txt is invalid. Snapshot your logs for details.
2013-09-01 10:19:11 UTC+0800 ERROR [Instance: i-50f40d06 Module: AWSEBAutoScalingGroup ConfigSet: Hook-PreAppDeploy] Failed on instance with return code: 1 Output: Error occurred during build: Command hooks failed .
快照日志说明了这一点:
2013-09-01 02:19:08,852 [INFO] (9941 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Output from script: New python executable in /opt/python/run/venv/bin/python2.6
Not overwriting existing python script /opt/python/run/venv/bin/python (you must use /opt/python/run/venv/bin/python2.6)
Installing distribute..................................................................................................................................................................................................done.
Installing pip................done.
2013-09-01 02:19:08,564 ERROR Error installing dependencies: Command '/opt/python/run/venv/bin/pip install --use-mirrors -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status -9
Traceback (most recent call last):
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 31, in main
install_dependencies()
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 25, in install_dependencies
shell=True)
File "/usr/lib/python2.6/subprocess.py", line 502, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install --use-mirrors -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status -9
2013-09-01 02:19:08,853 [ERROR] (9941 MainThread) [directoryHooksExecutor.py-34] [root directoryHooksExecutor error] Script failed with returncode 1
2
我的requirements.txt和以前一样。我尝试删除requirements.txt中的所有内容,但我再次收到相同的错误,这让我觉得问题出现在requirements.txt运行之前。
我不知道部署内容的顺序。 ANyway,这是我的配置文件:
packages:
yum:
libjpeg-devel: '6b'
zlib-devel: []
freetype-devel: []
container_commands:
01_install_mysqldb:
command: "pip install distribute==0.6.28; pip install mysql-python;"
02_syncdb:
command: "python manage.py syncdb --noinput"
leader_only: true
03_createadmin:
command: "python scripts/createadmin.py"
leader_only: true
04_collectstatic:
command: "python manage.py collectstatic --noinput"
05_migrate_wizards:
command: "python manage.py migrate wizards --noinput"
leader_only: true
06_migrate_facebook:
command: "python manage.py migrate facebook --noinput"
leader_only: true
07_migrate_socialaccount:
command: "python manage.py migrate socialaccount 0011 --noinput"
leader_only: true
08_migrate_missions:
command: "python manage.py migrate missions --noinput"
leader_only: true
09_migrate_mailchimp:
command: "python manage.py migrate mailchimp --noinput"
leader_only: true
10_migrate_actstream:
command: "python manage.py migrate actstream --noinput"
leader_only: true
option_settings:
- namespace: aws:elasticbeanstalk:container:python
option_name: WSGIPath
value: ideatory/wsgi.py
- namespace: aws:elasticbeanstalk:container:python:staticfiles
option_name: /static/
value: static/
- option_name: DJANGO_SETTINGS_MODULE
value: ideatory.settings
答案 0 :(得分:12)
我遇到了完全相同的问题。唯一对我有用的是(自动)重建我的整个环境。您可以在AWS控制台中执行此操作。转到您的环境,然后点击操作>重建环境。这将需要一些时间,之后它将自动重新启动您的应用程序,而不会出现此错误。
<强>更新强>
问题一直在不断回归。我发现当pip编译psycopg
时会出现问题,这是postgreSQL支持所需要的。尚未找到真正的解决方案。
答案 1 :(得分:11)
我能够通过将postgresql93-devel
和postgresql93
添加到我的.ebextensions
,如 Customizing the Software on EC2 Instances Running Linux
中所述这适用于64bit Amazon Linux 2014.09 v1.0.9 running Python 2.7
.ebextensions/01_pre_deps.config
中的:
packages:
yum:
gcc-c++: []
make: []
openssl-devel: []
git: []
python-devel: []
python27-devel: []
ruby-devel: []
postgresql93: []
postgresql93-devel: []
# nginx: []
rubygems:
bundler: '1.7.3'
compass-core: '1.1.0.alpha.3'
neat-compass: '1.6.0'
答案 2 :(得分:1)
您确定已安装mysql-devel
包吗?它似乎不包含在配置文件的yum
部分中。
答案 3 :(得分:0)
无论出于何种原因,AWS都不会像蛋黄建议的那样从postgresql-devel
安装.extensions/01_packets.config
个数据包。所以我不得不添加
container_commands:
01_addPostgreSQLPacket:
command: 'yum install postgresql95-devel'
leader_only: true
到我的02_django.config
。之后它运作得很好。
答案 4 :(得分:0)
尽管与OP描述的场景不同,但是它可能对某人有用:
在尝试将最小测试应用程序部署到Elastic Beanstalk上新创建的ERROR Your requirements.txt is invalid. Snapshot your logs for details.
实例时,我们得到了相同的t1.micro
消息。
测试应用程序由基本的AWS Python示例应用程序(from here)组成,我们在生产环境中向其中添加了.ebextensions/software.config
和requirements.txt
。唯一的目的是在部署中测试这两个文件。
在MemoryError
期间,对日志的更严格检查发现了pip install
。升级到t2.small
实例后,部署成功而没有问题。