Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from redis to sqs as a celery broker #528

Merged
merged 3 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions compose/local/django/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down Expand Up @@ -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/*
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 0 additions & 15 deletions config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ services:
- ./backups:/app/backups
depends_on:
- postgres
- redis
env_file:
- ./.envs/.production/.django
- ./.envs/.production/.postgres
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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