From 6bdb99729b071b7d501ae8cc69f17c66c07956b0 Mon Sep 17 00:00:00 2001 From: "alexander.pace@ligo.org" <alexander.pace@ligo.org> Date: Fri, 17 Jan 2020 13:16:17 -0600 Subject: [PATCH] Turning off django-elasticache According to the docs, it seems like this is helpful in the case that you have a cluster of elasticache nodes, but i'm only using one. So I *think* that specifying the rules right should have the nodes talk to the correct server and it should just work with memcached --- .gitlab-ci.yml | 2 +- config/settings/container/base.py | 25 +++++++++++++++++++------ requirements.txt | 2 +- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 95b03f054..5a20caf47 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,7 +34,7 @@ before_script: DJANGO_SETTINGS_MODULE: "config.settings.container.dev" DJANGO_TWILIO_ACCOUNT_SID: "fake_sid" DJANGO_TWILIO_AUTH_TOKEN: "fake_token" - DJANGO_AWS_ELASTICACHE_ADDR: "local_host:80" + DJANGO_AWS_ELASTICACHE_ADDR: "fake_server:80" LVALERT_OVERSEER_PORT: "2" LVALERT_SERVER: "fake_server" LVALERT_USER: "fake_user" diff --git a/config/settings/container/base.py b/config/settings/container/base.py index f6245b9cb..a23bed465 100644 --- a/config/settings/container/base.py +++ b/config/settings/container/base.py @@ -86,13 +86,26 @@ ALERT_EMAIL_FROM = get_from_env('DJANGO_ALERT_EMAIL_FROM') # AWS Elasticache settings: AWS_ELASTICACHE_ADDR = get_from_env('DJANGO_AWS_ELASTICACHE_ADDR') -CACHES['default'] = { - 'BACKEND': 'django_elasticache.memcached.ElastiCache', +#CACHES['default'] = { +# 'BACKEND': 'django_elasticache.memcached.ElastiCache', +# 'LOCATION': AWS_ELASTICACHE_ADDR, +# 'OPTIONS': { +# 'IGNORE_CLUSTER_ERRORS': True, +# }, +# } + +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': AWS_ELASTICACHE_ADDR, - 'OPTIONS': { - 'IGNORE_CLUSTER_ERRORS': True, - }, - } + }, + # For API throttles + 'throttles': { + 'BACKEND': 'django.core.cache.backends.db.DatabaseCache', + 'LOCATION': 'api_throttle_cache', # Table name + }, +} + MIDDLEWARE = [ 'core.middleware.maintenance.MaintenanceModeMiddleware', 'events.middleware.PerformanceMiddleware', diff --git a/requirements.txt b/requirements.txt index 7e3117bdf..82001af7d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -32,7 +32,7 @@ phonenumbers==8.8.11 python-ldap==3.1.0 python-memcached==1.59 # Install django-elasticache along with python memcached: -git+git://github.com/gusdan/django-elasticache.git#egg=django-elasticache +#git+git://github.com/gusdan/django-elasticache.git#egg=django-elasticache scipy==1.2.1 sentry-sdk==0.7.10 service_identity==17.0.0 -- GitLab