From 334e06c437f2866c4744f3d62677a8412811284a Mon Sep 17 00:00:00 2001 From: kyomi Date: Tue, 28 Nov 2023 22:21:36 -0300 Subject: [PATCH] build(docker): change the broker URL environment variable in the application --- docker/django/entrypoint.sh | 2 +- server/celery.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docker/django/entrypoint.sh b/docker/django/entrypoint.sh index f2d8351..9376512 100755 --- a/docker/django/entrypoint.sh +++ b/docker/django/entrypoint.sh @@ -12,7 +12,7 @@ export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES : "${RABBITMQ_HOST:=rabbitmq}" : "${RABBITMQ_PORT:=5672}" -export CELERY_BROKER_URL="amqp://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@${RABBITMQ_HOST}:${RABBITMQ_PORT}/${RABBITMQ_VHOST}" +export CLOUDAMQP_URL="amqp://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@${RABBITMQ_HOST}:${RABBITMQ_PORT}/${RABBITMQ_VHOST}" # We need this line to make sure that this container is started after the one # with PostgreSQL: diff --git a/server/celery.py b/server/celery.py index dc4c066..1650f7e 100644 --- a/server/celery.py +++ b/server/celery.py @@ -3,9 +3,14 @@ from celery import Celery from celery.app.task import Task +from server.settings import env + environ.setdefault("DJANGO_SETTINGS_MODULE", "server.settings.development") -app = Celery("virtualjudge", broker_connection_retry_on_startup=False) +broker = env("CLOUDAMQP_URL", default="") +app = Celery( + "virtualjudge", broker=broker, broker_connection_retry_on_startup=False +) app.config_from_object("django.conf:settings", namespace="CELERY") app.autodiscover_tasks()