AWS Elastic Beanstalk - нет DNSPython, препятствующего развертыванию - PullRequest
0 голосов
/ 26 сентября 2018

Я не могу «развернуть».На этапе развертывания после сборки происходит сбой.

Похоже, пакет dnspython == 1.15.0 не устанавливается, и это может как-то взорвать развертывание.

Я думаю, что это как-то связано с pymongo.

Ошибка, указанная в консоли:

2018-09-26 19:03:56    INFO    Deploying new version to instance(s).
2018-09-26 19:04:06    ERROR   [Instance: i-07007dda5fe7bc81a] Command failed on instance. Return code: 1 Output: (TRUNCATED)...n/run/venv/local/lib64/python3.6/site-packages/pymongo/uri_parser.py", line 351, in parse_uri
raise ConfigurationError('The "dnspython" module must be '
pymongo.errors.ConfigurationError: The "dnspython" module must be installed to use mongodb+srv:// URIs. 
container_command 01_migrate in .ebextensions/db-migrate.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2018-09-26 19:04:06    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2018-09-26 19:04:06    ERROR   Unsuccessful command execution on instance id(s) 'i-07007dda5fe7bc81a'. Aborting the operation.

Вот полный журнал ошибок, от /var/log/eb-activity.log:

[2018-09-26T18:55:12.437Z] INFO  [25107] - [Application update app-64e9-180926_195501@21/AppDeployStage0/AppDeployPreHook/03deploy.py] : Completed activity. Result:
  Requirement already satisfied: Django==2.1.1 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 1))
  Requirement already satisfied: pytz==2018.5 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 2))
  Requirement already satisfied: djongo==1.2.30 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 3))
  Requirement already satisfied: django-dotenv==1.4.2 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 4))
  Requirement already satisfied: requests==2.19.1 in /opt/python/run/venv/lib/python3.6/site-packages (from -r /opt/python/ondeck/app/requirements.txt (line 5))
  Requirement already satisfied: pymongo>=3.2.0 in /opt/python/run/venv/lib64/python3.6/site-packages (from djongo==1.2.30->-r /opt/python/ondeck/app/requirements.txt (line 3))
  Requirement already satisfied: sqlparse>=0.2.3 in /opt/python/run/venv/lib/python3.6/site-packages (from djongo==1.2.30->-r /opt/python/ondeck/app/requirements.txt (line 3))
  Requirement already satisfied: dataclasses>=0.1 in /opt/python/run/venv/lib/python3.6/site-packages (from djongo==1.2.30->-r /opt/python/ondeck/app/requirements.txt (line 3))
  Requirement already satisfied: urllib3<1.24,>=1.21.1 in /opt/python/run/venv/lib/python3.6/site-packages (from requests==2.19.1->-r /opt/python/ondeck/app/requirements.txt (line 5))
  Requirement already satisfied: idna<2.8,>=2.5 in /opt/python/run/venv/lib/python3.6/site-packages (from requests==2.19.1->-r /opt/python/ondeck/app/requirements.txt (line 5))
  Requirement already satisfied: certifi>=2017.4.17 in /opt/python/run/venv/lib/python3.6/site-packages (from requests==2.19.1->-r /opt/python/ondeck/app/requirements.txt (line 5))
  Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /opt/python/run/venv/lib/python3.6/site-packages (from requests==2.19.1->-r /opt/python/ondeck/app/requirements.txt (line 5))
  You are using pip version 9.0.1, however version 18.0 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.
[2018-09-26T18:55:12.438Z] INFO  [25107] - [Application update app-64e9-180926_195501@21/AppDeployStage0/AppDeployPreHook/04configen.py] : Starting activity...
[2018-09-26T18:55:13.690Z] INFO  [25107] - [Application update app-64e9-180926_195501@21/AppDeployStage0/AppDeployPreHook/04configen.py] : Completed activity.
[2018-09-26T18:55:13.690Z] INFO  [25107] - [Application update app-64e9-180926_195501@21/AppDeployStage0/AppDeployPreHook] : Completed activity. Result:
  Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/pre.
