如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
现代化数据中心(IDC)设备管理系统,提供机房、机柜、设备的全生命周期管理,具备 3D 可视化展示功能。
GitHub: Gitee:
📖 查看完整文档教程 →
包含安装部署、配置说明、使用指南等全部教程
适用于新服务器上快速部署,无需安装 Node.js 等运行时环境,只需 Docker 即可。
📖 详细教程请查看文档站:https://gitee.com/zhang96110/idc_assest-docs/deploy/docker-deploy.html
# 克隆项目
git clone https://gitee.com/zhang96110/idc_assest.git
cd idc_assest
# 运行安装脚本(自动安装 Node.js)
./install.sh
# 或一键安装(无需克隆)
curl -fsSL https://gitee.com/zhang96110/idc_assest/raw/main/install.sh | bash
install.sh 自动完成:
# 克隆项目
git clone https://gitee.com/zhang96110/idc_assest.git
cd idc_assest
# 运行安装脚本(需要先安装 Node.js)
node install.js
# 或使用 npm
npm run deploy
| 项目 | 最低要求 | 推荐配置 |
|---|---|---|
| 操作系统 | Windows 10+、macOS 12+、Linux | 同最低要求 |
| Node.js | ≥14.0.0 | 20.x LTS |
| npm | ≥6.0.0 | 10.x |
| 内存 | 4GB | 8GB+ |
| 磁盘 | 2GB | 10GB+ |
生产环境额外要求:
| 项目 | 要求 |
|---|---|
| 数据库 | MySQL 8.0+(推荐)或 SQLite |
| Web 服务器 | Nginx 1.18+ |
| 进程管理 | PM2 5.x+ |
# 交互式安装
node install.js
# 非交互式安装
node install.js -y
# 指定数据库类型
node install.js -y --db=mysql # 使用 MySQL
node install.js -y --db=sqlite # 使用 SQLite(默认)
# 指定端口
node install.js -y --port=8000 # 后端端口
# 跳过前端构建
node install.js -y --skip-build
# 跳过 Nginx 配置
node install.js -y --skip-nginx
# 查看帮助
node install.js --help
# 交互式更新
node update.js
# 模拟运行(不执行实际操作)
node update.js --dry-run
# 跳过某些步骤
node update.js --skip-git # 跳过 Git 拉取
node update.js --skip-backup # 跳过数据库备份
node update.js --skip-migrate # 跳过数据库迁移
node update.js --skip-build # 跳过前端构建
node update.js --skip-deps # 跳过依赖安装
node update.js --skip-restart # 跳过服务重启
# 强制执行(忽略锁文件)
node update.js --force
# 查看帮助
node update.js --help
智能检测功能:
logs/update_*.log# 交互式卸载
node uninstall.js
# 强制卸载(无需确认)
node uninstall.js --force
# 卸载前自动备份数据库
node uninstall.js --backup
# 跳过某些步骤
node uninstall.js --skip-db # 跳过数据库删除
node uninstall.js --skip-deps # 跳过依赖删除
node uninstall.js --skip-uploads # 跳过上传文件删除
# 预览模式(不实际执行)
node uninstall.js --dry-run
# 查看帮助
node uninstall.js --help
生产环境部署只需运行 ./install.sh 或 node install.js,脚本会自动完成所有配置。
仅需提前准备 MySQL 数据库(如使用 MySQL):
-- 创建数据库
CREATE DATABASE idc_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- 创建用户
CREATE USER 'idc_user'@'localhost' IDENTIFIED BY 'YourStrongPassword';
GRANT ALL PRIVILEGES ON idc_management.* TO 'idc_user'@'localhost';
FLUSH PRIVILEGES;
服务器要求参考:
| 规模 | CPU | 内存 | 磁盘 |
|---|---|---|---|
| 小型(500 设备) | 8 核心+ | 16GB+ | 100GB+ |
install.js 会自动配置 Nginx。配置文件位于 deploy/nginx-idc.conf,核心配置如下:
server {
listen 80;
server_name your-domain.com;
client_max_body_size 100M;
root "/var/www/idc";
index index.html;
# Gzip 压缩
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json application/x-javascript image/svg+xml;
# 静态资源缓存(1年)
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|hdr)$ {
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# API 代理
location /api/ {
proxy_pass http://127.0.0.1:8000/api/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 300s;
proxy_buffering off;
}
# 文件上传代理
location /uploads/ {
proxy_pass http://127.0.0.1:8000/uploads/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 100M;
}
# 前端路由(SPA)
location / {
try_files $uri $uri/ /index.html =404;
}
}
启用配置:
# Ubuntu/Debian
sudo cp deploy/nginx-idc.conf /etc/nginx/sites-available/idc
sudo ln -sf /etc/nginx/sites-available/idc /etc/nginx/sites-enabled/idc
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t && sudo nginx -s reload
# PM2 服务
pm2 status # 查看状态
pm2 logs idc-backend # 查看日志
pm2 restart idc-backend # 重启服务
pm2 stop idc-backend # 停止服务
pm2 delete idc-backend # 删除服务
pm2 save # 保存配置
pm2 startup # 开机自启
# Nginx
sudo nginx -t # 测试配置
sudo nginx -s reload # 重载配置
sudo systemctl restart nginx # 重启服务
# PM2 日志
pm2 logs idc-backend
pm2 logs idc-backend --err # 仅错误日志
# Nginx 日志
sudo tail -f /var/log/nginx/error.log
# 应用日志
tail -f backend/logs/*.log
# 内置备份
# 系统管理 → 备份管理 → 创建备份
# 命令行备份
cd backend && node scripts/backup.js
# 还原
cd backend && node scripts/restore.js
# 检查端口占用(Linux)
netstat -tulpn | grep :8000
# Windows
netstat -ano | findstr :8000
# 方案1:修改端口(编辑 backend/.env)
PORT=8001
# 方案2:停止占用进程
sudo kill $(lsof -t -i:8000)
502 Bad Gateway
检查后端服务:pm2 status
检查端口监听:netstat -tulpn | grep 8000
检查 Nginx 配置:nginx -t
查看错误日志:tail /var/log/nginx/error.log
前端构建失败
# 检查 Node.js 版本
node -v # 需要 ≥18.x
# 清理并重试
cd frontend
rm -rf node_modules dist
npm install
npm run build
MySQL:
sudo systemctl status mysqlSHOW DATABASES;SHOW GRANTS FOR 'idc_user'@'localhost';# 修复文件权限
sudo chown -R $(whoami):$(whoami) /path/to/idc_assest
# 上传目录权限
sudo chmod -R 777 backend/uploads
# 增加内存限制(编辑 ecosystem.config.js)
node_args: "--max-old-space-size=4096"
# 或命令行
pm2 restart idc-backend --update-env
# 清理缓存
npm cache clean --force
# 删除后重装
rm -rf node_modules package-lock.json
npm install
# 重新启动
pm2 start ecosystem.config.js
pm2 save
pm2 startup
idc_assest/
├── frontend/ # 前端项目
│ ├── src/
│ │ ├── api/ # API 接口
│ │ ├── components/ # 组件(3d/、dashboard/、device/、floorplan/)
│ │ ├── pages/ # 页面
│ │ ├── hooks/ # 自定义 Hooks
│ │ ├── stores/ # 状态管理
│ │ └── utils/ # 工具函数
│ └── package.json
├── backend/ # 后端项目
│ ├── models/ # Sequelize 数据模型
│ ├── routes/ # API 路由
│ ├── middleware/ # 中间件
│ ├── scripts/ # 数据库脚本(init-database.js、migrate-all.js)
│ ├── utils/ # 工具函数
│ ├── uploads/ # 上传文件目录
│ ├── server.js # 服务入口
│ └── package.json
├── deploy/ # 部署配置
│ ├── ecosystem.config.js # PM2 配置
│ └── nginx-idc.conf # Nginx 配置
├── install/ # 安装脚本模块
├── docs/ # 项目文档
├── install.sh # Linux 安装引导脚本
├── install.js # 安装脚本入口
├── update.js # 更新脚本
├── uninstall.js # 卸载脚本
└── README.md # 本文件
完整交互式 API 文档访问:** **
基于 Swagger/OpenAPI 3.0 标准,支持在线认证测试和 API 调试。
欢迎提交 Issue 或 Pull Request!
# 1. Fork 本项目
# 2. 克隆你的 Fork
git clone https://github.com/YOUR_USERNAME/idc_assest.git
cd idc_assest
# 3. 创建分支
git checkout -b feature/your-feature # 功能开发
git checkout -b fix/your-fix # Bug 修复
# 4. 开发并提交
git commit -m 'feat: 添加新功能'
git commit -m 'fix: 修复问题'
# 5. 推送并创建 PR
git push origin feature/your-feature
提交信息规范:
| 类型 | 说明 |
|---|---|
| feat | 新功能 |
| fix | Bug 修复 |
| docs | 文档更新 |
| style | 代码格式 |
| refactor | 重构 |
| perf | 性能优化 |
| test | 测试 |
| chore | 构建/工具 |
开发规范:
本项目基于 MIT 许可证开源。
⭐ 如果这个项目对您有帮助,请给我们一个 Star!
来自真实用户的反馈,见证轩辕镜像的优质服务