From e72087608b6413b52cae9e79e02501c74f726944 Mon Sep 17 00:00:00 2001 From: roai_linux Date: Wed, 11 Mar 2026 17:28:51 +0330 Subject: [PATCH] feat: change livekit config in docker-compose.yml --- Back/README.md | 10 ++++++---- Back/db/redis.py | 6 +++--- Back/docker-compose.yml | 15 +++++++++------ Back/livekit.yaml | 7 ------- Back/livekit.yaml.template | 7 ------- Back/main.py | 7 +++++-- Back/requirements.txt | 1 + 7 files changed, 24 insertions(+), 29 deletions(-) delete mode 100644 Back/livekit.yaml delete mode 100644 Back/livekit.yaml.template diff --git a/Back/README.md b/Back/README.md index f338d37..69ddb4d 100644 --- a/Back/README.md +++ b/Back/README.md @@ -70,9 +70,11 @@ LIVEKIT_UDP_PORT=7882 ``` LiveKit note: -- `livekit.yaml.template` is a template, not a direct runtime config. -- The `livekit` container generates `/etc/livekit.yaml` from env values at startup. -- Raw YAML does not automatically resolve `${...}` placeholders unless templated first. +- This project runs LiveKit v1.9.12 in Docker. +- `--api-key/--api-secret` are not used; the server receives credentials via `LIVEKIT_KEYS`. +- `livekit.yaml` is kept as a reference file and is not mounted/used at runtime in `docker-compose.yml`. +- Docker-internal API host must be `http://livekit:7880`. +- For local API execution (outside Docker), use a separate env value such as `LIVEKIT_HOST=http://localhost:7780`. ## Run With Docker @@ -83,7 +85,7 @@ docker compose up --build -d Services: - API: `http://localhost:8000` - Swagger Docs: `http://localhost:8000/docs` -- LiveKit: `http://localhost:7880` +- LiveKit: `http://localhost:7780` - Postgres: `localhost:5432` - Redis: `localhost:6379` diff --git a/Back/db/redis.py b/Back/db/redis.py index 9f98ef8..0d32559 100755 --- a/Back/db/redis.py +++ b/Back/db/redis.py @@ -82,18 +82,18 @@ async def release_speaker(group_id: str, user_id: str) -> bool: # ========================= async def add_presence(group_id: str, user_id: str) -> None: - await redis_client.sadd(presence_key(group_id), user_id) + await redis_client.sadd(presence_key(group_id), user_id) # type:ignore async def remove_presence(group_id: str, user_id: str) -> None: - await redis_client.srem(presence_key(group_id), user_id) + await redis_client.srem(presence_key(group_id), user_id) # type:ignore async def get_presence(group_id: str) -> list[str]: members = await redis_client.smembers( presence_key(group_id) - ) + ) # type:ignore return list(members) diff --git a/Back/docker-compose.yml b/Back/docker-compose.yml index 2111053..94a31f8 100755 --- a/Back/docker-compose.yml +++ b/Back/docker-compose.yml @@ -51,13 +51,16 @@ services: livekit: image: livekit/livekit-server container_name: neda_livekit - command: --config /etc/livekit.yaml - volumes: - - ./livekit.yaml:/etc/livekit.yaml ports: - - "7880:7880" - - "7881:7881" - - "7882:7882/udp" + - "7780:7880" + - "7781:7881" + - "7782:7882/udp" + env_file: + - .env + environment: + LIVEKIT_KEYS: "${LIVEKIT_API_KEY}: ${LIVEKIT_API_SECRET}" + command: > + --dev=false restart: always volumes: diff --git a/Back/livekit.yaml b/Back/livekit.yaml deleted file mode 100644 index 411a7de..0000000 --- a/Back/livekit.yaml +++ /dev/null @@ -1,7 +0,0 @@ -port: 7880 -rtc: - udp_port: 7882 - tcp_port: 7881 - -keys: - neda_key: neda_secret diff --git a/Back/livekit.yaml.template b/Back/livekit.yaml.template deleted file mode 100644 index 72efebb..0000000 --- a/Back/livekit.yaml.template +++ /dev/null @@ -1,7 +0,0 @@ -port: ${LIVEKIT_PORT} -rtc: - udp_port: ${LIVEKIT_UDP_PORT} - tcp_port: ${LIVEKIT_TCP_PORT} - -keys: - ${LIVEKIT_API_KEY}: ${LIVEKIT_API_SECRET} diff --git a/Back/main.py b/Back/main.py index f2f717e..8d057ea 100644 --- a/Back/main.py +++ b/Back/main.py @@ -11,6 +11,7 @@ from domains.realtime.ws import router as realtime_router from domains.notifications.api import router as notifications_router from db.redis import redis_client +from fastapi_swagger import patch_fastapi @asynccontextmanager @@ -34,9 +35,11 @@ app = FastAPI( title="NEDA API", description="Realtime Voice Communication Backend", version="1.0.0", - lifespan=lifespan + lifespan=lifespan, + docs_url=None, + swagger_ui_oauth2_redirect_url=None ) - +patch_fastapi(app,docs_url="/swagger") # ------------------------- # CORS diff --git a/Back/requirements.txt b/Back/requirements.txt index 72af1e5..00f0454 100755 --- a/Back/requirements.txt +++ b/Back/requirements.txt @@ -1,5 +1,6 @@ fastapi uvicorn[standard] +fastapi-swagger sqlalchemy asyncpg