Elastic Beanstalk crashes when creating additional instances

0

I have an Elastic Beanstalk application running. I recently added django_weasyprint to enable conversion of HTML pages to PDF. It installs and loads without a problem but when it tries to boot up additional instances or if I try and upgrade to the latest environment, I get the following error.

Application deployment failed at 2020-04-15T08:22:29Z with exit status 1 and error: container_command 02_collectstatic in .ebextensions/03_python.config failed.

Traceback (most recent call last):
File "webcdi/./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
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 357, in execute
django.setup()
File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/apps/registry.py", line 122, in populate
app_config.ready()
File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/contrib/admin/apps.py", line 24, in ready
self.module.autodiscover()
File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
autodiscover_modules(&#39;admin&#39;, register_to=site)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules
import_module(&#39;%s.%s&#39; % (app_config.name, module_to_search))
File "/opt/python/run/venv/lib64/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/python/bundle/2/app/webcdi/researcher_UI/admin.py", line 7, in <module>
from .admin_actions import scoring_data, scoring_summary
File "/opt/python/bundle/2/app/webcdi/researcher_UI/admin_actions.py", line 6, in <module>
from .views import download_data, download_summary
File "/opt/python/bundle/2/app/webcdi/researcher_UI/views.py", line 11, in <module>
from .tables import StudyAdministrationTable
File "/opt/python/bundle/2/app/webcdi/researcher_UI/tables.py", line 2, in <module>
from cdi_forms import views
File "/opt/python/bundle/2/app/webcdi/cdi_forms/views.py", line 1142, in <module>
from django_weasyprint import WeasyTemplateResponseMixin
File "/opt/python/run/venv/local/lib/python3.6/site-packages/django_weasyprint/__init__.py", line 1, in <module>
from .views import WeasyTemplateResponseMixin, WeasyTemplateView, WeasyTemplateResponse
File "/opt/python/run/venv/local/lib/python3.6/site-packages/django_weasyprint/views.py", line 4, in <module>
import weasyprint
File "/opt/python/run/venv/local/lib/python3.6/site-packages/weasyprint/__init__.py", line 440, in <module>
from .css import preprocess_stylesheet # noqa isort:skip
File "/opt/python/run/venv/local/lib/python3.6/site-packages/weasyprint/css/__init__.py", line 30, in <module>
from . import computed_values, media_queries
File "/opt/python/run/venv/local/lib/python3.6/site-packages/weasyprint/css/computed_values.py", line 18, in <module>
from .. import text
File "/opt/python/run/venv/local/lib/python3.6/site-packages/weasyprint/text.py", line 14, in <module>
import cairocffi as cairo
ModuleNotFoundError: No module named &#39;cairocffi&#39;.

cairocffi==1.1.0 is in the requirements.txt file.

asked 4 years ago269 views
1 Answer
0

I worked out the issue. I needed to overwrite some of the files AWS downloaded with more specific file which I was doing using

  03_requirements:
    command: "source /opt/python/run/venv/bin/activate && pip install -r requirements.txt"
    leader_only: false

I previously had leader_only set to true so updated files were not downloaded for additional instances

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions