# CloudSearch — single source of truth: ./VERSION
# 注意: 此 compose 用于参考/文档。实际部署使用 docker run 以兼容 1Panel Redis。

networks:
  cloudsearch-network:
    driver: bridge

volumes:
  admin-data:
  app-data:
    external: true
    name: cloudsearch_app-data
  pansou-data:

x-logging: &default-logging
  driver: json-file
  options:
    max-size: "50m"
    max-file: "10"

services:
  pansou:
    container_name: CloudSearch_PanSou
    image: ghcr.io/fish2018/pansou-web:latest
    networks:
      cloudsearch-network:
        aliases:
          - pansou
    environment:
      - DOMAIN=${DOMAIN:-localhost}
      - CACHE_TTL=60
    volumes:
      - pansou-data:/app/data
    restart: always
    logging: *default-logging

  app:
    container_name: CloudSearch_App
    image: cloudsearch-app:latest
    ports:
      - "9527:9527"
    environment:
      - NODE_ENV=production
      - CORS_ORIGIN=http://jp-cs.timaa.cn
      - JWT_SECRET=u-_1wB...JeIg
      - ADMIN_PASSWORD=0nL5kL...b25A
      - PANSOU_URL=http://pansou:80
      - DB_PATH=/data/database.sqlite
      - REDIS_URL=redis://:redis_GbR7XZ@1Panel-redis-aDp3:6379
      - CLOUDSEARCH_API=http://localhost:9527
      - TRANSFER_CONFIG_PATH=/data/transfer_config.json
      - TZ=Asia/Shanghai
      - APP_VERSION_FILE=/data/VERSION
    volumes:
      - cloudsearch_app-data:/data
      - ./uploads:/app/uploads
      - ./VERSION:/app/VERSION
      - ./icons:/app/dist/frontend/admin/icons
    depends_on:
      - pansou
    restart: always
    networks:
      - cloudsearch-network
    logging: *default-logging

  admin:
    container_name: CloudSearch_Admin
    image: cloudsearch-admin:v0.1.0
    ports:
      - "127.0.0.1:9531:9531"
    environment:
      - ADMIN_PORT=9531
      - ADMIN_PASSWORD=0nL5kL...b25A
      - ADMIN_DB_PATH=/data/admin_flags.sqlite
    volumes:
      - admin-data:/data
    restart: always
    networks:
      - cloudsearch-network
    logging: *default-logging
