services:
  nginx:
    container_name: turing-nginx
    restart: always
    image: chaitin-registry.cn-hangzhou.cr.aliyuncs.com/web2gpt/turing-nginx:v1.6.3
    ports:
      - ${ADMIN_PORT}:8080
    networks:
      turing:
        ipv4_address: 169.254.14.111
  api:
    container_name: turing-api
    depends_on:
      - postgres
      - nats
    restart: always
    image: chaitin-registry.cn-hangzhou.cr.aliyuncs.com/web2gpt/turing-api:v1.6.3
    environment:
      - NATS_PASSWORD=${NATS_PASSWORD}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - REDIS_PASSWORD=${REDIS_PASSWORD}
      - S3_SECRET_KEY=${S3_SECRET_KEY}
      - JWT_SECRET=${JWT_SECRET}
      - QDRANT_API_KEY=${QDRANT_API_KEY}
      - ADMIN_PASSWORD=${ADMIN_PASSWORD}
      - ORIGIN=${ORIGIN}
    networks:
      turing:
        ipv4_address: 169.254.14.2
  consumer:
    container_name: turing-consumer
    depends_on:
      - nats
      - api
    restart: always
    image: chaitin-registry.cn-hangzhou.cr.aliyuncs.com/web2gpt/turing-consumer:v1.6.0
    environment:
      - NATS_PASSWORD=${NATS_PASSWORD}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - REDIS_PASSWORD=${REDIS_PASSWORD}
      - S3_SECRET_KEY=${S3_SECRET_KEY}
      - JWT_SECRET=${JWT_SECRET}
      - QDRANT_API_KEY=${QDRANT_API_KEY}
    networks:
      turing:
        ipv4_address: 169.254.14.3
  postgres:
    container_name: turing-postgres
    image: chaitin-registry.cn-hangzhou.cr.aliyuncs.com/web2gpt/turing-postgres:16
    restart: always
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "turing", "-d", "turing"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 10s
    environment:
      - POSTGRES_USER=turing
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=turing
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
    networks:
      turing:
        ipv4_address: 169.254.14.10
  redis:
    image: chaitin-registry.cn-hangzhou.cr.aliyuncs.com/web2gpt/turing-redis:7.4.2-alpine
    container_name: turing-redis
    restart: always
    command: ["redis-server", "--requirepass", "${REDIS_PASSWORD}", "--appendonly", "yes", "--appendfilename", "appendonly.aof", "--save", "900 1", "--save", "300 10", "--save", "60 10000"]
    volumes:
      - ./data/redis:/data
    networks:
      turing:
        ipv4_address: 169.254.14.11
  minio:
    image: chaitin-registry.cn-hangzhou.cr.aliyuncs.com/web2gpt/turing-minio:RELEASE.2025-03-12T18-04-18Z
    container_name: turing-minio
    restart: always
    command: ["minio", "server", "/data", "--console-address", ":9001"]
    volumes:
      - ./data/minio:/data
    environment:
      - MINIO_ACCESS_KEY=s3turing
      - MINIO_SECRET_KEY=${S3_SECRET_KEY}
    networks:
      turing:
        ipv4_address: 169.254.14.12
  nats:
    image: chaitin-registry.cn-hangzhou.cr.aliyuncs.com/web2gpt/turing-nats:2.10.11-alpine
    container_name: turing-nats
    restart: always
    command: ["nats-server", "-js", "--user", "turing", "--pass", "${NATS_PASSWORD}", "-sd", "/data"]
    volumes:
      - ./data/nats:/data
    environment:
      - NATS_STORE_DIR=/data
    networks:
      turing:
        ipv4_address: 169.254.14.13
  vector-db:
    image: chaitin-registry.cn-hangzhou.cr.aliyuncs.com/web2gpt/turing-qdrant:v1.13.6
    container_name: turing-vector-db
    restart: always
    volumes:
      - ./data/qdrant:/qdrant/storage
    environment:
      - QDRANT__SERVICE__API_KEY=${QDRANT_API_KEY}
    networks:
      turing:
        ipv4_address: 169.254.14.15
  crawler:
    image: chaitin-registry.cn-hangzhou.cr.aliyuncs.com/web2gpt/turing-crawler:v0.2.1
    container_name: turing-crawler
    restart: always
    init: true
    environment:
      - NATS_PASSWORD=${NATS_PASSWORD}
    networks:
      turing:
        ipv4_address: 169.254.14.17

networks:
  turing:
    ipam:
      driver: default
      config:
        - subnet: "169.254.14.0/24"
