我正在尝试部署Flask应用。当我做eb deploy
时,出现以下错误消息:
Creating application version archive "app-b7bf-180817_005316".
Uploading: [##################################################] 100% Done...
2018-08-17 03:56:25 INFO Environment update is starting.
2018-08-17 03:56:31 INFO Deploying new version to instance(s).
2018-08-17 03:56:47 ERROR Your requirements.txt is invalid. Snapshot your logs for details.
2018-08-17 03:56:50 ERROR [Instance: i-0dc70ef7e857898e6] Command failed on instance. Return code: 1 Output: (TRUNCATED)...)
File "/usr/lib64/python2.7/subprocess.py", line 186, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 2.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2018-08-17 03:56:51 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2018-08-17 03:56:51 ERROR Unsuccessful command execution on instance id(s) 'i-0dc70ef7e857898e6'. Aborting the operation.
2018-08-17 03:56:51 ERROR Failed to deploy application.
检查eb logs
后,我发现问题出在尝试安装scipy时:
Creating application version archive "app-b7bf-180817_005316".
Uploading: [##################################################] 100% Done...
2018-08-17 03:56:25 INFO Environment update is starting.
2018-08-17 03:56:31 INFO Deploying new version to instance(s).
2018-08-17 03:56:47 ERROR Your requirements.txt is invalid. Snapshot your logs for details.
2018-08-17 03:56:50 ERROR [Instance: i-0dc70ef7e857898e6] Command failed on instance. Return code: 1 Output: (TRUNCATED)...)
File "/usr/lib64/python2.7/subprocess.py", line 186, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 2.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2018-08-17 03:56:51 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2018-08-17 03:56:51 ERROR Unsuccessful command execution on instance id(s) 'i-0dc70ef7e857898e6'. Aborting the operation.
2018-08-17 03:56:51 ERROR Failed to deploy application.
我对MemoryError
进行了一些研究,似乎可以使用命令行参数--no-cache-dir
来解决问题。我创建了一个名为.ebextensions
的文件夹,并创建了一个名为.config
的{{1}}文件,其中包含:
python.config
我认为这可以某种方式配置部署,因此它使用no cache选项调用pip install。但是,这是一种忽略,因为根据日志,没有使用命令行,因此我假设我的配置文件被忽略了。
我正在使用AWS免费套餐,这是我的commands:
01_no_cache:
command: /opt/python/run/venv/bin/pip install -r --no-cache-dir /opt/python/ondeck/app/requirements.txt
:
requirements.txt