Skip to content

Commit

Permalink
merge(#28862): feat: adds CELERY_BROKER_TRANSPORT_OPTIONS
Browse files Browse the repository at this point in the history
## Description

Cherry-pick of https://github.com/edx/edx-platform/pull/28849

The release of Redis 6 introduced the ability to share this service among multiple accounts, securing the access to specific keys using a username/password and ACLs. Celery uses kombu to provide Redis brokering for the message queues, but kombu was missing a couple of key enhancements to support multi-tenant redis.

This PR allows to configure the broker transport options to enjoy the benefits of the above-mentioned updates.

## Supporting information

OpenCraft wants to use multi-tenant Redis for their shared hosting service, so we can stop maintaining RabbitMQ.

## Deadline

None

## Other information

The initial PR that partially contained these changes: https://github.com/edx/edx-platform/pull/28020

## Reviewers

- [ ] @pomegranited 
- [ ] @Agrendalath
  • Loading branch information
edx-community-bot committed Oct 13, 2021
2 parents a2e998f + 394f7e4 commit 77cbbe4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions cms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,14 @@ def get_env_setting(setting):
CELERY_BROKER_VHOST)
BROKER_USE_SSL = ENV_TOKENS.get('CELERY_BROKER_USE_SSL', False)

BROKER_TRANSPORT_OPTIONS = {
'fanout_patterns': True,
'fanout_prefix': True,
}
try:
BROKER_TRANSPORT_OPTIONS = {
'fanout_patterns': True,
'fanout_prefix': True,
**ENV_TOKENS.get('CELERY_BROKER_TRANSPORT_OPTIONS', {})
}
except TypeError as exc:
raise ImproperlyConfigured('CELERY_BROKER_TRANSPORT_OPTIONS must be a dict') from exc

# Message expiry time in seconds
CELERY_EVENT_QUEUE_TTL = ENV_TOKENS.get('CELERY_EVENT_QUEUE_TTL', None)
Expand Down
12 changes: 8 additions & 4 deletions lms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,14 @@ def get_env_setting(setting):
CELERY_BROKER_VHOST)
BROKER_USE_SSL = ENV_TOKENS.get('CELERY_BROKER_USE_SSL', False)

BROKER_TRANSPORT_OPTIONS = {
'fanout_patterns': True,
'fanout_prefix': True,
}
try:
BROKER_TRANSPORT_OPTIONS = {
'fanout_patterns': True,
'fanout_prefix': True,
**ENV_TOKENS.get('CELERY_BROKER_TRANSPORT_OPTIONS', {})
}
except TypeError as exc:
raise ImproperlyConfigured('CELERY_BROKER_TRANSPORT_OPTIONS must be a dict') from exc

# Block Structures

Expand Down

0 comments on commit 77cbbe4

Please sign in to comment.