services:
  litellm-db:
    image: postgres:16-alpine
    container_name: litellm-db
    environment:
      - POSTGRES_DB=litellm
      - POSTGRES_USER=litellm
      - POSTGRES_PASSWORD=litellm
    volumes:
      - /mnt/ssd/dbs/litellm/postgres:/var/lib/postgresql/data
    restart: always

  litellm:
    image: ghcr.io/berriai/litellm:main-latest
    container_name: litellm
    ports:
      - "4000:4000"
    volumes:
      - ./litellm-config.yaml:/app/config.yaml
    environment:
      - DATABASE_URL=postgresql://litellm:litellm@litellm-db:5432/litellm
      - LITELLM_MASTER_KEY=sk-fjQC1BxAiGFSMs
      - LANGFUSE_PUBLIC_KEY=${LANGFUSE_PUBLIC_KEY:-changeme}
      - LANGFUSE_SECRET_KEY=${LANGFUSE_SECRET_KEY:-changeme}
      - LANGFUSE_HOST=http://langfuse:3000
      - OPENROUTER_API_KEY=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
    command: ["--config", "/app/config.yaml", "--port", "4000"]
    extra_hosts:
      - "host.docker.internal:host-gateway"
    depends_on:
      - litellm-db
      - langfuse
    restart: always

  kimi-agent:
    build: ./kimi-agent
    container_name: kimi-agent
    volumes:
      - /home/alvis/kimi-workspace:/workspace
      - kimi-agent-home:/root/.kimi-code
    restart: unless-stopped

  langfuse-db:
    image: postgres:16-alpine
    container_name: langfuse-db
    environment:
      - POSTGRES_DB=langfuse
      - POSTGRES_USER=langfuse
      - POSTGRES_PASSWORD=langfuse
    volumes:
      - /mnt/ssd/dbs/langfuse/postgres:/var/lib/postgresql/data
    restart: always

  langfuse:
    image: ghcr.io/langfuse/langfuse:2
    container_name: langfuse
    ports:
      - "3200:3000"
    environment:
      - DATABASE_URL=postgresql://langfuse:langfuse@langfuse-db:5432/langfuse
      - NEXTAUTH_URL=https://lf.alogins.net
      - NEXTAUTH_SECRET=532a746b24ac40afa39f9d317031cab94d4d6881107ea3b1209b28020f1a9761
      - SALT=7927b3b0092afe4542274940b557becea6418a5fed79f7acd25c3a789349fdc9
      - AUTH_DISABLE_SIGNUP=true
    depends_on:
      - langfuse-db
    restart: always

  qdrant:
    image: qdrant/qdrant
    container_name: qdrant
    ports:
      - "6333:6333"
      - "6334:6334"
    restart: always
    volumes:
      - /mnt/ssd/dbs/qdrant:/qdrant/storage:z

  faster-whisper:
    image: fedirz/faster-whisper-server:latest-cuda
    container_name: faster-whisper
    runtime: nvidia
    ports:
      - "8880:8000"
    environment:
      - WHISPER__MODEL=deepdml/faster-whisper-large-v3-turbo-ct2
      - WHISPER__INFERENCE_DEVICE=cuda
      - WHISPER__COMPUTE_TYPE=int8
      - WHISPER__LANGUAGE=ru
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=compute,utility
    volumes:
      - /mnt/ssd/ai/faster-whisper:/root/.cache/huggingface
    restart: always

  silero-tts:
    build: ./silero-tts
    container_name: silero-tts
    ports:
      - "8881:8881"
    volumes:
      - /mnt/ssd/ai/silero-tts:/cache/torch
    restart: always

  pipecat:
    build: ./pipecat
    container_name: pipecat
    ports:
      - "8882:8882"
    environment:
      - LIVEKIT_URL=ws://host.docker.internal:7880
      - LIVEKIT_PUBLIC_URL=wss://lk.alogins.net
      - LIVEKIT_API_KEY=devkey
      - LIVEKIT_SECRET=ef3ef4b903ca8469b09b2dd7ab6af529c4d2f3c95668f53832fc351cf67777a9
      - ADOLF_URL=http://host.docker.internal:8000/v1
      - STT_URL=http://host.docker.internal:8880/v1
      - TTS_URL=http://host.docker.internal:8881/v1
      - STT_MODEL=deepdml/faster-whisper-large-v3-turbo-ct2
      - TTS_VOICE=onyx
    extra_hosts:
      - "host.docker.internal:host-gateway"
    restart: unless-stopped

volumes:
  kimi-agent-home:
