#!/bin/bash

# ERP Java 后端开发环境启动脚本

set -e

echo "🚀 启动ERP Java后端开发环境..."

# 检查Docker是否运行
if ! docker info > /dev/null 2>&1; then
    echo "❌ Docker未运行，请先启动Docker"
    exit 1
fi

# 进入项目根目录
cd "$(dirname "$0")/.."

echo "📦 启动基础设施服务..."
docker-compose up -d

echo "⏳ 等待服务启动..."
sleep 10

echo "🔍 检查服务状态..."
docker-compose ps

echo "✅ 基础设施服务已启动:"
echo "   Nacos控制台: http://localhost:8848/nacos (账号:nacos 密码:nacos)"
echo "   RocketMQ控制台: http://localhost:8080"
echo "   SkyWalking UI: http://localhost:8081"
echo "   MinIO控制台: http://localhost:9001 (账号:minioadmin 密码:minioadmin123)"

echo ""
echo "📚 下一步:"
echo "   1. 编译项目: mvn clean compile"
echo "   2. 启动用户服务: cd services/user-service && mvn spring-boot:run"
echo "   3. 验证服务: curl http://localhost:8082/user/api/users/health"

echo ""
echo "🎯 开发环境准备完成！"