From 52482413baea49ef3154173712ec9af9f0664ae4 Mon Sep 17 00:00:00 2001 From: "jonathan.kerr" Date: Fri, 26 May 2023 18:45:33 +0100 Subject: [PATCH] Put BROKER_URL in This will enable us to use SQS for our staging and production environments --- .github/workflows/trunk-dev.yml | 1 + .../mentor_match_infra/mentor_match_stack.py | 2 +- mentor_match_web/app/config.py | 7 +++---- mentor_match_web/app/extensions.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/trunk-dev.yml b/.github/workflows/trunk-dev.yml index 67d5c430..2701c1c0 100644 --- a/.github/workflows/trunk-dev.yml +++ b/.github/workflows/trunk-dev.yml @@ -50,6 +50,7 @@ jobs: - get-commit-tag env: ENV: integration + BROKER_URL: redis://localhost:6379/0 GH_IMAGE_COMMIT_TAG: ${{ needs.get-commit-tag.outputs.image_commit_tag }} runs-on: ubuntu-20.04 steps: diff --git a/mentor_match_infra/mentor_match_infra/mentor_match_stack.py b/mentor_match_infra/mentor_match_infra/mentor_match_stack.py index ec3c4cb2..d8a09f8d 100644 --- a/mentor_match_infra/mentor_match_infra/mentor_match_stack.py +++ b/mentor_match_infra/mentor_match_infra/mentor_match_stack.py @@ -48,7 +48,7 @@ def __init__( cluster = ecs.Cluster(self, "MentorMatchCluster", vpc=vpc) - broker_vars = {"broker_url": "sqs://"} + broker_vars = {"BROKER_URL": "sqs://"} web_service = ApplicationLoadBalancedFargateService( self, diff --git a/mentor_match_web/app/config.py b/mentor_match_web/app/config.py index 47779caa..9278d6c8 100644 --- a/mentor_match_web/app/config.py +++ b/mentor_match_web/app/config.py @@ -2,8 +2,8 @@ class Config: - result_backend = os.environ.get("REDIS_URL", "BROKEN") - broker_url = os.environ.get("REDIS_URL", "BROKEN!!") + result_backend = os.environ.get("BROKER_URL", "BROKEN") + broker_url = os.environ.get("BROKER_URL", "BROKEN!!") class TestConfig(Config): @@ -15,5 +15,4 @@ class TestConfig(Config): "interval_step": 0.2, "interval_max": 0.5, } - if os.environ.get("REDIS_URL") is None: - os.environ["REDIS_URL"] = "redis://localhost:6379/0" + broker_url = "redis://localhost:6379/0" diff --git a/mentor_match_web/app/extensions.py b/mentor_match_web/app/extensions.py index 1a88b625..416ddfa8 100644 --- a/mentor_match_web/app/extensions.py +++ b/mentor_match_web/app/extensions.py @@ -4,8 +4,8 @@ celery_app = Celery( "celery_app", - backend=os.environ["REDIS_URL"], - broker=os.environ["REDIS_URL"], + backend=os.environ["BROKER_URL"], + broker=os.environ["BROKER_URL"], include=["app.tasks.tasks"], accept_content=["pickle", "json"], task_serializer="pickle",