# 3D家具报价系统 - 快速启动脚本 # 用途:一键检查环境、启动服务、打开浏览器 # 使用:.\scripts\quick-start.ps1 Write-Host "=== 3D家具报价系统 - 快速启动 ===" -ForegroundColor Cyan Write-Host "时间: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')`n" -ForegroundColor Yellow # 1. 检查 Docker Write-Host "检查 Docker..." -ForegroundColor Yellow try { $dockerVersion = docker --version Write-Host "✅ $dockerVersion" -ForegroundColor Green } catch { Write-Host "❌ Docker 未安装或未启动" -ForegroundColor Red Write-Host "请先启动 Docker Desktop" -ForegroundColor Yellow exit 1 } # 2. 检查 Docker Compose 文件 Write-Host "`n检查 Docker Compose 配置..." -ForegroundColor Yellow if (Test-Path "docker-compose.dev.yml") { Write-Host "✅ 找到 docker-compose.dev.yml" -ForegroundColor Green } else { Write-Host "❌ 未找到 docker-compose.dev.yml" -ForegroundColor Red Write-Host "请先创建 Docker Compose 配置文件" -ForegroundColor Yellow exit 1 } # 3. 检查 VHDX 文件大小 Write-Host "`n检查 Docker 磁盘空间..." -ForegroundColor Yellow $vhdxPath = "D:\Users\Mr_Wu01\Documents\DockerDesktopWSL\disk\docker_data.vhdx" if (Test-Path $vhdxPath) { $vhdxSize = [math]::Round((Get-Item $vhdxPath).Length/1GB, 2) if ($vhdxSize -gt 50) { Write-Host "⚠️ VHDX 文件较大: $vhdxSize GB" -ForegroundColor Red Write-Host "建议先运行清理脚本: .\scripts\docker-cleanup.ps1" -ForegroundColor Yellow $continue = Read-Host "是否继续启动? (Y/N)" if ($continue -ne 'Y' -and $continue -ne 'y') { exit 0 } } else { Write-Host "✅ VHDX 文件大小: $vhdxSize GB" -ForegroundColor Green } } # 4. 启动 Docker 服务 Write-Host "`n启动 Docker 服务..." -ForegroundColor Yellow docker-compose -f docker-compose.dev.yml up -d if ($LASTEXITCODE -eq 0) { Write-Host "✅ Docker 服务启动成功" -ForegroundColor Green } else { Write-Host "❌ Docker 服务启动失败" -ForegroundColor Red exit 1 } # 5. 等待服务就绪 Write-Host "`n等待服务就绪..." -ForegroundColor Yellow Start-Sleep -Seconds 5 # 6. 检查服务状态 Write-Host "`n检查服务状态..." -ForegroundColor Yellow docker-compose -f docker-compose.dev.yml ps # 7. 显示访问信息 Write-Host "`n=== 服务已启动 ===" -ForegroundColor Green Write-Host "`n访问地址:" -ForegroundColor Cyan Write-Host " 应用: http://localhost:3000" -ForegroundColor White Write-Host " MinIO 控制台: http://localhost:9001" -ForegroundColor White Write-Host " PostgreSQL: localhost:5432" -ForegroundColor White Write-Host " Redis: localhost:6379" -ForegroundColor White # 8. 显示有用的命令 Write-Host "`n常用命令:" -ForegroundColor Cyan Write-Host " 查看日志: docker-compose -f docker-compose.dev.yml logs -f" -ForegroundColor Gray Write-Host " 停止服务: docker-compose -f docker-compose.dev.yml down" -ForegroundColor Gray Write-Host " 重启服务: docker-compose -f docker-compose.dev.yml restart" -ForegroundColor Gray Write-Host " 监控资源: .\scripts\docker-monitor.ps1" -ForegroundColor Gray # 9. 询问是否打开浏览器 $openBrowser = Read-Host "`n是否打开浏览器? (Y/N)" if ($openBrowser -eq 'Y' -or $openBrowser -eq 'y') { Start-Process "http://localhost:3000" Start-Process "http://localhost:9001" } Write-Host "`n✅ 启动完成!" -ForegroundColor Green