无法在 AWS Elastic Beanstalk 中创建环境?

Posted

技术标签:

【中文标题】无法在 AWS Elastic Beanstalk 中创建环境?【英文标题】:Unable to create environment in AWS Elastic Beanstalk? 【发布时间】:2016-04-30 17:30:33 【问题描述】:

我做了一个小的 Django 应用程序;我想在 AWS 上部署它。我遵循了命令 here 。现在,当我执行 eb create 时,它会说

ERROR: Your requirements.txt is invalid. Snapshot your logs for details. ERROR: [Instance: i-05fde0dc] Command failed on instance. Return code: 1 Output: (TRUNCATED)...) File "/usr/lib64/python2.7/subprocess.py", line 540, 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. INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].

详细日志为here。我在 postgresql 中的数据库,为此我必须运行单独的 RDS 实例吗? 我的 config.ymlbranch-defaults: master: environment: feedy2-dev group_suffix: null global: application_name: feedy2 default_ec2_keyname: aws-eb default_platform: Python 2.7 default_region: us-west-2 profile: eb-cli sc: git 我的 01-django-eb.config

option_settings:
  "aws:elasticbeanstalk:application:environment":
    DJANGO_SETTINGS_MODULE: "feedy2.settings"
    PYTHONPATH: "/opt/python/current/app/feedy2:$PYTHONPATH"
  "aws:elasticbeanstalk:container:python":
    WSGIPath: "feedy2/feedy2/wsgi.py"

container_commands:
  01_migrate:
    command: "django-admin.py migrate"
    leader_only: true

我的目录结构: . ├── feedy2 │   ├── businesses │   │   │   ├── customers │   │  │   ├── db.sqlite3 │   ├── feedy2 │   │   ├── __init__.py │   │   ├── __init__.pyc │   │   ├── settings.py │   │   ├── settings.pyc │   │   ├── urls.py │   │   ├── urls.pyc │   │   ├── wsgi.py │   │   └── wsgi.pyc │   ├── manage.py │   ├── questions │   │   │   ├── static │   ├── surveys │   └── templates ├── readme.md └── requirements.txt

【问题讨论】:

【参考方案1】:

您截断了输出的相关部分,但它位于 pastebin 链接中:

Collecting psycopg2==2.6.1 (from -r /opt/python/ondeck/app/requirements.txt (line 20))
 Using cached psycopg2-2.6.1.tar.gz
  Complete output from command python setup.py egg_info:
  running egg_info
  creating pip-egg-info/psycopg2.egg-info
  writing pip-egg-info/psycopg2.egg-info/PKG-INFO
  writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
  writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
  writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
  warning: manifest_maker: standard file '-c' not found

  Error: pg_config executable not found.

您需要安装 postgresql[version]-devel 包。将以下内容放入.ebextensions/packages.config'

packages:
  yum:
    postgresql94-devel: []

来源:Psycopg2 on Amazon Elastic Beanstalk

【讨论】:

我改了很多东西不知道具体是什么;现在我得到了一个不同的错误。 ImportError: No module named feedy2.settings. 添加有问题的树结构。 这看起来像是拼写错误,与问题中所述的问题无关。

以上是关于无法在 AWS Elastic Beanstalk 中创建环境?的主要内容,如果未能解决你的问题,请参考以下文章

AWS Elastic Beanstalk 无法担任角色

AWS - Elastic BeansTalk:[错误] 'php' 未找到或无法统计

超时后无法部署到 AWS Elastic Beanstalk

AWS Elastic Beanstalk 问题

无法在命令行或管理仪表板中创建 AWS Elastic Beanstalk 环境

AWS Elastic Beanstalk 错误我无法部署