[2018-09-26T18:55:13.690Z] INFO  [25107] - [Application update app-64e9-180926_195501@21/AppDeployStage0/EbExtensionPostBuild] : Starting activity...
[2018-09-26T18:55:14.088Z] INFO  [25107] - [Application update app-64e9-180926_195501@21/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Starting activity...
[2018-09-26T18:55:14.092Z] INFO  [25107] - [Application update app-64e9-180926_195501@21/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_cauradata] : Starting activity...
[2018-09-26T18:55:14.965Z] INFO  [25107] - [Application update app-64e9-180926_195501@21/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_cauradata/Test for Command 01_migrate] : Starting activity...
[2018-09-26T18:55:14.968Z] INFO  [25107] - [Application update app-64e9-180926_195501@21/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_cauradata/Test for Command 01_migrate] : Completed activity. Result:

  Completed successfully.
[2018-09-26T18:55:14.969Z] INFO  [25107] - [Application update app-64e9-180926_195501@21/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_cauradata/Command 01_migrate] : Starting activity...
[2018-09-26T18:55:15.463Z] INFO  [25107] - [Application update app-64e9-180926_195501@21/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_cauradata/Command 01_migrate] : Activity execution failed, because: Traceback (most recent call last):
  File "/opt/python/run/venv/bin/django-admin.py", line 5, in <module>
  management.execute_from_command_line()
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
  utility.execute()
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
  self.fetch_command(subcommand).run_from_argv(self.argv)

Мой .ebextensions/db-migrate.config говорит:

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

option_settings:
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: cauradata.settings

Я пытался удалить 01_migrate из файла db-migrate.config, это не работает.

(то есть удаление этого бита :)

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

Я пытался добавить пакет отдельно в db-migrate.config, вот так.Это ничего не меняет.

...
packages:
  yum:
    dnspython: []

В моей среде разработки у меня установлен DNSPython.Pip freeze говорит:

certifi==2018.8.24
chardet==3.0.4
dataclasses==0.6
Django==2.1.1
django-admin-json-editor==0.1.5
django-dotenv==1.4.2
django-jsonfield==1.0.1
django-test-addons==1.0
djongo==1.2.30
dnspython==1.15.0
idna==2.7
mongoengine==0.15.3
pymongo==3.7.1
pytz==2018.5
requests==2.19.1
six==1.11.0
sqlparse==0.2.4
urllib3==1.23

Когда я захожу по SSH на сервер и запускаю pip freeze, я получаю следующий список, который НЕ содержит DNSPython.Таким образом, DNSPython не установлен.

[ec2-user@ip-111111~]$ pip freeze
aws-cfn-bootstrap==1.4
aws-elasticbeanstalk-tools==1.20
awscli==1.14.9
awscli-cwlogs==1.4.4
Babel==0.9.4
backports.ssl-match-hostname==3.4.0.2
boto==2.48.0
botocore==1.8.13
chardet==2.0.1
cloud-init==0.7.6
colorama==0.2.5
configobj==4.7.2
docutils==0.11
ecdsa==0.11
futures==3.0.3
hibagent==1.0.0
iniparse==0.3.1
Jinja2==2.7.2
jmespath==0.9.2
jsonpatch==1.2
jsonpointer==1.0
kitchen==1.1.1
lockfile==0.8
MarkupSafe==0.11
meld3==1.0.2
paramiko==1.15.1
PIL==1.1.6
ply==3.4
pyasn1==0.1.7
pycrypto==2.6.1
pycurl==7.19.0
pygpgme==0.3
pyliblzma==0.5.3
pystache==0.5.3
python-daemon==1.5.2
python-dateutil==2.1
pyxattr==0.5.0
PyYAML==3.10
requests==1.2.3
rsa==3.4.1
simplejson==3.6.5
six==1.8.0
supervisor==3.1.3
urlgrabber==3.10
urllib3==1.8.2
virtualenv==15.1.0
yum-metadata-parser==1.1.4

Я пробовал SSH, pip install dnspython==1.15.0, а затем развертывание.Это не сработало.

Я пробовал «Перестроить среду» в консоли EB - не сработало

...