2017-10-16 44 views
0

我試圖部署在彈性魔豆的燒瓶中的應用程序,但我得到以下錯誤,當我運行eb create如何包括非PIP依賴於AWS​​彈性魔豆

ERROR: Your requirements.txt is invalid. Snapshot your logs for details. 
ERROR: [Instance: i-04837a6167d3738a3] Command failed on instance. Return code: 1 Output: (TRUNCATED)...) 
    File "/usr/lib64/python2.7/subprocess.py", line 541, 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 1. 
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI. 

看來問題是來自應用程序使用的文章提取庫(http://newspaper.readthedocs.io/en/latest/index.html),它具有一些相關性,如sudo apt-get install libxml2-dev libxslt-devsudo apt-get install libjpeg-dev zlib1g-dev libpng12-dev

如何在Elastic Beanstalk上安裝這些依賴關係?

回答

0

你有幾個選項。

您可以安裝所有必需的軟件包,然後在安裝軟件包的情況下創建服務器映像。然後,您可以在啓動任何新實例時使用該AMI,並且這些軟件包將可用。

您還可以使用.ebextensions在代碼中對其進行管理。您可以使用它在服務器啓動時安裝您需要的任何軟件包。

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html

這可以如何工作的一個例子是我nginx的替代阿帕奇的豆莖應用:https://github.com/ricktbaker/beanstalk-nginx-php-fpm

或者,您可以創建自定義的平臺。這可能有點矯枉過正,但您可以選擇:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platforms.html