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 a6cd7dc
Show file tree
Hide file tree
Showing 4 changed files with 13 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 `redis://keydb:6379`

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

Expand Down
16 changes: 8 additions & 8 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ services:
build: .
command: uvicorn src.api:app --reload --host 0.0.0.0 --port 8000
environment:
- REDIS_URL=redis://redis:6379
- KEYDB_URL=redis://keydb: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
- "6379:6379"

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

- keydb
3 changes: 1 addition & 2 deletions 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
celery[redis]~=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", "redis://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 a6cd7dc

Please sign in to comment.