From 0095668e2e8a029fb977305f3c1e2df642a4dd3b Mon Sep 17 00:00:00 2001 From: Martin Hoyer Date: Wed, 14 Aug 2024 17:29:12 +0200 Subject: [PATCH] Trying to use keydb instead of redis --- README.md | 2 +- compose.yaml | 14 +++++++------- src/requirements.txt | 3 +-- src/service.py | 4 ++-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6f98fb3..10ef042 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ docker-compose up --build ## Tests To run the tests, use the `pytest` command ## Environment variables -`REDIS_URL` - optional, passed to Celery on initialization as a `broker` and `backend` argument, +`KEYDB_URL` - optional, passed to Celery on initialization as a `broker` and `backend` argument, default value is `redis://localhost:6379` `CLONE_DIR_PATH` - optional, specifies the path where the repositories will be cloned, default value is `./.repos/` diff --git a/compose.yaml b/compose.yaml index 6d56d10..033eb6a 100644 --- a/compose.yaml +++ b/compose.yaml @@ -3,15 +3,16 @@ services: build: . command: uvicorn src.api:app --reload --host 0.0.0.0 --port 8000 environment: - - REDIS_URL=redis://redis:6379 + - KEYDB_URL=redis://localhost:6379 - API_HOSTNAME=http://localhost:8000 ports: - 8000:8000 depends_on: - - redis + - keydb - redis: - image: redis:latest + keydb: + image: eqalpha/keydb:latest + hostname: keydb ports: - 6379:6379 @@ -19,8 +20,7 @@ services: build: . command: celery --app=src.api.service worker --loglevel=INFO environment: - - REDIS_URL=redis://redis:6379 + - KEYDB_URL=redis://localhost:6379 - API_HOSTNAME=http://localhost:8000 depends_on: - - redis - + - keydb diff --git a/src/requirements.txt b/src/requirements.txt index 212e33a..0fcbe68 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -3,6 +3,5 @@ pytest~=8.3 tmt~=1.35 fastapi~=0.112 httpx~=0.27 -redis~=5.0 uvicorn~=0.30 -celery~=5.4 +celery[redis]~=5.4 diff --git a/src/service.py b/src/service.py index aebbea7..876c393 100644 --- a/src/service.py +++ b/src/service.py @@ -11,9 +11,9 @@ logger = tmt.Logger(logging.getLogger("tmt-logger")) -redis_url = os.getenv("REDIS_URL", "redis://localhost:6379") +keydb_url = os.getenv("KEYDB_URL", "redis://localhost:6379") -app = Celery(__name__, broker=redis_url, backend=redis_url) +app = Celery(__name__, broker=keydb_url, backend=keydb_url) def get_tree(url: str, name: str, ref: str, tree_path: str) -> tmt.base.Tree: