Skip to content

Commit

Permalink
no cloudamqp (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 authored Feb 15, 2025
1 parent 56741ff commit e8d2918
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
3 changes: 1 addition & 2 deletions backend/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,7 @@
if ALGOLIA["API_KEY"]:
INSTALLED_APPS += ["algoliasearch_django"]

# CELERY_BROKER_URL = env('REDIS_URL', default='redis://localhost/')
CELERY_BROKER_URL = env("CLOUDAMQP_URL", default="amqp://localhost")
CELERY_BROKER_URL = env("REDIS_URL", default="redis://localhost/")
CELERY_RESULT_BACKEND = env("REDIS_URL", default="redis://localhost/")


Expand Down
6 changes: 2 additions & 4 deletions backend/config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@
REDIS_URL = env("REDIS_URL", default="redis://127.0.0.1:6379")
REDIS_LOCATION = f"{REDIS_URL}/{0}"


# Heroku URL does not pass the DB number, so we parse it in
CACHES = {
"default": {
Expand All @@ -191,9 +190,8 @@
}

# Update Celery settings to handle SSL
if REDIS_URL.startswith("rediss://"):
CELERY_BROKER_USE_SSL = {"ssl_cert_reqs": None}
CELERY_REDIS_BACKEND_USE_SSL = {"ssl_cert_reqs": None}
CELERY_BROKER_TRANSPORT_OPTIONS = {"ssl": {"ssl_cert_reqs": ssl.CERT_NONE}}
CELERY_RESULT_BACKEND_TRANSPORT_OPTIONS = {"ssl_cert_reqs": ssl.CERT_NONE}

# Sentry Configuration

Expand Down
10 changes: 2 additions & 8 deletions backend/fpbase/celery.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import os

from celery import Celery
from django.conf import settings

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
if "DJANGO_SETTINGS_MODULE" not in os.environ:
os.environ["DJANGO_SETTINGS_MODULE"] = "config.settings.local"

app = Celery("fpbase", namespace="CELERY")
app.config_from_object("django.conf:settings", namespace="CELERY")

# Configure SSL settings for Redis if using secure connection
if settings.CELERY_RESULT_BACKEND.startswith("rediss://"):
app.conf.update(
redis_backend_use_ssl=settings.CELERY_REDIS_BACKEND_USE_SSL, broker_use_ssl=settings.CELERY_BROKER_USE_SSL
)

# Load task modules from all registered Django app configs.
app.autodiscover_tasks()

0 comments on commit e8d2918

Please sign in to comment.