version: '3.8'

# 开发环境配置覆盖
services:
  qaup-postgres:
    # 开发环境暴露数据库端口便于调试
    ports:
      - "5432:5432"
    # 开发环境资源配置较低
    deploy:
      resources:
        limits:
          memory: 512M
          cpus: '1.0'
        reservations:
          memory: 256M
          cpus: '0.5'

  qaup-redis:
    # 开发环境暴露 Redis 端口
    ports:
      - "6379:6379"
    # 开发环境不需要密码
    command: redis-server --appendonly yes

  qaup-app:
    # 开发环境暴露应用端口
    ports:
      - "8080:8080"
    # 开发环境变量
    environment:
      SPRING_PROFILES_ACTIVE: dev
      # 开发环境日志级别
      LOGGING_LEVEL_COM_QAUP: debug
      LOGGING_LEVEL_ORG_SPRINGFRAMEWORK: info
      # 热重载配置
      SPRING_DEVTOOLS_RESTART_ENABLED: true
      # JVM 调试配置
      JVM_OPTS: -Dname=qaup-admin.jar -Duser.timezone=Asia/Shanghai -Xms256m -Xmx512m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
    # 开发环境挂载源码（如果需要热重载）
    volumes:
      - app_logs:/app/logs
      - app_uploads:/app/uploadPath
      - ./qaup-admin/target:/app/target:ro
    # 暴露调试端口
    ports:
      - "8080:8080"
      - "5005:5005"  # JVM 调试端口

  qaup-nginx:
    # 开发环境配置
    environment:
      NGINX_PORT: 80
      SERVER_NAME: localhost
      API_PREFIX: /api
      BACKEND_HOST: qaup-app
      BACKEND_PORT: 8080
      MAX_UPLOAD_SIZE: 10M
    ports:
      - "80:80"