# docker-compose.dev.db.yml (开发环境 - 仅运行数据库基础设施)
# 所有容器名以 cyrene_ 开头，通过 SSH 隧道访问
version: '3.8'

services:
  # ========== PostgreSQL + pgvector ==========
  postgres:
    image: pgvector/pgvector:pg16
    container_name: cyrene_postgres
    environment:
      POSTGRES_USER: cyrene
      POSTGRES_PASSWORD: cyrene_pass
      POSTGRES_DB: cyrene_ai
    ports:
      - "5432:5432"
    volumes:
      - pg_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U cyrene -d cyrene_ai"]
      interval: 10s
      timeout: 3s
      retries: 5

  # ========== Redis ==========
  redis:
    image: redis:7-alpine
    container_name: cyrene_redis
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 3s
      retries: 5

  # ========== Qdrant 向量数据库 ==========
  qdrant:
    image: qdrant/qdrant:latest
    container_name: cyrene_qdrant
    ports:
      - "6333:6333"
      - "6334:6334"
    volumes:
      - qdrant_data:/qdrant/storage

  # ========== MinIO 对象存储 ==========
  minio:
    image: minio/minio:latest
    container_name: cyrene_minio
    command: server /data --console-address ":9001"
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin
    ports:
      - "9000:9000"
      - "9001:9001"
    volumes:
      - minio_data:/data

  # ========== NATS 消息队列 ==========
  nats:
    image: nats:2-alpine
    container_name: cyrene_nats
    ports:
      - "4222:4222"
      - "8222:8222"

  # ========== SearXNG 搜索引擎 ==========
  searxng:
    image: searxng/searxng:latest
    container_name: cyrene_searxng
    volumes:
      - ./searxng/settings.yml:/etc/searxng/settings.yml:ro
    environment:
      SEARXNG_SETTINGS_PATH: /etc/searxng/settings.yml
    ports:
      - "8088:8080"
    restart: unless-stopped

volumes:
  pg_data:
  redis_data:
  qdrant_data:
  minio_data:
