Skip to content

Commit

Permalink
Trying to use keydb instead of redis
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhoyer committed Aug 14, 2024
1 parent 67eed75 commit 9bdd574
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ 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,
default value is `redis://localhost:6379`
`KEYDB_URL` - optional, passed to Celery on initialization as a `broker` and `backend` argument,
default value is `keydb://keydb:6379`

`CLONE_DIR_PATH` - optional, specifies the path where the repositories will be cloned, default value is `./.repos/`

Expand Down
16 changes: 7 additions & 9 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@ services:
build: .
command: uvicorn src.api:app --reload --host 0.0.0.0 --port 8000
environment:
- REDIS_URL=redis://redis:6379
- KEYDB_URL=keydb://keydb:6379
- API_HOSTNAME=http://localhost:8000
ports:
- 8000:8000
depends_on:
- redis
- keydb

redis:
image: redis:latest
ports:
- 6379:6379
keydb:
image: eqalpha/keydb:latest
hostname: keydb

celery:
build: .
command: celery --app=src.api.service worker --loglevel=INFO
environment:
- REDIS_URL=redis://redis:6379
- KEYDB_URL=keydb://keydb:6379
- API_HOSTNAME=http://localhost:8000
depends_on:
- redis

- keydb
1 change: 0 additions & 1 deletion src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "keydb://keydb: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:
Expand Down

0 comments on commit 9bdd574

Please sign in to comment.