AWS Beanstalk部署失败,退出状态为1

时间:2018-12-15 15:22:04

标签: python django amazon-elastic-beanstalk saleor

我已经尝试了几天,以在Amazon Web Services的Elastic Beanstalk下设置Django。大多数时候,我都会遇到以下错误:

错误:您的requirements.txt无效。快照您的日志以获取详细信息。

这里的目录结构:

├── .ebextensions
│   └── django.config
├── .elasticbeanstalk
│   ├── config.yml
├── .git
├── .gitignore
├── manage.py
├── saleor
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
└── requirements.txt

这是.ebextensions中的django.config文件:

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: saleor/wsgi.py
packages:
  yum:
    gcc: []
    python36-devel: []
    gcc-c++: []
    libffi-devel: []
    postgresql93-devel: []

Requirements.txt:

amqp==2.3.2
aniso8601==3.0.2
autopep8==1.4.3
Babel==2.6.0
billiard==3.5.0.4
bleach==2.1.4
boto3==1.9.57
botocore==1.12.57
braintree==3.49.0
cairocffi==0.9.0
CairoSVG==2.2.1
celery==4.2.1
certifi==2018.11.29
cffi==1.11.5
chardet==3.0.4
cssselect2==0.2.1
defusedxml==0.5.0
dj-database-url==0.5.0
dj-email-url==0.1.0
Django==2.1.3
django-appconf==1.0.2
django-babel==0.6.2
django-bootstrap4==0.0.7
django-cache-url==3.0.0
django-celery-results==1.0.4
django-countries==5.3.2
django-debug-toolbar==1.10.1
django-debug-toolbar-request-history==0.0.9
django-elasticsearch-dsl==0.5.1
django-filter==2.0.0
django-fsm==2.6.0
django-graphql-jwt==0.2.0
django-impersonate==1.3
django-js-asset==1.1.0
django-measurement==3.0.0
django-mptt==0.9.1
django-phonenumber-field==2.1.0
django-prices==1.0.4
django-prices-openexchangerates==1.0.1
django-prices-vatlayer==1.0.2
django-recaptcha==1.4.0
django-redis==4.10.0
django-render-block==0.5
django-silk==2.0.0
django-storages==1.7.1
django-templated-email==2.2.0
django-versatileimagefield==1.10
django-webpack-loader==0.6.0
docutils==0.14
elasticsearch==6.0.0
elasticsearch-dsl==6.0.1
Faker==1.0.0
freezegun==0.3.11
google-i18n-address==2.3.3
google-measurement-protocol==1.0.0
gprof2dot==2016.10.13
graphene==2.1.3
graphene-django==2.2.0
graphene-django-optimizer==0.3.5
graphql-core==2.1
graphql-relay==0.4.5
html5lib==1.0.1
idna==2.7
ipaddress==1.0.22
Jinja2==2.10
jmespath==0.9.3
jsonfield==2.0.2
kombu==4.2.1
Markdown==3.0.1
MarkupSafe==1.1.0
maxminddb==1.4.1
maxminddb-geolite2==2018.703
measurement==2.0.1
mpmath==1.0.0
oauthlib==2.1.0
phonenumberslite==8.10.1
Pillow==5.3.0
prices==1.0.0
promise==2.2.1
psycopg2-binary==2.7.6.1
purl==1.4
pycodestyle==2.4.0
pycparser==2.19
Pygments==2.3.0
PyJWT==1.6.4
Pyphen==0.9.5
python-dateutil==2.7.5
python3-openid==3.1.0
pytz==2018.7
raven==6.9.0
razorpay==1.1.1
redis==3.0.1
requests==2.20.1
requests-oauthlib==1.0.0
Rx==1.6.1
s3transfer==0.1.13
singledispatch==3.4.0.3
six==1.11.0
social-auth-app-django==3.1.0
social-auth-core==2.0.0
sqlparse==0.2.4
sympy==1.3
text-unidecode==1.2
tinycss2==0.6.1
typing==3.6.6
urllib3==1.22
uWSGI==2.0.17.1
vine==1.1.4
WeasyPrint==43
webencodings==0.5.1 

错误:

-------------------------------------
/var/log/eb-activity.log
-------------------------------------
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 47, in _execfile
          exec(code, globals, locals)
        File "/tmp/easy_install-q1ck81sr/cffi-1.11.5/setup.py", line 240, in <module>
        File "/usr/lib64/python3.6/distutils/core.py", line 163, in setup
          raise SystemExit("error: " + str(msg))
      SystemExit: error: command 'gcc' failed with exit status 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1101, in run_setup
          run_setup(setup_script, args)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 251, in run_setup
          raise
        File "/usr/lib64/python3.6/contextlib.py", line 99, in __exit__
          self.gen.throw(type, value, traceback)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 198, in setup_context
          yield
        File "/usr/lib64/python3.6/contextlib.py", line 99, in __exit__
          self.gen.throw(type, value, traceback)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 169, in save_modules
          saved_exc.resume()
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 144, in resume
          six.reraise(type, exc, self._tb)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/pkg_resources/_vendor/six.py", line 685, in reraise
          raise value.with_traceback(tb)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 157, in save_modules
          yield saved
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 198, in setup_context
          yield
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 248, in run_setup
          DirectorySandbox(setup_dir).run(runner)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 278, in run
          return func()
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 246, in runner
          _execfile(setup_script, ns)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 47, in _execfile
          exec(code, globals, locals)
        File "/tmp/easy_install-q1ck81sr/cffi-1.11.5/setup.py", line 240, in <module>
        File "/usr/lib64/python3.6/distutils/core.py", line 163, in setup
          raise SystemExit("error: " + str(msg))
      SystemExit: error: command 'gcc' failed with exit status 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/tmp/pip-build-y4onvdfc/cairocffi/setup.py", line 51, in <module>
          'test': ['pytest-runner', 'pytest-cov'],
        File "/usr/lib64/python3.6/distutils/core.py", line 108, in setup
          _setup_distribution = dist = klass(attrs)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/dist.py", line 315, in __init__
          self.fetch_build_eggs(attrs['setup_requires'])
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/dist.py", line 361, in fetch_build_eggs
          replace_conflicting=True,
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 850, in resolve
          dist = best[req.key] = env.best_match(req, ws, installer)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1122, in best_match
          return self.obtain(req, installer)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1134, in obtain
          return installer(requirement)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/dist.py", line 429, in fetch_build_egg
          return cmd.easy_install(req)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 665, in easy_install
          return self.install_item(spec, dist.location, tmpdir, deps)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 695, in install_item
          dists = self.install_eggs(spec, download, tmpdir)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 876, in install_eggs
          return self.build_and_install(setup_script, setup_base)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1115, in build_and_install
          self.run_setup(setup_script, setup_base, args)
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1103, in run_setup
          raise DistutilsError("Setup script exited with %s" % (v.args[0],))
      distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1

      ----------------------------------------
  Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-y4onvdfc/cairocffi/
  You are using pip version 9.0.1, however version 18.1 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.
  2018-12-15 14:32:03,189 ERROR    Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
  Traceback (most recent call last):
    File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
      install_dependencies()
    File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
      check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
    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 1 (Executor::NonZeroExitStatus)

1 个答案:

答案 0 :(得分:0)

我想知道既然您的django.config位于.ebextensions中,您是否需要在文件位置参考中上一层楼?

WSGIPath: ../saleor/wsgi.py
相关问题