feat: Docker部署 + 云主机导入 + 终端优化

Docker 部署:
- 新增根目录 docker-compose.yml(MySQL+Redis+前后端四容器)
- 新增 frontend/Dockerfile(多阶段构建)和 nginx.conf(SPA+API反代)
- 修复 backend/Dockerfile:GOPROXY国内加速、编译整个cmd包

云主机导入功能:
- 新增 backend/internal/cloud 包:Provider接口 + 阿里云API客户端
- 新增 cloud_sync.go:区域同步/主机发现/导入 API
- 重写 CloudServerImport.tsx:4步流程(选云→选账号→选区域→发现导入)
- 修复导入外键约束失败(region_id/cloud_id 设为 NULL)

终端优化:
- 修复双X关闭按钮重影(showCloseButton=false)
- 修复最大化→最小化不恢复(ResizeObserver + 禁用CSS过渡)

其他:
- GORM AutoMigrate 逐表迁移,避免索引冲突阻塞启动
- Makefile 更新为 AIOps + 新增 docker 命令组
- .env.example 移至 backend 目录
This commit is contained in:
Logan committed 2026-06-18 09:22:13 +08:00
1 parent 2e175daf80
commit d0344c2f52
14 files changed
+1265 -200

No files matched your search

+100
View File
@@ -0,0 +1,100 @@
version: '3.8'
services:
# ======================== MySQL 数据库 ========================
mysql:
image: mysql:8.0
container_name: aiops-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: aiops
MYSQL_USER: aiops
MYSQL_PASSWORD: aiops123
TZ: Asia/Shanghai
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
command: >
--default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-p$$MYSQL_ROOT_PASSWORD"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
networks:
- aiops-network
# ======================== Redis 缓存 ========================
redis:
image: redis:7-alpine
container_name: aiops-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- aiops-network
# ======================== Go 后端服务 ========================
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: aiops-backend
restart: unless-stopped
ports:
- "8080:8080"
volumes:
- ./backend/config.yaml:/app/config.yaml
- backend_logs:/app/logs
- backend_uploads:/app/uploads
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- aiops-network
# ======================== React 前端 + Nginx ========================
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: aiops-frontend
restart: unless-stopped
ports:
- "80:80"
depends_on:
backend:
condition: service_healthy
networks:
- aiops-network
volumes:
mysql_data:
redis_data:
backend_logs:
backend_uploads:
networks:
aiops-network:
driver: bridge