feat: change livekit config in docker-compose.yml

This commit is contained in:
roai_linux 2026-03-11 17:28:51 +03:30
parent 2bb1c5843b
commit e72087608b
7 changed files with 24 additions and 29 deletions

View File

@ -70,9 +70,11 @@ LIVEKIT_UDP_PORT=7882
``` ```
LiveKit note: LiveKit note:
- `livekit.yaml.template` is a template, not a direct runtime config. - This project runs LiveKit v1.9.12 in Docker.
- The `livekit` container generates `/etc/livekit.yaml` from env values at startup. - `--api-key/--api-secret` are not used; the server receives credentials via `LIVEKIT_KEYS`.
- Raw YAML does not automatically resolve `${...}` placeholders unless templated first. - `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 ## Run With Docker
@ -83,7 +85,7 @@ docker compose up --build -d
Services: Services:
- API: `http://localhost:8000` - API: `http://localhost:8000`
- Swagger Docs: `http://localhost:8000/docs` - Swagger Docs: `http://localhost:8000/docs`
- LiveKit: `http://localhost:7880` - LiveKit: `http://localhost:7780`
- Postgres: `localhost:5432` - Postgres: `localhost:5432`
- Redis: `localhost:6379` - Redis: `localhost:6379`

View File

@ -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: 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: 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]: async def get_presence(group_id: str) -> list[str]:
members = await redis_client.smembers( members = await redis_client.smembers(
presence_key(group_id) presence_key(group_id)
) ) # type:ignore
return list(members) return list(members)

View File

@ -51,13 +51,16 @@ services:
livekit: livekit:
image: livekit/livekit-server image: livekit/livekit-server
container_name: neda_livekit container_name: neda_livekit
command: --config /etc/livekit.yaml
volumes:
- ./livekit.yaml:/etc/livekit.yaml
ports: ports:
- "7880:7880" - "7780:7880"
- "7881:7881" - "7781:7881"
- "7882:7882/udp" - "7782:7882/udp"
env_file:
- .env
environment:
LIVEKIT_KEYS: "${LIVEKIT_API_KEY}: ${LIVEKIT_API_SECRET}"
command: >
--dev=false
restart: always restart: always
volumes: volumes:

View File

@ -1,7 +0,0 @@
port: 7880
rtc:
udp_port: 7882
tcp_port: 7881
keys:
neda_key: neda_secret

View File

@ -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}

View File

@ -11,6 +11,7 @@ from domains.realtime.ws import router as realtime_router
from domains.notifications.api import router as notifications_router from domains.notifications.api import router as notifications_router
from db.redis import redis_client from db.redis import redis_client
from fastapi_swagger import patch_fastapi
@asynccontextmanager @asynccontextmanager
@ -34,9 +35,11 @@ app = FastAPI(
title="NEDA API", title="NEDA API",
description="Realtime Voice Communication Backend", description="Realtime Voice Communication Backend",
version="1.0.0", version="1.0.0",
lifespan=lifespan lifespan=lifespan,
docs_url=None,
swagger_ui_oauth2_redirect_url=None
) )
patch_fastapi(app,docs_url="/swagger")
# ------------------------- # -------------------------
# CORS # CORS

View File

@ -1,5 +1,6 @@
fastapi fastapi
uvicorn[standard] uvicorn[standard]
fastapi-swagger
sqlalchemy sqlalchemy
asyncpg asyncpg