【问题标题】:Elastic Beanstalk unable to install packagesElastic Beanstalk 无法安装软件包
【发布时间】:2015-01-15 19:00:45
【问题描述】:

我正在尝试在 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. 上面的配置文件似乎在 requirements.txt 出现在 root 之后运行
  2. 无法安装这些软件包(如上所述),但我可以通过进入 EC2 实例的 ssh 进行安装(奇怪)

[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)

然后,我使用了以下设置

包: 百胜: 蟒蛇开发:[] 易于: 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 安装这些软件包时,自动化有什么问题?我的设置有什么问题?

【问题讨论】:

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


    【解决方案1】:

    在 yum 语句中使用 postgresql93-devel,因为他们已经更新了包名

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

    【讨论】:

    • 截至 2015 年 12 月,将 python-devel 作为包依赖项在 Beanstalk 中提供 Yum does not have python-devel available for installation
    • @jmq,你知道怎么用yum安装python-devel吗?我正在尝试在 AWS 上安装,但收到“Yum 没有可用于安装的 python-devel”。
    • @tmthyjames 我不知道。我尝试安装它是根据我发现的一些与我的项目具有的其他一些依赖项相关的各种博客文章的推荐,但我发现我根本不需要它来达到我的目的。不过要考虑的一件事是在编写自定义命令时调查--enablerepo=epel 选项。参考AWS docs。抱歉,我帮不上忙。
    • @jmq 试试python26-devel
    【解决方案2】:

    除了手动安装这些软件包之外,我找不到其他方法。

    packages:
      yum:
        ...
    
    commands:
      01_python_devel_install:
        command: 'yum install -y python34-devel'
    
      02_postgresql_install:
        command: 'yum install -y postgresql94 postgresql94-devel'
    

    我从弹性豆茎开始,这给我的第一印象并不好。

    【讨论】:

      【解决方案3】:

      这是根据 AWS 的正确方法。

      Python 3

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

      Python 2.7

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

      Reference

      【讨论】:

        猜你喜欢
        • 2020-09-11
        • 2017-07-31
        • 2017-07-24
        • 2018-01-29
        • 2016-11-08
        • 2020-10-11
        • 2018-06-28
        • 2014-07-31
        • 1970-01-01
        相关资源
        最近更新 更多