From 013680f049d483c88aa1ba04f5153307b4665b55 Mon Sep 17 00:00:00 2001 From: Ashish Acharya Date: Sun, 26 Nov 2023 21:43:13 -0600 Subject: [PATCH 1/3] Add apt libraries for pycurl --- compose/local/django/Dockerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compose/local/django/Dockerfile b/compose/local/django/Dockerfile index 0609a409..8cddbdb1 100644 --- a/compose/local/django/Dockerfile +++ b/compose/local/django/Dockerfile @@ -11,7 +11,10 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ # dependencies for building Python packages build-essential \ # psycopg2 dependencies - libpq-dev + libpq-dev \ + # pycurl dependencies + libcurl4-openssl-dev \ + libssl-dev # Requirements are installed here to ensure they will be cached. COPY ./requirements . @@ -39,6 +42,9 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ libpq-dev \ # Translations dependencies gettext \ + # pycurl dependencies + libcurl4-openssl-dev \ + libssl-dev \ # cleaning up unused files && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ && rm -rf /var/lib/apt/lists/* @@ -49,7 +55,7 @@ COPY --from=python-build-stage /usr/src/app/wheels /wheels/ # use wheels to install python dependencies RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \ - && rm -rf /wheels/ + && rm -rf /wheels/ COPY ./compose/production/django/entrypoint /entrypoint RUN sed -i 's/\r$//g' /entrypoint From 928ad51c75d46499af016ee69a11c562937d84f6 Mon Sep 17 00:00:00 2001 From: Ashish Acharya Date: Sun, 26 Nov 2023 21:43:42 -0600 Subject: [PATCH 2/3] Remove redis from everywhere --- config/settings/base.py | 2 +- config/settings/production.py | 15 --------------- production.yml | 4 ---- requirements/base.txt | 4 +--- 4 files changed, 2 insertions(+), 23 deletions(-) diff --git a/config/settings/base.py b/config/settings/base.py index a7a62ca0..6913f518 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -259,7 +259,7 @@ # https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-broker_url CELERY_BROKER_URL = env("CELERY_BROKER_URL") # https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-result_backend -CELERY_RESULT_BACKEND = CELERY_BROKER_URL +CELERY_RESULT_BACKEND = None # https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended CELERY_RESULT_EXTENDED = True # https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-backend-always-retry diff --git a/config/settings/production.py b/config/settings/production.py index 3981f5fa..a3730100 100644 --- a/config/settings/production.py +++ b/config/settings/production.py @@ -22,21 +22,6 @@ # ------------------------------------------------------------------------------ DATABASES["default"]["CONN_MAX_AGE"] = env.int("CONN_MAX_AGE", default=60) # noqa F405 -# CACHES -# ------------------------------------------------------------------------------ -CACHES = { - "default": { - "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": env("REDIS_URL"), - "OPTIONS": { - "CLIENT_CLASS": "django_redis.client.DefaultClient", - # Mimicing memcache behavior. - # https://github.com/jazzband/django-redis#memcached-exceptions-behavior - "IGNORE_EXCEPTIONS": True, - }, - } -} - # SECURITY # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#secure-proxy-ssl-header diff --git a/production.yml b/production.yml index f07d6053..11cf7241 100644 --- a/production.yml +++ b/production.yml @@ -15,7 +15,6 @@ services: - ./backups:/app/backups depends_on: - postgres - - redis env_file: - ./.envs/.production/.django - ./.envs/.production/.postgres @@ -46,9 +45,6 @@ services: - "0.0.0.0:443:443" - "0.0.0.0:5555:5555" - redis: - image: redis:6 - celeryworker: <<: *django image: sde_indexing_helper_production_celeryworker diff --git a/requirements/base.txt b/requirements/base.txt index be4e954d..29988b66 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -2,8 +2,6 @@ pytz==2023.3.post1 # https://github.com/stub42/pytz python-slugify==8.0.1 # https://github.com/un33k/python-slugify Pillow==10.1.0 # https://github.com/python-pillow/Pillow argon2-cffi==23.1.0 # https://github.com/hynek/argon2_cffi -redis==4.6.0 # https://github.com/redis/redis-py -hiredis==2.2.3 # https://github.com/redis/hiredis-py celery==5.3.4 # pyup: < 6.0 # https://github.com/celery/celery django-celery-beat==2.5.0 # https://github.com/celery/django-celery-beat flower==2.0.0 # https://github.com/mher/flower @@ -18,13 +16,13 @@ django-model-utils==4.3.1 # https://github.com/jazzband/django-model-utils django-allauth==0.54.0 # https://github.com/pennersr/django-allauth django-crispy-forms==2.0 # https://github.com/django-crispy-forms/django-crispy-forms crispy-bootstrap5==0.7 # https://github.com/django-crispy-forms/crispy-bootstrap5 -django-redis==5.3.0 # https://github.com/jazzband/django-redis # project-specific beautifulsoup4==4.12.2 boto3==1.28.70 djangorestframework-datatables==0.7.0 djangorestframework==3.14.0 +pycurl==7.45.2 PyGithub==1.59.0 python-slugify==8.0.1 scrapy==2.11.0 From da0550a2683fea1651a62854f752db6857aeecab Mon Sep 17 00:00:00 2001 From: Ashish Acharya Date: Sun, 26 Nov 2023 21:45:25 -0600 Subject: [PATCH 3/3] Add redis in local requirements --- requirements/local.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/requirements/local.txt b/requirements/local.txt index f7895314..3153b6b8 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -36,3 +36,9 @@ factory-boy==3.3.0 # https://github.com/FactoryBoy/factory_boy django-debug-toolbar==4.1.0 # https://github.com/jazzband/django-debug-toolbar django-coverage-plugin==3.1.0 # https://github.com/nedbat/django_coverage_plugin pytest-django==4.5.2 # https://github.com/pytest-dev/pytest-django + +# Redis + +redis==4.6.0 # https://github.com/redis/redis-py +hiredis==2.2.3 # https://github.com/redis/hiredis-py +django-redis==5.3.0 # https://github.com/jazzband/django-redis