From faebe67511b32ea6f3840c86d0b2017a5f65f756 Mon Sep 17 00:00:00 2001 From: richtier Date: Fri, 12 Jun 2020 14:06:58 +0100 Subject: [PATCH 1/2] Switch to gevent --- Procfile | 2 +- conf/wsgi.py | 4 ++++ requirements.in | 5 +++-- requirements.txt | 7 +++++-- requirements_test.txt | 11 +++++++---- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Procfile b/Procfile index 0c7bd5d4..6a4b6cdf 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,3 @@ -web: python manage.py distributed_migrate --noinput && gunicorn conf.wsgi --bind 0.0.0.0:$PORT +web: python manage.py distributed_migrate --noinput && gunicorn conf.wsgi --worker-class gevent --worker-connections 1000 --bind 0.0.0.0:$PORT celery_worker: FEATURE_ENFORCE_STAFF_SSO_ENABLED=False celery -A conf worker -l info celery_beat: FEATURE_ENFORCE_STAFF_SSO_ENABLED=False celery -A conf beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler \ No newline at end of file diff --git a/conf/wsgi.py b/conf/wsgi.py index ce8d936b..847f7c67 100644 --- a/conf/wsgi.py +++ b/conf/wsgi.py @@ -11,6 +11,10 @@ from django.core.wsgi import get_wsgi_application +import psycogreen.gevent +psycogreen.gevent.patch_psycopg() + + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conf.settings") application = get_wsgi_application() diff --git a/requirements.in b/requirements.in index 1a9eb3e6..47436554 100644 --- a/requirements.in +++ b/requirements.in @@ -2,7 +2,6 @@ django==2.2.* djangorestframework==3.9.* django-environ==0.4.5 gunicorn==19.5.0 -gevent==1.2.2 sentry-sdk==0.13.4 django_storages==1.7.1 whitenoise==4.1.2 @@ -36,4 +35,6 @@ notifications-python-client==5.3.* pillow>=6.* # for security fix. check compatibility on next wagtail upgrade num2words==0.5.10 pycountry==19.8.18 -elastic-apm>=5.5.2,<6.0.0 \ No newline at end of file +elastic-apm>=5.5.2,<6.0.0 +gevent>=20.6.1,<21.0.0 +psycogreen>=1.0.2,<2.0.0 diff --git a/requirements.txt b/requirements.txt index 63617f47..b0221ef9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -39,9 +39,9 @@ djangorestframework==3.9.4 # via -r requirements.in, sigauth, wagtail docopt==0.6.2 # via notifications-python-client, num2words docutils==0.16 # via botocore draftjs-exporter==2.1.7 # via wagtail -elastic-apm==5.6.0 # via -r requirements.in +elastic-apm==5.7.0 # via -r requirements.in future==0.18.2 # via celery, notifications-python-client -gevent==1.2.2 # via -r requirements.in +gevent==20.6.1 # via -r requirements.in greenlet==0.4.16 # via gevent gunicorn==19.5.0 # via -r requirements.in html2text==2018.1.9 # via -r requirements.in @@ -59,6 +59,7 @@ num2words==0.5.10 # via -r requirements.in oauthlib==3.1.0 # via requests-oauthlib packaging==20.4 # via bleach pillow==6.2.2 # via -r requirements.in, wagtail +psycogreen==1.0.2 # via -r requirements.in psycopg2==2.7.3.2 # via -r requirements.in pycountry==19.8.18 # via -r requirements.in pyjwt==1.7.1 # via notifications-python-client @@ -87,6 +88,8 @@ webencodings==0.5.1 # via bleach, html5lib whitenoise==4.1.2 # via -r requirements.in willow==1.3 # via wagtail zipp==3.1.0 # via importlib-metadata +zope.event==4.4 # via gevent +zope.interface==5.1.0 # via gevent # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/requirements_test.txt b/requirements_test.txt index 6f305799..3b06e3a5 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -43,13 +43,13 @@ djangorestframework==3.9.4 # via -r requirements.in, sigauth, wagtail docopt==0.6.2 # via coveralls, notifications-python-client, num2words docutils==0.16 # via botocore draftjs-exporter==2.1.7 # via wagtail -elastic-apm==5.6.0 # via -r requirements.in +elastic-apm==5.7.0 # via -r requirements.in factory-boy==2.12.0 # via -r requirements_test.in, wagtail-factories faker==4.1.0 # via factory-boy -flake8==3.8.2 # via -r requirements_test.in +flake8==3.8.3 # via -r requirements_test.in freezegun==0.3.14 # via -r requirements_test.in future==0.18.2 # via celery, notifications-python-client -gevent==1.2.2 # via -r requirements.in +gevent==20.6.1 # via -r requirements.in greenlet==0.4.16 # via gevent gunicorn==19.5.0 # via -r requirements.in html2text==2018.1.9 # via -r requirements.in @@ -69,8 +69,9 @@ num2words==0.5.10 # via -r requirements.in oauthlib==3.1.0 # via requests-oauthlib packaging==20.4 # via bleach, pytest, pytest-sugar pillow==6.2.2 # via -r requirements.in, wagtail -pip-tools==5.2.0 # via -r requirements_test.in +pip-tools==5.2.1 # via -r requirements_test.in pluggy==0.13.1 # via pytest +psycogreen==1.0.2 # via -r requirements.in psycopg2==2.7.3.2 # via -r requirements.in py==1.8.1 # via pytest pycodestyle==2.6.0 # via flake8 @@ -111,6 +112,8 @@ webencodings==0.5.1 # via bleach, html5lib whitenoise==4.1.2 # via -r requirements.in willow==1.3 # via wagtail zipp==3.1.0 # via importlib-metadata +zope.event==4.4 # via gevent +zope.interface==5.1.0 # via gevent # The following packages are considered to be unsafe in a requirements file: # pip From 86085cec5262f39402590c661df4caf17bbdc641 Mon Sep 17 00:00:00 2001 From: Richard Tier Date: Wed, 17 Jun 2020 10:38:37 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0a16c11..5d9ad14b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ ### Implemented enhancements ### Fixed bugs + +## [2020.06.15](https://github.com/uktrade/directory-cms/releases/tag/2020.06.15) +[Full Changelog](https://github.com/uktrade/directory-cms/compare/2020.06.12...2020.06.15) + +### Hotfix +- No ticket - Stop using signal.alarm for bailing out of expensive code + + ## [2020.06.12](https://github.com/uktrade/directory-cms/releases/tag/2020.06.12) [Full Changelog](https://github.com/uktrade/directory-cms/compare/2020.05.28...2020.06.12)