# ==============================================================
# Nacos Docker Compose Override
# 覆盖 /root/.openclaw/workspace/erp-java-backend/docker-compose.yml 中的 Nacos 配置
# 
# 使用方式: 
#   cp docker-compose.override.example.yml ../../docker-compose.override.yml
#   docker compose up -d nacos
# ==============================================================

version: '3.8'

services:
  # 覆盖原有的 Nacos 配置（如果需要替换）
  # nacos:
  #   image: nacos/nacos-server:v2.2.3
  #   container_name: erp-nacos
  #   environment:
  #     MODE: standalone
  #     SPRING_DATASOURCE_PLATFORM: mysql
  #     MYSQL_SERVICE_HOST: mysql
  #     MYSQL_SERVICE_DB_NAME: nacos_config
  #     MYSQL_SERVICE_PORT: 3306
  #     MYSQL_SERVICE_USER: nacos
  #     MYSQL_SERVICE_PASSWORD: nacos123456
  #     NACOS_AUTH_ENABLE: "true"
  #     NACOS_AUTH_TOKEN: "SecretKey012345678901234567890123456789012345678901234567890123456789"
  #   ports:
  #     - "8848:8848"
  #     - "9848:9848"
  #     - "9849:9849"
  #   volumes:
  #     - nacos_logs:/home/nacos/logs
  #     - nacos_data:/home/nacos/data
  #   depends_on:
  #     - mysql
  #   networks:
  #     - erp-network

  # 新增：Nacos 专用 MySQL（可选）
  nacos-mysql:
    image: mysql:8.0
    container_name: erp-nacos-mysql
    environment:
      MYSQL_ROOT_PASSWORD: root123456
      MYSQL_DATABASE: nacos_config
      MYSQL_USER: nacos
      MYSQL_PASSWORD: nacos123456
    ports:
      - "3308:3306"
    volumes:
      - nacos_mysql_data:/var/lib/mysql
      - ./init/mysql-schema.sql:/docker-entrypoint-initdb.d/mysql-schema.sql
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --default-authentication-plugin=mysql_native_password
    networks:
      - erp-network
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-proot123456"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  nacos_mysql_data:
