Elastic Beanstalk无法安装包

时间:2014-11-18 14:37:47

标签: python django amazon-web-services amazon-ec2 amazon-elastic-beanstalk

我尝试在AWS Elastic Beanstalk上部署我的应用程序。我收到此错误,完全无法查看问题所在。

以下是.ebextensions/mysite-env.config

中的代码
packages:
  yum:
    python-devel: []
    postgresql-devel: []

container_commands: 
  01_syncdb:
    command: "django-admin.py syncdb --noinput"
    leader_only: true
  02_createadmin: 
    command: "scripts/createadmin.py"
    leader_only: true

option_settings: 
  - option_name: WSGIPath
    namespace: "aws:elasticbeanstalk:container:python"
    value: "mysite/wsgi.py"
  - option_name: DJANGO_SETTINGS_MODULE
    value: "mysite.settings"

经过多次尝试,我想出了一些事情

  1. 以上配置文件似乎在root
  2. 中出现requirements.txt之后运行
  3. 无法安装这些软件包(如上所述)但我可以通过进入EC2实例ssh来安装(奇怪)
  4. [1]的问题是,要安装psycopg2,我需要上面提到的软件包。那么,我该如何先安装它们呢?

    当我运行这些设置时,我收到以下错误:

    [2014-11-19T09:45:19.819Z] INFO  [6703]  - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild] : Activity execution failed, because: command failed with error code 1: Error occurred during build: Yum does not have postgresql-devel available for installation (Executor::NonZeroExitStatus)
    

    然后,我使用了以下设置

    软件包:   百胜:     python-devel:[]   易于:     postgresql-devel:[]

    然后我收到以下错误:

    [2014-11-19T09:47:54.271Z] ERROR [6789]  : Command execution failed: [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild] command failed with error code 1: Error occurred during build: [Errno 2] No such file or directory (ElasticBeanstalk::ActivityFatalError)
        at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.0/lib/elasticbeanstalk/activity.rb:189:in `rescue in exec'
        ...
    caused by: command failed with error code 1: Error occurred during build: [Errno 2] No such file or directory (Executor::NonZeroExitStatus)
    

    当我可以直接从ssh安装这些软件包时,自动化问题是什么?我的设置有什么问题?

3 个答案:

答案 0 :(得分:5)

在yum语句中使用postgresql93-devel,因为它们已更新包名称

packages:
  yum:
    python26-devel: []
    postgresql93-devel: []

答案 1 :(得分:1)

根据AWS,这是正确的方法。

Python 3

packages:
  yum:
    python34-devel: []
    postgresql94-devel: []

Python 2.7

packages:
  yum:
    python27-devel: []
    postgresql94-devel: []

Reference

答案 2 :(得分:0)

我找不到另一种方法,而不是手动安装这些包。

packages:
  yum:
    ...

commands:
  01_python_devel_install:
    command: 'yum install -y python34-devel'

  02_postgresql_install:
    command: 'yum install -y postgresql94 postgresql94-devel'

我从弹性豆茎开始,这不会给我留下良好的第一印象。