Skip to content

Commit ce28460

Browse files
committed
Tweaking the application settings to allow celery and redbeat to use TLS when connecting to Redis/Elasticache.
1 parent 1be76e2 commit ce28460

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

odl_video/settings.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,31 @@
437437

438438
# Celery
439439
# http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
440+
#
441+
# A note of REDIS_URL and CELERY_BROKER_URL formats for connections utilzing TLS
442+
#
443+
# For connections NOT utilzing TLS, setting JUST 'REDIS_URL' should be sufficient.
444+
#
445+
# For connections that DO utilize TLS, we need to make some special accomodations
446+
# for how two different methods of connecting to Redis are used.
447+
#
448+
# REDIS_URL Format (aka 'uppercase constant')
449+
# rediss://<username>:<password>@<redis-hostname>:6379/<DB#>?ssl_cert_reqs=CERT_REQUIRED
450+
#
451+
# CELERY_BROKER_URL Format (aka 'lowercase literal')
452+
# rediss://<username>:<password>@<redis-hostname>:6379/<DB#>?ssl_cert_reqs=required
453+
#
454+
# CACHES.REDIS.LOCATION= lowercase literal
455+
# CELERY_RESULT_BACKEND = uppercase constant
456+
# CELERY_REDBEAT_REDIS_URL = lowercase literal
457+
#
440458
REDIS_URL = get_string("REDIS_URL", None)
441459
REDIS_MAX_CONNECTIONS = get_int("REDIS_MAX_CONNECTIONS", 65000)
442460
USE_CELERY = True
443461
CELERY_BROKER_URL = get_string("CELERY_BROKER_URL", REDIS_URL)
444462
CELERY_RESULT_BACKEND = REDIS_URL
445463
CELERY_BEAT_SCHEDULER = RedBeatScheduler
446-
CELERY_REDBEAT_REDIS_URL = REDIS_URL
464+
CELERY_REDBEAT_REDIS_URL = CELERY_BROKER_URL
447465

448466
CELERY_TASK_ALWAYS_EAGER = get_bool("CELERY_TASK_ALWAYS_EAGER", False)
449467
CELERY_TASK_EAGER_PROPAGATES = get_bool("CELERY_TASK_EAGER_PROPAGATES", True)
@@ -480,7 +498,7 @@
480498
},
481499
"redis": {
482500
"BACKEND": "django_redis.cache.RedisCache",
483-
"LOCATION": REDIS_URL,
501+
"LOCATION": CELERY_BROKER_URL,
484502
"OPTIONS": {
485503
"CLIENT_CLASS": "django_redis.client.DefaultClient",
486504
"CONNECTION_POOL_KWARGS": {"max_connections": REDIS_MAX_CONNECTIONS},

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ celery==4.3.0
3737
# via
3838
# -r requirements.in
3939
# celery-redbeat
40-
celery-redbeat==0.13.0
40+
celery-redbeat==2.0.0
4141
# via -r requirements.in
4242
certifi==2020.4.5.1
4343
# via

0 commit comments

Comments
 (0)