Update 2026-06-23 10:40:10
Build and Push Docker Images / Build Backend Image (push) Has been cancelled
Build and Push Docker Images / Build Frontend Image (push) Has been cancelled
Build and Push Docker Images / Notify Build Complete (push) Has been cancelled

This commit is contained in:
yi
2026-06-23 10:40:10 +08:00
parent 864efb7f9d
commit e9bff9beb3
56 changed files with 295 additions and 292 deletions
+4 -4
View File
@@ -4,10 +4,10 @@
# ============================================
# 后端镜像地址(从 ghcr.io 拉取公开镜像)
BACKEND_IMAGE=ghcr.io/gituib/idc-backend:latest
BACKEND_IMAGE=ghcr.io/xinmi/yunrui_asset-backend:latest
# 前端镜像地址(从 ghcr.io 拉取公开镜像)
FRONTEND_IMAGE=ghcr.io/gituib/idc-frontend:latest
FRONTEND_IMAGE=ghcr.io/xinmi/yunrui_asset-frontend:latest
# 指定特定版本(可选,默认 latest)
# BACKEND_VERSION=v1.0.0
@@ -15,6 +15,6 @@ FRONTEND_IMAGE=ghcr.io/gituib/idc-frontend:latest
# ---- MySQL 容器配置(如启用本地 MySQL ----
# MYSQL_ROOT_PASSWORD=your_root_password
# MYSQL_DATABASE=idc_management
# MYSQL_USER=idc_user
# MYSQL_DATABASE=yunrui_management
# MYSQL_USER=yunrui_user
# MYSQL_PASSWORD=your_mysql_password
+2 -2
View File
@@ -17,8 +17,8 @@ on:
env:
REGISTRY: ghcr.io
NAMESPACE: ${{ github.repository_owner }}
BACKEND_IMAGE: idc-backend
FRONTEND_IMAGE: idc-frontend
BACKEND_IMAGE: yunrui_asset-backend
FRONTEND_IMAGE: yunrui_asset-frontend
jobs:
build-backend:
+1 -1
View File
@@ -120,4 +120,4 @@ docs/install-split-plan.md
# ==============================================
deploy/nginx-troubleshooting.md
docs/trae-creativity-contest-proposal.html
TRAE-创意提案-IDC设备资产管理系统.html
TRAE-创意提案-云睿资产管理系统.html
+3 -3
View File
@@ -8,10 +8,10 @@
- **完成时间**
- **项目信息**
- 项目名称:云睿资产
- 项目目录:C:\Users\L1822\xinmi\idc_assest
- Git 地址:https://github.com/gituib/idc_assest
- 项目目录:C:\Users\L1822\xinmi\yunrui_assetet
- Git 地址:https://code.xinmi.cloud/yyunrui_assett
- 端口范围:12000-12010
- 状态文档:C:\Users\L1822\xinmi\idc_assest\.work\工作流状态.md
- 状态文档:C:\Users\L1822\xinmi\yunrui_assetet\.work\工作流状态.md
## 步骤执行记录
+2 -2
View File
@@ -1,7 +1,7 @@
《项目整体分析报告》
## 核心功能
本项目是一个 IDC 设备管理系统,主要提供机房、机柜、设备、端口、线缆等资产的精细化管理功能,支持工单系统、耗材管理、盘点任务以及 3D 可视化展示。
本项目是一个 云睿资产管理系统,主要提供机房、机柜、设备、端口、线缆等资产的精细化管理功能,支持工单系统、耗材管理、盘点任务以及 3D 可视化展示。
## 技术栈
- 编程语言:JavaScript (Node.js v20+)
@@ -16,7 +16,7 @@
- 前端服务 (Frontend):端口 3000,负责用户界面交互及 3D 模型展示。
### 外部依赖
- 数据库 (SQLite):本地文件 `idc_management.db`
- 数据库 (SQLite):本地文件 `yunrui_management.db`
- 数据库 (MySQL):可选,外部连接。
## 服务依赖关系
+1 -1
View File
@@ -2,7 +2,7 @@
## Project Overview
IDC Device Asset Management System — full-stack app for data center device lifecycle management with 3D visualization. Monorepo: `backend/` (Express + Sequelize), `frontend/` (React + Vite + Ant Design + Three.js).
YunRui Asset Management System — full-stack app for data center device lifecycle management with 3D visualization. Monorepo: `backend/` (Express + Sequelize), `frontend/` (React + Vite + Ant Design + Three.js).
## 交互规则
+23 -23
View File
@@ -1,6 +1,6 @@
# IDC设备资产系统 - Code Wiki
# 云睿资产系统 - Code Wiki
> 版本:2.0.0 | 更新日期:2026-05-07 | 项目地址:[GitHub](https://github.com/gituib/idc_assest)
> 版本:2.0.0 | 更新日期:2026-05-07 | 项目地址:[源码仓库](https://code.xinmi.cloud/yunyunrui_asset
---
@@ -24,7 +24,7 @@
### 1.1 项目简介
IDC设备资产系统(IDC Device Management System)是一个现代化的数据中心设备全生命周期管理平台,提供机房、机柜、设备的完整管理能力,并具备3D可视化展示功能。
云睿资产系统(YunRui Asset Management System)是一个现代化的数据中心设备全生命周期管理平台,提供机房、机柜、设备的完整管理能力,并具备3D可视化展示功能。
### 1.2 技术栈概览
@@ -118,7 +118,7 @@ IDC设备资产系统(IDC Device Management System)是一个现代化的数
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ SQLite │ │ MySQL │ │
│ │ (开发环境) │◄────────────────►│ (生产环境) │ │
│ │ idc_management.db│ │ MySQL 8.0+ │ │
│ │ yunrui_management.db│ │ MySQL 8.0+ │ │
│ └─────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘
```
@@ -592,7 +592,7 @@ if (DB_TYPE === 'mysql') {
} else {
sequelize = new Sequelize({
dialect: 'sqlite',
storage: process.env.DB_PATH || './idc_management.db'
storage: process.env.DB_PATH || './yunrui_management.db'
});
}
```
@@ -1235,7 +1235,7 @@ const backupDatabase = async (options = {}) => {
const filepath = path.join(BACKUP_DIR, filename);
await fs.copy(
process.env.DB_PATH || './idc_management.db',
process.env.DB_PATH || './yunrui_management.db',
filepath
);
@@ -1493,7 +1493,7 @@ router.post('/import-preview', upload.single('csvFile'), async (req, res) => {
```bash
# 前端环境配置
VITE_API_BASE_URL=http://localhost:8000/api
VITE_APP_TITLE=IDC设备管理系统
VITE_APP_TITLE=云睿资产管理系统
VITE_APP_VERSION=2.0.0
```
@@ -1506,12 +1506,12 @@ PORT=8000
# 数据库配置
DB_TYPE=sqlite # sqlite 或 mysql
DB_PATH=./idc_management.db # SQLite数据库路径
DB_PATH=./yunrui_management.db # SQLite数据库路径
# MySQL配置 (当DB_TYPE=mysql时)
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_DATABASE=idc_management
MYSQL_DATABASE=yunrui_management
MYSQL_USERNAME=root
MYSQL_PASSWORD=your_password
@@ -1573,11 +1573,11 @@ npm run build
# 2. 使用PM2启动后端
cd ../backend
pm2 start server.js --name idc-backend
pm2 start server.js --name yunrui_asset-backend
# 3. 使用Nginx反向代理
# 或使用PM2 serve提供静态文件
pm2 serve ./frontend/dist 3000 --name idc-frontend
pm2 serve ./frontend/dist 3000 --name yunrui_asset-frontend
```
---
@@ -1596,23 +1596,23 @@ sudo apt install mysql-server
# 2. 创建数据库
mysql -u root -p
CREATE DATABASE idc_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'idc_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON idc_management.* TO 'idc_user'@'localhost';
CREATE DATABASE yunrui_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'yunrui_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON yunrui_management.* TO 'yunrui_user'@'localhost';
FLUSH PRIVILEGES;
```
#### 10.1.2 Nginx配置
```nginx
# /etc/nginx/sites-available/idc
# /etc/nginx/sites-available/yunrui_asset
server {
listen 80;
server_name your_domain.com;
# 前端静态文件
root /var/www/idc/frontend/dist;
root /var/www/yunrui_asset/frontend/dist;
index index.html;
# Gzip压缩
@@ -1636,7 +1636,7 @@ server {
# 上传文件
location /uploads {
alias /var/www/idc/backend/uploads;
alias /var/www/yunrui_asset/backend/uploads;
autoindex on;
}
@@ -1666,12 +1666,12 @@ npm install -g pm2
# 启动后端服务
cd backend
pm2 start server.js --name idc-backend \
pm2 start server.js --name yunrui_asset-backend \
--env production \
--max-memory-restart 1G
# 配置负载均衡 (多核CPU)
pm2 start server.js -i max --name idc-backend
pm2 start server.js -i max --name yunrui_asset-backend
# 保存进程列表
pm2 save
@@ -1723,7 +1723,7 @@ services:
db:
image: mysql:8.0
environment:
MYSQL_DATABASE: idc_management
MYSQL_DATABASE: yunrui_management
MYSQL_ROOT_PASSWORD: root_password
volumes:
- mysql_data:/var/lib/mysql
@@ -1819,7 +1819,7 @@ volumes:
│ ┌─────────────────────────────┐ ┌─────────────────────────────┐ │
│ │ SQLite │ │ MySQL │ │
│ │ (开发环境) │◄──►│ (生产环境) │ │
│ │ idc_management.db │ │ MySQL 8.0+ │ │
│ │ yunrui_management.db │ │ MySQL 8.0+ │ │
│ └─────────────────────────────┘ └─────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
@@ -2160,7 +2160,7 @@ volumes:
│ │ │ filename: "backup_20260507_120000.sql", │ │ │
│ │ │ size: 1048576, │ │ │
│ │ │ createdAt: "2026-05-07T12:00:00Z", │ │ │
│ │ │ database: "idc_management", │ │ │
│ │ │ database: "yunrui_management", │ │ │
│ │ │ tables: ["devices", "racks", "tickets", ...], │ │ │
│ │ │ status: "completed" │ │ │
│ │ │ } │ │ │
@@ -2200,7 +2200,7 @@ volumes:
│ │ mysql -u user -p dbname < backup_xxx.sql │ │
│ │ │ │
│ │ SQLite: │ │
│ │ cp backup_xxx.db idc_management.db │ │
│ │ cp backup_xxx.db yunrui_management.db │ │
│ │ │ │
│ └──────────────────────────┬───────────────────────────────────────┘ │
│ │ │
+32 -28
View File
@@ -1,6 +1,6 @@
# IDC 设备资产管理系统
# 云睿资产管理系统
**维护团队**IDC 设备资产管理开源社区
**维护团队**云睿资产开源社区
**版本**2.1.1 | **更新**2026-06-22
面向数据中心(IDC)运维与资产管理场景,提供机房、机柜、设备全生命周期管理,支持 3D 可视化、工单流转、耗材库存、资产盘点与 RBAC 权限控制。
@@ -42,7 +42,8 @@
```bash
# 克隆项目
cd idc_assest
git clone https://code.xinmi.cloud/yunrui_asset.git
cd yunrui_asset
# 配置 JWT 密钥(生产环境必填)
# PowerShell 生成示例:
@@ -53,7 +54,7 @@ set JWT_SECRET=你的强随机密钥
docker compose -f docker-compose.full.yml up -d --build
# 写入示例数据(可选,含演示账号与机房/设备/工单)
docker exec idc_assest-backend node scripts/seed-example-data.js
docker exec yunrui_asset-backend node scripts/seed-example-data.js
```
| 服务 | 默认地址 | 说明 |
@@ -62,7 +63,7 @@ docker exec idc_assest-backend node scripts/seed-example-data.js
| 后端 API | http://localhost:12001 | 容器内端口 8000 |
| API 文档 | http://localhost:12000/api-docs | Swagger 交互文档 |
| 健康检查 | http://localhost:12001/health | 后端存活探测 |
| MySQL | localhost:12006 | 库名 `idc_management` |
| MySQL | localhost:12006 | 库名 `yunrui_management` |
| 角色 | 用户名 | 密码 | 获取方式 |
|------|--------|------|----------|
@@ -74,15 +75,15 @@ docker exec idc_assest-backend node scripts/seed-example-data.js
**Docker 预构建镜像**`docker-compose.prod.yml`,从仓库拉取,无需本地 build):
```
ghcr.io/gituib/idc-backend:latest
ghcr.io/gituib/idc-frontend:latest
ghcr.io/xinmi/yunrui_asset-backend:latest
ghcr.io/xinmi/yunrui_asset-frontend:latest
```
### 方式二:本地开发
```bash
git clone https://github.com/gituib/idc_assest.git
cd idc_assest
git clone https://code.xinmi.cloud/yunrui_asset.git
cd yunrui_asset
npm run install:all
cp backend/.env.example backend/.env
cd backend && node scripts/init-database.js && cd ..
@@ -98,7 +99,7 @@ npm start
### 项目结构
```
idc_assest/
yunrui_asset/
├── frontend/ # React 前端(Vite
├── backend/ # Express 后端(models / routes / scripts
├── deploy/ # PM2、Nginx 部署配置
@@ -109,6 +110,8 @@ idc_assest/
└── README.md # 本操作手册(权威文档)
```
**源码地址**https://code.xinmi.cloud/yunrui_asset
---
## 操作手册
@@ -117,7 +120,7 @@ idc_assest/
#### 1.1 产品简介
IDC 设备资产管理系统(界面品牌名:**云睿资产**)用于统一管理多机房、多机柜下的服务器、网络、存储等设备,覆盖设备上架、端口接线、故障工单、耗材出入库、资产盘点、数据备份与操作审计等场景,并通过 3D 机柜视图与机房平面图辅助空间规划。
云睿资产管理系统(界面品牌名:**云睿资产**)用于统一管理多机房、多机柜下的服务器、网络、存储等设备,覆盖设备上架、端口接线、故障工单、耗材出入库、资产盘点、数据备份与操作审计等场景,并通过 3D 机柜视图与机房平面图辅助空间规划。
#### 1.2 核心能力
@@ -197,7 +200,7 @@ docker compose -f docker-compose.full.yml up -d --build
docker compose -f docker-compose.full.yml ps
# 查看后端日志
docker logs -f idc_assest-backend
docker logs -f yunrui_asset-backend
# 停止
docker compose -f docker-compose.full.yml down
@@ -210,11 +213,11 @@ docker compose -f docker-compose.full.yml down
| `FRONTEND_PORT` | `12000` | 前端映射端口 |
| `BACKEND_PORT` | `12001` | 后端映射端口 |
| `MYSQL_PORT` | `12006` | MySQL 映射端口 |
| `MYSQL_DATABASE` | `idc_management` | 数据库名 |
| `MYSQL_DATABASE` | `yunrui_management` | 数据库名 |
| `MYSQL_ROOT_PASSWORD` | `xinmi_password` | MySQL root 密码 |
| `JWT_SECRET` | (无默认) | **生产必填** |
数据持久化:MySQL 数据卷 `idc_assest-mysql-data`;上传文件映射 `backend/uploads`;日志映射 `backend/logs`;备份映射 `backend/backups`
数据持久化:MySQL 数据卷 `yunrui_asset-mysql-data`;上传文件映射 `backend/uploads`;日志映射 `backend/logs`;备份映射 `backend/backups`
#### 3.2 Docker 预构建镜像(`docker-compose.prod.yml`
@@ -231,10 +234,10 @@ docker compose -f docker-compose.prod.yml up -d
#### 3.3 Linux 一键安装
```bash
git clone https://gitee.com/zhang96110/idc_assest.git
cd idc_assest
git clone https://code.xinmi.cloud/yunrui_asset.git
cd yunrui_asset
./install.sh
# 或远程一键:curl -fsSL https://gitee.com/zhang96110/idc_assest/raw/main/install.sh | bash
# 或远程一键:curl -fsSL https://code.xinmi.cloud/yunrui_asset/raw/branch/main/install.sh | bash
```
`install.sh` 自动检测发行版、安装 Node.js 20.x,并调用 `install.js` 完成依赖安装、数据库初始化与 Nginx/PM2 配置。
@@ -242,8 +245,8 @@ cd idc_assest
#### 3.4 Windows / 手动安装
```powershell
git clone https://gitee.com/zhang96110/idc_assest.git
cd idc_assest
git clone https://code.xinmi.cloud/yunrui_asset.git
cd yunrui_asset
node install.js
# 或:npm run deploy
```
@@ -312,7 +315,7 @@ node uninstall.js # 交互式卸载
```bash
# Docker 环境
docker exec idc_assest-backend node scripts/seed-example-data.js
docker exec yunrui_asset-backend node scripts/seed-example-data.js
# 本地开发(backend 目录,需配置数据库连接)
cd backend && npm run seed
@@ -569,8 +572,8 @@ curl http://localhost:12000/health
| 环境 | 命令 |
|------|------|
| Docker | `docker logs -f idc_assest-backend` |
| PM2 | `pm2 logs idc-backend` |
| Docker | `docker logs -f yunrui_asset-backend` |
| PM2 | `pm2 logs yunrui_asset-backend` |
| 文件 | `tail -f backend/logs/*.log` |
日志级别通过 `backend/.env``LOG_LEVEL` 控制(`error` / `warn` / `info` / `debug`)。
@@ -582,7 +585,7 @@ curl http://localhost:12000/health
docker compose -f docker-compose.full.yml restart backend frontend
# PM2
pm2 restart idc-backend
pm2 restart yunrui_asset-backend
sudo nginx -s reload
```
@@ -621,7 +624,7 @@ cd backend && npm run seed
| 现象 | 可能原因 | 处理 |
|------|----------|------|
| backend 启动失败 | MySQL 未就绪或 `JWT_SECRET` 未设 | 等待 MySQL;设置 `JWT_SECRET` 后重启 |
| 502 / API 无响应 | 后端容器异常 | `docker logs idc_assest-backend` |
| 502 / API 无响应 | 后端容器异常 | `docker logs yunrui_asset-backend` |
| 中文乱码 | MySQL 字符集 | 确保库为 `utf8mb4` |
#### 10.3 本地开发
@@ -639,7 +642,7 @@ cd backend && npm run seed
| U 位冲突 | 同一机柜 U 位已被占用 | 调整设备起始 U 位或高度 |
| 3D 页面空白 | 浏览器不支持 WebGL | 更换浏览器或更新显卡驱动 |
| 上传失败 | 文件超过大小限制 | 默认最大 30 MB(`MAX_FILE_SIZE_MB` |
| 无示例数据 | 未执行种子脚本 | `docker exec idc_assest-backend node scripts/seed-example-data.js` |
| 无示例数据 | 未执行种子脚本 | `docker exec yunrui_asset-backend node scripts/seed-example-data.js` |
---
@@ -652,10 +655,10 @@ cd backend && npm run seed
| `PORT` | `8000` | 后端监听端口 |
| `NODE_ENV` | `development` | 运行环境 |
| `DB_TYPE` | `sqlite` | `sqlite``mysql` |
| `DB_PATH` | `./idc_management.db` | SQLite 文件路径 |
| `DB_PATH` | `./yunrui_management.db` | SQLite 文件路径 |
| `MYSQL_HOST` | `localhost` | MySQL 主机(Docker 内为 `mysql` |
| `MYSQL_PORT` | `3306` | MySQL 端口 |
| `MYSQL_DATABASE` | `idc_management` | 数据库名 |
| `MYSQL_DATABASE` | `yunrui_management` | 数据库名 |
| `MYSQL_USERNAME` | `root` | 数据库用户 |
| `MYSQL_PASSWORD` | (空) | 数据库密码 |
| `JWT_SECRET` | 开发自动生成 | **生产必填** |
@@ -683,6 +686,7 @@ cd backend && npm run seed
| API 详细文档 | [docs/api/README.md](docs/api/README.md) |
| Docker 部署补充 | [docs/docker-deployment-guide.md](docs/docker-deployment-guide.md) |
| 用户指南(历史) | [docs/USER_GUIDE.md](docs/USER_GUIDE.md) |
| 问题反馈 | https://code.xinmi.cloud/yunrui_asset/issues |
---
@@ -714,5 +718,5 @@ git push origin feature/your-feature
---
**IDC 设备资产管理开源社区**
**云睿资产开源社区**
文档版本:2.1.1 | 2026-06-22
+4 -4
View File
@@ -1,4 +1,4 @@
# IDC设备管理系统 - 环境配置
# 云睿资产管理系统 - 环境配置
# 生成时间: 2026-02-26T05:07:19.876Z
# ==============================================
@@ -19,16 +19,16 @@ NODE_ENV=development
DB_TYPE=sqlite
# SQLite 配置(当 DB_TYPE=sqlite 时使用)
DB_PATH=./idc_management.db
DB_PATH=./yunrui_management.db
# MySQL 配置(当 DB_TYPE=mysql 时使用)
# 注意:使用 MySQL 前请确保 MySQL 服务已安装并创建相应的数据库
# 数据库创建命令:CREATE DATABASE idc_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# 数据库创建命令:CREATE DATABASE yunrui_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USERNAME=root
MYSQL_PASSWORD=
MYSQL_DATABASE=idc_management
MYSQL_DATABASE=yunrui_management
# ==============================================
# 安全配置
+1 -1
View File
@@ -1,5 +1,5 @@
# ============================================
# IDC 设备管理系统 - 后端 Dockerfile
# 云睿资产管理系统 - 后端 Dockerfile
# 基于 Node.js 20 Alpine 构建
# ============================================
+2 -2
View File
@@ -17,7 +17,7 @@ const sqlLogger = (msg) => logger.debug(msg);
if (DB_TYPE === 'mysql') {
// MySQL 配置
sequelize = new Sequelize(
process.env.MYSQL_DATABASE || 'idc_management',
process.env.MYSQL_DATABASE || 'yunrui_management',
process.env.MYSQL_USERNAME || 'root',
process.env.MYSQL_PASSWORD || '',
{
@@ -38,7 +38,7 @@ if (DB_TYPE === 'mysql') {
} else {
sequelize = new Sequelize({
dialect: 'sqlite',
storage: process.env.DB_PATH || './idc_management.db',
storage: process.env.DB_PATH || './yunrui_management.db',
logging: sqlLogger,
pool: {
max: 5,
+1 -1
View File
@@ -84,7 +84,7 @@ function ensureJwtSecret() {
fs.writeFileSync(ENV_FILE_PATH, updatedContent, 'utf-8');
console.log('✓ JWT_SECRET 已自动生成并保存到 .env 文件');
} else {
const defaultContent = `# IDC设备管理系统 - 环境配置
const defaultContent = `# 云睿资产管理系统 - 环境配置
# 自动生成时间: ${new Date().toISOString()}
JWT_SECRET=${newSecret}
+2 -2
View File
@@ -1,11 +1,11 @@
{
"name": "idc-backend",
"name": "yunrui-backend",
"version": "2.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "idc-backend",
"name": "yunrui-backend",
"version": "2.0.0",
"dependencies": {
"all": "^0.0.0",
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "idc-backend",
"name": "yunrui_asset-backend",
"version": "2.1.1",
"description": "IDC设备管理系统后端",
"description": "云睿资产管理系统后端",
"scripts": {
"start": "node server.js",
"dev": "nodemon server.js",
+5 -5
View File
@@ -31,7 +31,7 @@ const initDefaultSettings = async () => {
// 基本设置 - 站点信息
{
settingKey: 'site_name',
settingValue: JSON.stringify('机柜管理系统'),
settingValue: JSON.stringify('云睿资产管理系统'),
settingType: 'string',
category: 'general',
description: '网站名称',
@@ -133,7 +133,7 @@ const initDefaultSettings = async () => {
},
{
settingKey: 'system_description',
settingValue: JSON.stringify('机柜管理系统 - 专业的数据中心设备管理解决方案'),
settingValue: JSON.stringify('云睿资产管理系统 - 专业的数据中心设备管理解决方案'),
settingType: 'string',
category: 'about',
description: '系统描述',
@@ -374,7 +374,7 @@ router.post('/reset/:key', async (req, res) => {
}
const defaultValues = {
site_name: '机柜管理系统',
site_name: '云睿资产管理系统',
site_logo: '',
idle_timeout: 30,
max_login_attempts: 5,
@@ -385,7 +385,7 @@ router.post('/reset/:key', async (req, res) => {
contact_email: '',
contact_phone: '',
company_address: '',
system_description: '机柜管理系统 - 专业的数据中心设备管理解决方案',
system_description: '云睿资产管理系统 - 专业的数据中心设备管理解决方案',
};
const defaultValue = defaultValues[key];
@@ -682,7 +682,7 @@ router.get('/system/info', async (req, res) => {
res.json({
system: {
name: '机柜管理系统',
name: '云睿资产管理系统',
version: APP_VERSION,
uptime: process.uptime(),
nodeVersion: process.version,
+1 -1
View File
@@ -5,7 +5,7 @@ const Device = require('../models/Device');
async function migrate() {
console.log('========================================');
console.log(' IDC管理系统 - 数据库迁移脚本 v2.0 ');
console.log(' 云睿资产管理系统 - 数据库迁移脚本 v2.0 ');
console.log('========================================');
console.log('');
+1 -1
View File
@@ -62,7 +62,7 @@ for (let i = 0; i < args.length; i++) {
async function runBackup() {
console.log('========================================');
console.log(' IDC设备管理系统 - 数据备份工具');
console.log(' 云睿资产管理系统 - 数据备份工具');
console.log('========================================\n');
try {
+2 -2
View File
@@ -46,7 +46,7 @@ const defaultSettings = [
// 全局配置
{
settingKey: 'site_name',
settingValue: JSON.stringify('机柜管理系统'),
settingValue: JSON.stringify('云睿资产管理系统'),
settingType: 'string',
category: 'general',
description: '网站名称',
@@ -210,7 +210,7 @@ const defaultSettings = [
},
{
settingKey: 'system_description',
settingValue: JSON.stringify('机柜管理系统 - 专业的数据中心设备管理解决方案'),
settingValue: JSON.stringify('云睿资产管理系统 - 专业的数据中心设备管理解决方案'),
settingType: 'string',
category: 'about',
description: '系统描述',
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* IDC管理系统 - 数据库迁移汇总脚本
* 云睿资产管理系统 - 数据库迁移汇总脚本
* 按顺序执行所有数据库迁移
* 支持幂等执行(重复执行不会出错)
* 支持 SQLite 和 MySQL
@@ -142,7 +142,7 @@ const migrations = [
async function runMigrations() {
console.log('========================================');
console.log(' IDC管理系统 - 数据库迁移汇总脚本 ');
console.log(' 云睿资产管理系统 - 数据库迁移汇总脚本 ');
console.log('========================================');
console.log(`数据库类型: ${DB_TYPE}`);
console.log(`迁移数量: ${migrations.length}`);
+1 -1
View File
@@ -72,7 +72,7 @@ if (!options.file) {
async function runRestore() {
console.log('========================================');
console.log(' IDC设备管理系统 - 数据恢复工具');
console.log(' 云睿资产管理系统 - 数据恢复工具');
console.log('========================================\n');
const backupFile = path.resolve(options.file);
+2 -2
View File
@@ -1,9 +1,9 @@
/**
* 示例数据种子脚本
* IDC 设备资产管理系统写入演示数据幂等可重复执行
* 云睿资产管理系统写入演示数据幂等可重复执行
*
* 本地node scripts/seed-example-data.js
* Dockerdocker exec idc_assest-backend node scripts/seed-example-data.js
* Dockerdocker exec yunrui_asset-backend node scripts/seed-example-data.js
*/
require('dotenv').config({ path: require('path').join(__dirname, '..', '.env') });
+2 -2
View File
@@ -336,7 +336,7 @@ app.use(
swaggerUi.serve,
swaggerUi.setup(specs, {
customCss: customCSS,
customSiteTitle: 'IDC设备管理系统 API文档',
customSiteTitle: '云睿资产管理系统 API文档',
swaggerOptions: {
persistAuthorization: true,
displayRequestDuration: true,
@@ -358,7 +358,7 @@ app.get('/api-docs.json', (req, res) => {
app.get('/api', (req, res) => {
res.json({
name: 'IDC设备管理系统 API',
name: '云睿资产管理系统 API',
version: '1.0.0',
description: '数据中心设备管理平台后端服务',
endpoints: {
+2 -2
View File
@@ -2,7 +2,7 @@ const swaggerJsdoc = require('swagger-jsdoc');
const customCSS = `
/* ========================================
IDC设备管理系统 - Swagger UI 翠竹绿风格定制
云睿资产管理系统 - Swagger UI 翠竹绿风格定制
======================================== */
/* 隐藏默认顶部栏 */
@@ -511,7 +511,7 @@ const options = {
definition: {
openapi: '3.0.0',
info: {
title: 'IDC设备管理系统 API',
title: '云睿资产管理系统 API',
version: '1.0.0',
description: '数据中心设备管理平台后端服务 API 文档',
contact: {
+3 -3
View File
@@ -1,9 +1,9 @@
openapi: 3.0.0
info:
title: IDC设备管理系统 API
title: 云睿资产管理系统 API
version: 1.0.0
description: |
IDC设备管理系统后端API文档
云睿资产管理系统后端API文档
## 认证说明
除健康检查接口外,所有接口都需要在请求头中携带JWT Token:
@@ -107,7 +107,7 @@ paths:
example: ok
message:
type: string
example: IDC设备管理系统后端服务正常运行
example: 云睿资产管理系统后端服务正常运行
/api-docs:
get:
+1 -1
View File
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IDC设备管理系统 API文档</title>
<title>云睿资产管理系统 API文档</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.10.5/swagger-ui.css">
<style>
.swagger-ui .topbar { display: none }
+1 -1
View File
@@ -150,7 +150,7 @@ const performHealthCheck = async () => {
status: overallStatus,
timestamp: new Date().toISOString(),
service: {
name: 'IDC设备管理系统',
name: '云睿资产管理系统',
version: '1.0.0',
},
checks: allChecks,
+2 -2
View File
@@ -110,7 +110,7 @@ async function uploadViaWebDAV(config, localFilePath, remotePath) {
password: config.password,
authType: config.authType || 'password',
headers: {
'User-Agent': 'IDC-Backup-Client/1.0',
'User-Agent': 'YunRui-Backup-Client/1.0',
},
});
@@ -262,7 +262,7 @@ async function testRemoteConnection(config) {
console.log(`测试远端连接 [${config.protocol}]...`);
try {
const testContent = `IDC Backup Connection Test - ${new Date().toISOString()}`;
const testContent = `YunRui Backup Connection Test - ${new Date().toISOString()}`;
const testFile = path.join(require('os').tmpdir(), `backup-test-${Date.now()}.txt`);
fs.writeFileSync(testFile, testContent);
+10 -10
View File
@@ -1,5 +1,5 @@
# ============================================
# IDC 设备管理系统 - 开发环境配置
# 云睿资产管理系统 - 开发环境配置
# 使用 build 指令本地构建镜像
# ============================================
@@ -11,7 +11,7 @@ services:
build:
context: ./backend
dockerfile: Dockerfile
container_name: idc-backend-dev
container_name: yunrui_asset-backend-dev
volumes:
# 配置映射(核心)
- ./backend/.env:/app/.env
@@ -27,7 +27,7 @@ services:
# 连接 docker-compose 内的 MySQL 时,注释掉下方 MYSQL_HOST 的注释
# 连接远程 MySQL 时,保持 .env 中的配置即可
networks:
- idc-network
- yunrui_asset-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8000/health"]
@@ -41,11 +41,11 @@ services:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: idc-frontend-dev
container_name: yunrui_asset-frontend-dev
ports:
- "80:80"
networks:
- idc-network
- yunrui_asset-network
depends_on:
- backend
restart: unless-stopped
@@ -54,18 +54,18 @@ services:
# 如需使用本地 MySQL 容器,取消下方注释
# mysql:
# image: mysql:8.0
# container_name: idc-mysql-dev
# container_name: yunrui_asset-mysql-dev
# volumes:
# - mysql_data:/var/lib/mysql
# environment:
# MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root123}
# MYSQL_DATABASE: idc_management
# MYSQL_USER: idc_user
# MYSQL_DATABASE: yunrui_management
# MYSQL_USER: yunrui_user
# MYSQL_PASSWORD: ${MYSQL_PASSWORD:-idc_pass}
# ports:
# - "3306:3306"
# networks:
# - idc-network
# - yunrui_asset-network
# restart: unless-stopped
# healthcheck:
# test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
@@ -74,7 +74,7 @@ services:
# retries: 5
networks:
idc-network:
yunrui_asset-network:
driver: bridge
# volumes:
+11 -11
View File
@@ -4,23 +4,23 @@ services:
# ---------- MySQL 数据库 ----------
mysql:
image: mysql:8.0
container_name: idc_assest-mysql
container_name: yunrui_asset-mysql
volumes:
- idc_assest-mysql-data:/var/lib/mysql
- yunrui_asset-mysql-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-xinmi_password}
MYSQL_DATABASE: ${MYSQL_DATABASE:-idc_management}
MYSQL_DATABASE: ${MYSQL_DATABASE:-yunrui_management}
ports:
- "${MYSQL_PORT:-12006}:3306"
networks:
- idc_assest-network
- yunrui_asset-network
# ---------- 后端服务 ----------
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: idc_assest-backend
container_name: yunrui_asset-backend
volumes:
- ./backend/uploads:/app/uploads
- ./backend/logs:/app/logs
@@ -31,7 +31,7 @@ services:
- DB_TYPE=mysql
- MYSQL_HOST=mysql
- MYSQL_PORT=3306
- MYSQL_DATABASE=${MYSQL_DATABASE:-idc_management}
- MYSQL_DATABASE=${MYSQL_DATABASE:-yunrui_management}
- MYSQL_USERNAME=root
- MYSQL_PASSWORD=${MYSQL_ROOT_PASSWORD:-xinmi_password}
- JWT_SECRET=${JWT_SECRET}
@@ -41,24 +41,24 @@ services:
depends_on:
- mysql
networks:
- idc_assest-network
- yunrui_asset-network
# ---------- 前端服务 ----------
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: idc_assest-frontend
container_name: yunrui_asset-frontend
ports:
- "${FRONTEND_PORT:-12000}:80"
depends_on:
- backend
networks:
- idc_assest-network
- yunrui_asset-network
volumes:
idc_assest-mysql-data:
yunrui_asset-mysql-data:
networks:
idc_assest-network:
yunrui_asset-network:
driver: bridge
+12 -12
View File
@@ -1,5 +1,5 @@
# ============================================
# IDC 设备管理系统 - 生产环境配置
# 云睿资产管理系统 - 生产环境配置
# 从镜像仓库拉取预构建镜像,无 build 指令
# 默认从 ghcr.io 拉取,可通过 BACKEND/FRONTEND_IMAGE 环境变量切换
# ============================================
@@ -10,8 +10,8 @@ services:
# ---------- 后端服务 ----------
backend:
# 从 ghcr.io 拉取公开镜像,可通过 BACKEND_IMAGE 环境变量覆盖
image: ${BACKEND_IMAGE:-ghcr.io/gituib/idc-backend:latest}
container_name: idc-backend
image: ${BACKEND_IMAGE:-ghcr.io/xinmi/yunrui_asset-backend:latest}
container_name: yunrui_asset-backend
volumes:
# 配置映射(核心)
- ./backend/.env:/app/.env
@@ -27,7 +27,7 @@ services:
# 生产环境使用 Docker 内 MySQL 时,MYSQL_HOST 需设为 mysql
# 使用远程 MySQL 时,保持 .env 中的配置
networks:
- idc-network
- yunrui_asset-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8000/health"]
@@ -39,13 +39,13 @@ services:
# ---------- 前端(Nginx)服务 ----------
frontend:
# 从 ghcr.io 拉取公开镜像,可通过 FRONTEND_IMAGE 环境变量覆盖
image: ${FRONTEND_IMAGE:-ghcr.io/gituib/idc-frontend:latest}
image: ${FRONTEND_IMAGE:-ghcr.io/xinmi/yunrui_asset-frontend:latest}
pull_policy: always
container_name: idc-frontend
container_name: yunrui_asset-frontend
ports:
- "80:80"
networks:
- idc-network
- yunrui_asset-network
depends_on:
- backend
restart: unless-stopped
@@ -54,16 +54,16 @@ services:
# 如需使用本地 MySQL 容器,取消下方注释
# mysql:
# image: mysql:8.0
# container_name: idc-mysql
# container_name: yunrui_asset-mysql
# volumes:
# - mysql_data:/var/lib/mysql
# environment:
# MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
# MYSQL_DATABASE: ${MYSQL_DATABASE:-idc_management}
# MYSQL_USER: ${MYSQL_USER:-idc_user}
# MYSQL_DATABASE: ${MYSQL_DATABASE:-yunrui_management}
# MYSQL_USER: ${MYSQL_USER:-yunrui_user}
# MYSQL_PASSWORD: ${MYSQL_PASSWORD}
# networks:
# - idc-network
# - yunrui_asset-network
# restart: unless-stopped
# healthcheck:
# test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
@@ -72,7 +72,7 @@ services:
# retries: 5
networks:
idc-network:
yunrui_asset-network:
driver: bridge
# volumes:
+6 -6
View File
@@ -4,20 +4,20 @@ services:
# MySQL 数据库 (可选,默认为 SQLite)
mysql:
image: mysql:8.0
container_name: idc_assest-mysql
container_name: yunrui_assetet-mysql
volumes:
- idc_assest-mysql-data:/var/lib/mysql
- yunrui_assetet-mysql-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-xinmi_password}
MYSQL_DATABASE: ${MYSQL_DATABASE:-idc_management}
MYSQL_DATABASE: ${MYSQL_DATABASE:-yunrui_management}
ports:
- "${MYSQL_PORT:-12006}:3306"
networks:
- idc_assest-network
- yunrui_assetet-network
volumes:
idc_assest-mysql-data:
yunrui_assetet-mysql-data:
networks:
idc_assest-network:
yunrui_assetet-network:
driver: bridge
+4 -5
View File
@@ -1,4 +1,4 @@
# IDC设备资产系统 - 用户使用指南
# 云睿资产系统 - 用户使用指南
## 目录
@@ -24,7 +24,7 @@
### 系统简介
IDC设备资产系统是一款现代化的数据中心(IDC)设备管理平台,提供机房、机柜、设备的全生命周期管理,具备3D可视化展示功能。系统采用前后端分离架构,前端基于React + Ant Design构建,后端使用Node.js + Express开发。
云睿资产系统是一款现代化的数据中心(IDC)设备管理平台,提供机房、机柜、设备的全生命周期管理,具备3D可视化展示功能。系统采用前后端分离架构,前端基于React + Ant Design构建,后端使用Node.js + Express开发。
### 核心功能
@@ -929,9 +929,8 @@ A: 已关闭的工单无法重新打开,如有新问题请新建工单。
- **功能建议**:提交 Issue 并标注 `feature-request`
**代码仓库:**
- Gitee: https://gitee.com/zhang96110/idc_assest
- GitHub: https://github.com/gituib/idc_assest
- 源码仓库: https://code.xinmi.cloud/yunruyunrui_asset
yunrui_asset
---
**文档版本**v2.0.0
+4 -4
View File
@@ -1,6 +1,6 @@
# API接口文档
本文档描述IDC设备管理系统的后端API接口,遵循RESTful设计规范。
本文档描述云睿资产管理系统的后端API接口,遵循RESTful设计规范。
---
@@ -1861,10 +1861,10 @@ GET /api/system-settings
{
"success": true,
"data": {
"siteName": "IDC设备管理系统",
"siteName": "云睿资产管理系统",
"siteLogo": "/uploads/logo.png",
"siteDescription": "专业的数据中心设备管理平台",
"copyright": "© 2024 IDC Management",
"copyright": "© 2024 YunRui Asset Management",
"version": "1.0.0"
},
"message": "操作成功"
@@ -2150,7 +2150,7 @@ GET /health
```json
{
"status": "ok",
"message": "IDC设备管理系统后端服务正常运行"
"message": "云睿资产管理系统后端服务正常运行"
}
```
+50 -50
View File
@@ -1,4 +1,4 @@
# IDC 设备管理系统 - Docker 部署教程
# 云睿资产管理系统 - Docker 部署教程
> 适用场景:新服务器上首次部署
>
@@ -84,17 +84,17 @@ docker compose version
```bash
# 创建部署根目录和所有持久化目录
mkdir -p /opt/idc_assest/backend/{uploads,logs,backups,temp}
cd /opt/idc_assest
mkdir -p /opt/yunrui_assetet/backend/{uploads,logs,backups,temp}
cd /opt/yunrui_assetet
# 查看目录结构
tree /opt/idc_assest -L 2
tree /opt/yunrui_assetet -L 2
```
预期输出:
```
/opt/idc_assest
/opt/yunrui_assetet
└── backend
├── uploads/
├── logs/
@@ -105,9 +105,9 @@ tree /opt/idc_assest -L 2
### 3.2 创建 docker-compose.yml
```bash
cat > /opt/idc_assest/docker-compose.yml << 'YAMLEOF'
cat > /opt/yunrui_assetet/docker-compose.yml << 'YAMLEOF'
# ============================================
# IDC 设备管理系统 - 生产环境配置
# 云睿资产管理系统 - 生产环境配置
# 从镜像仓库拉取预构建镜像,无 build 指令
# 默认从 ghcr.io 拉取,可通过 BACKEND/FRONTEND_IMAGE 环境变量切换
# ============================================
@@ -115,8 +115,8 @@ cat > /opt/idc_assest/docker-compose.yml << 'YAMLEOF'
services:
# ---------- 后端服务 ----------
backend:
image: ${BACKEND_IMAGE:-ghcr.io/gituib/idc-backend:latest}
container_name: idc-backend
image: ${BACKEND_IMAGE:-ghcr.io/xinmi/yunrui_asset-backend:latest}
container_name: yunrui_asset-backend
volumes:
- ./backend/.env:/app/.env
- ./backend/uploads:/app/uploads
@@ -128,7 +128,7 @@ services:
environment:
- NODE_ENV=production
networks:
- idc-network
- yunrui_asset-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8000/health"]
@@ -139,13 +139,13 @@ services:
# ---------- 前端(Nginx)服务 ----------
frontend:
image: ${FRONTEND_IMAGE:-ghcr.io/gituib/idc-frontend:latest}
image: ${FRONTEND_IMAGE:-ghcr.io/xinmi/yunrui_asset-frontend:latest}
pull_policy: always
container_name: idc-frontend
container_name: yunrui_asset-frontend
ports:
- "80:80"
networks:
- idc-network
- yunrui_asset-network
depends_on:
- backend
restart: unless-stopped
@@ -153,16 +153,16 @@ services:
# ---------- MySQL 数据库 ----------
mysql:
image: mysql:8.0
container_name: idc-mysql
container_name: yunrui_asset-mysql
volumes:
- mysql_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE:-idc_management}
MYSQL_USER: ${MYSQL_USER:-idc_user}
MYSQL_DATABASE: ${MYSQL_DATABASE:-yunrui_management}
MYSQL_USER: ${MYSQL_USER:-yunrui_user}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
networks:
- idc-network
- yunrui_asset-network
restart: unless-stopped
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
@@ -171,7 +171,7 @@ services:
retries: 5
networks:
idc-network:
yunrui_asset-network:
driver: bridge
volumes:
@@ -186,12 +186,12 @@ YAMLEOF
> 这个文件是给 Docker Compose 读取的,用于配置 MySQL 容器本身的账号密码。
```bash
cd /opt/idc_assest
cd /opt/yunrui_assetet
cat > .env << 'EOF'
MYSQL_ROOT_PASSWORD=这里填MySQL root密码
MYSQL_USER=idc_user
MYSQL_USER=yunrui_user
MYSQL_PASSWORD=这里填MySQL用户密码(与 backend/.env 中 MYSQL_PASSWORD 一致)
MYSQL_DATABASE=idc_management
MYSQL_DATABASE=yunrui_management
EOF
```
@@ -200,7 +200,7 @@ EOF
> **重要**:这个文件是后端 Node.js 应用读取的,配置数据库连接、JWT 等业务参数。不要与项目根目录的 `.env` 混淆。
```bash
cd /opt/idc_assest/backend
cd /opt/yunrui_assetet/backend
# 先生成 JWT 密钥(确保已执行 4.1 节的命令)
# JWT_SECRET=$(openssl rand -base64 64)
@@ -220,9 +220,9 @@ NODE_ENV=production
DB_TYPE=mysql
MYSQL_HOST=mysql # Docker 服务名,不是 localhost
MYSQL_PORT=3306
MYSQL_USERNAME=idc_user
MYSQL_USERNAME=yunrui_user
MYSQL_PASSWORD=这里改成MySQL用户密码
MYSQL_DATABASE=idc_management
MYSQL_DATABASE=yunrui_management
# 方式二:使用远程 MySQL(已有数据库的情况)
# DB_TYPE=mysql
@@ -267,7 +267,7 @@ EOF
创建完成后,部署目录的文件结构应为:
```
/opt/idc_assest/
/opt/yunrui_assetet/
├── docker-compose.yml # Docker Compose 配置
├── .env # Docker Compose 环境变量(MySQL 账号密码)
└── backend/
@@ -302,28 +302,28 @@ JWT_SECRET=$(openssl rand -base64 64)
| 配置项 | 文件位置 | 说明 |
| ------------------------- | ------------------------------ | ----------------- |
| `MYSQL_USER=idc_user` | `/opt/idc_assest/.env` | 指定 MySQL 容器创建的用户名 |
| `MYSQL_USERNAME=idc_user` | `/opt/idc_assest/backend/.env` | 后端连接数据库用的用户名 |
| `MYSQL_USER=yunrui_user` | `/oyunrui_assetasset/.env` | 指定 MySQL 容器创建的用户名 |
| `MYSQL_USERNAME=yunrui_user` | `/oyunrui_assetasset/backend/.env` | 后端连接数据库用的用户名 |
| `MYSQL_PASSWORD=xxx` | 两个文件各有一处 | 密码必须相同 |
可以用以下命令快速对比两个文件中的用户和密码是否一致:
```bash
cd /opt/idc_assest
cd /opt/yunrui_assetet
echo "=== 根目录 .env ===" && grep -E "MYSQL_USER|MYSQL_PASSWORD" .env
echo ""
echo "=== backend/.env ===" && grep -E "MYSQL_USERNAME|MYSQL_PASSWORD" backend/.env
```
预期输出(用户名为 `idc_user`,密码两处相同即表示一致):
预期输出(用户名为 `yunrui_user`,密码两处相同即表示一致):
```
=== 根目录 .env ===
MYSQL_USER=idc_user
MYSQL_USER=yunrui_user
MYSQL_PASSWORD=MyPassw0rd!
=== backend/.env ===
MYSQL_USERNAME=idc_user
MYSQL_USERNAME=yunrui_user
MYSQL_PASSWORD=MyPassw0rd!
```
@@ -331,14 +331,14 @@ MYSQL_PASSWORD=MyPassw0rd!
> 如果已有远程 MySQL 实例,不想在 Docker 中运行 MySQL 容器,请执行以下操作:
**步骤 1**:编辑 `/opt/idc_assest/docker-compose.yml`,注释掉 `mysql` 服务部分:
**步骤 1**:编辑 `/opt/yunrui_assetet/docker-compose.yml`,注释掉 `mysql` 服务部分:
```bash
# 用 sed 注释 mysql 服务(从 services: 末尾到文件末尾)
# 或者手动编辑,将 mysql: 到文件末尾的内容用 # 注释掉
```
**步骤 2**:修改 `/opt/idc_assest/backend/.env`,配置远程数据库地址:
**步骤 2**:修改 `/opt/yunrui_assetet/backend/.env`,配置远程数据库地址:
```ini
DB_TYPE=mysql
@@ -356,7 +356,7 @@ MYSQL_DATABASE=数据库名
### 5.1 首次拉取镜像
```bash
cd /opt/idc_assest
cd /opt/yunrui_assetet
docker compose -f docker-compose.yml pull
```
@@ -376,9 +376,9 @@ docker compose -f docker-compose.yml ps
docker compose -f docker-compose.yml logs -f
# 单独查看某个容器的日志
docker logs idc-backend
docker logs idc-frontend
docker logs idc-mysql
docker logs yunrui_asset-backend
docker logs yunrui_asset-frontend
docker logs yunrui_asset-mysql
```
### 5.4 等待初始化完成
@@ -392,7 +392,7 @@ docker logs idc-mysql
可以通过日志查看初始化进度:
```bash
docker logs -f idc-backend
docker logs -f yunrui_asset-backend
```
当日志出现以下内容时,说明启动完成:
@@ -416,9 +416,9 @@ docker compose -f docker-compose.yml ps
```
NAME IMAGE STATUS PORTS
idc-frontend ghcr.io/.../idc-frontend:latest Up :80->80/tcp
idc-backend ghcr.io/.../idc-backend:latest Up (healthy) 8000/tcp
idc-mysql mysql:8.0 Up 3306/tcp
yunrui_asset-frontend ghcr.io/.../yunrui_asset-frontend:latest Up :80->80/tcp
yunrui_asset-backend ghcr.io/.../yunrui_asset-backend:latest Up (healthy) 8000/tcp
yunrui_asset-mysql mysql:8.0 Up 3306/tcp
```
### 6.2 访问系统
@@ -472,7 +472,7 @@ docker compose -f docker-compose.yml down -v
```bash
# MySQL 本地容器方式
docker exec idc-mysql mysqldump -u root -p idc_management > backup_$(date +%Y%m%d).sql
docker exec yunrui_asset-mysql mysqldump -u root -p yunrui_management > backup_$(date +%Y%m%d).sql
# 如果开启了自动备份,后端自身也会定期备份到 backend/backups/ 目录
```
@@ -480,7 +480,7 @@ docker exec idc-mysql mysqldump -u root -p idc_management > backup_$(date +%Y%m%
### 7.3 查看容器资源占用
```bash
docker stats idc-backend idc-frontend idc-mysql
docker stats yunrui_asset-backend yunrui_asset-frontend yunrui_asset-mysql
```
### 7.4 更新服务配置
@@ -522,7 +522,7 @@ docker image prune -a
```bash
# 查看退出容器的日志
docker logs idc-backend
docker logs yunrui_asset-backend
# 常见错误:
# - JWT_SECRET 未配置 → 在 backend/.env 中设置 JWT_SECRET
@@ -560,8 +560,8 @@ ping ghcr.io
检查 `backend/uploads/` 目录是否存在且权限正确:
```bash
ls -la /opt/idc_assest/backend/uploads/
chmod 755 /opt/idc_assest/backend/uploads/
ls -la /opt/yunrui_assetet/backend/uploads/
chmod 755 /opt/yunrui_assetet/backend/uploads/
```
### 9.6 后端连不上 MySQL 容器
@@ -570,10 +570,10 @@ chmod 755 /opt/idc_assest/backend/uploads/
```bash
# 1. 检查 MySQL 容器状态
docker ps | grep idc-mysql
docker ps | grep yunrui_asset-mysql
# 2. 检查 backend/.env 中 MYSQL_HOST 是否是 mysql(服务名),不是 localhost
grep MYSQL_HOST /opt/idc_assest/backend/.env
grep MYSQL_HOST /opt/yunrui_assetet/backend/.env
# 3. 验证 MySQL 用户密码是否一致
# backend/.env 中 MYSQL_USERNAME / MYSQL_PASSWORD
@@ -581,7 +581,7 @@ grep MYSQL_HOST /opt/idc_assest/backend/.env
# 两者必须匹配
# 4. 进入 MySQL 容器验证
docker exec -it idc-mysql mysql -u idc_user -p
docker exec -it yunrui_asset-mysql mysql -u yunrui_user -p
```
### 9.7 如何在已有部署基础上添加新配置
@@ -590,7 +590,7 @@ docker exec -it idc-mysql mysql -u idc_user -p
```bash
# 1. 编辑 backend/.env 补充配置
vim /opt/idc_assest/backend/.env
vim /opt/yunrui_assetet/backend/.env
# 2. 重启后端容器
docker compose -f docker-compose.yml restart backend
+7 -7
View File
@@ -52,8 +52,8 @@
GitHub Actions
├── 构建 idc-backend:latest 镜像
├── 构建 idc-frontend:latest 镜像(Nginx + 前端静态文件)
├── 构建 yunrui_asset-backend:latest 镜像
├── 构建 yunrui_asset-frontend:latest 镜像(Nginx + 前端静态文件)
├── 推送到镜像仓库(Docker Hub / 阿里云 / GitHub Container Registry
@@ -74,11 +74,11 @@
```yaml
services:
backend:
image: yourname/idc-backend:latest
image: yourname/yunrui_asset-backend:latest
# 没有 build 指令,直接从仓库拉取
frontend:
image: yourname/idc-frontend:latest
image: yourname/yunrui_asset-frontend:latest
# 同上,服务器不需要装 Node.js
mysql:
@@ -134,8 +134,8 @@ BACKEND_VERSION=v1.2.0 FRONTEND_VERSION=v1.2.0 docker compose up -d
### 5.1 镜像仓库:阿里云容器镜像服务
阿里云控制台开通容器镜像服务后:
1. 创建命名空间(如 `idc-assest`
2. 创建镜像仓库:`idc-backend``idc-frontend`
1. 创建命名空间(如 `yunrui-asset`
2. 创建镜像仓库:`yunrui_asset-backend``yunrui_asset-frontend`
3. 设置访问凭证(用户名 + 密码)
### 5.2 GitHub Secrets 配置
@@ -171,7 +171,7 @@ BACKEND_VERSION=v1.2.0 FRONTEND_VERSION=v1.2.0 docker compose up -d
管理员 SSH 到生产服务器
cd /opt/idc_assest
cd /opt/yunrui_assetet
docker compose -f docker-compose.prod.yml pull
docker compose -f docker-compose.prod.yml up -d
```
+1 -1
View File
@@ -1,5 +1,5 @@
# ============================================
# IDC 设备管理系统 - 前端(NginxDockerfile
# 云睿资产管理系统 - 前端(NginxDockerfile
# 第一阶段:构建前端静态文件
# 第二阶段:Nginx 运行
# ============================================
+1 -1
View File
@@ -1,5 +1,5 @@
# ============================================
# IDC 设备管理系统 - Nginx 配置
# 云睿资产管理系统 - Nginx 配置
# 功能:serve 前端静态文件 + 反向代理 API
# ============================================
+2 -2
View File
@@ -1,11 +1,11 @@
{
"name": "idc-frontend",
"name": "yunrui-frontend",
"version": "2.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "idc-frontend",
"name": "yunrui-frontend",
"version": "2.1.0",
"dependencies": {
"@ant-design/icons": "^6.1.0",
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "idc-frontend",
"name": "yunrui_asset-frontend",
"version": "2.1.1",
"description": "IDC设备管理系统前端",
"description": "云睿资产管理系统前端",
"scripts": {
"start": "vite",
"dev": "vite",
+1 -1
View File
@@ -495,7 +495,7 @@ const AppLayout = ({ children }) => {
{!collapsed && (
<div style={{ padding: '0 8px 8px 8px' }}>
<a
href="http://www.xinmi.cloud/"
href="https://code.xinmi.cloud/yunrui_asset"
target="_blank"
rel="noopener noreferrer"
style={{
+1 -1
View File
@@ -119,7 +119,7 @@ const About = () => {
type="primary"
block
icon={<LinkOutlined />}
href="http://www.xinmi.cloud/"
href="https://code.xinmi.cloud/yunrui_asset"
target="_blank"
>
访问新觅源码库
+1 -1
View File
@@ -1,6 +1,6 @@
/* ============================================
Login Page - Light Corporate Design
Design System: IDC Data Center Management
Design System: YunRui Asset Management
Style: Clean Modern Corporate + Data Center Viz
Palette: Teal (#14b8a6) / Blue (#3b82f6) / Purple (#8b5cf6)
============================================ */
+1 -1
View File
@@ -458,7 +458,7 @@ const SystemSettings = () => {
</Col>
<Col xs={24} sm={18} md={19}>
<Title level={3} style={{ color: '#fff', margin: 0, marginBottom: 6, fontSize: '22px' }}>
机柜管理系统
云睿资产管理系统
</Title>
<Space size={12} wrap style={{ color: 'rgba(255,255,255,0.9)' }}>
<span style={{ fontSize: 14 }}>版本 {settings.app_version?.value || '1.0.0'}</span>
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
* IDC设备管理系统 - 安装部署脚本入口
* 云睿资产管理系统 - 安装部署脚本入口
*
* 实际逻辑已拆分到 install/ 目录下的各个模块
* 此文件仅作为入口加载并执行 install/index.js
+3 -3
View File
@@ -1,7 +1,7 @@
#!/bin/bash
# ============================================================================
# IDC设备管理系统 - Linux 安装引导脚本
# 云睿资产管理系统 - Linux 安装引导脚本
# ============================================================================
#
# 功能:检测并安装 Node.js,然后运行 install.js
@@ -58,7 +58,7 @@ show_banner() {
echo -e ""
echo -e " ${CYAN}${line}${RESET}"
echo -e " ${CYAN}${BRIGHT}${WHITE} IDC 设备管理系统 - Linux 安装引导脚本 ${CYAN}${RESET}"
echo -e " ${CYAN}${BRIGHT}${WHITE} 云睿资产管理系统 - Linux 安装引导脚本 ${CYAN}${RESET}"
echo -e " ${CYAN}${DIM} Linux Bootstrap Installation Script ${CYAN}${RESET}"
echo -e " ${CYAN}║ v${SCRIPT_VERSION} ${CYAN}${RESET}"
echo -e " ${CYAN}${line}${RESET}"
@@ -237,7 +237,7 @@ show_manual_install_guide() {
echo -e " ${PIPE} ${CYAN}node -v${RESET} # 应显示 v20.x.x"
echo -e " ${PIPE} ${CYAN}npm -v${RESET} # 应显示 10.x.x"
log_divider
log_info "安装完成后,请重新运行此脚本继续安装 IDC 设备管理系统"
log_info "安装完成后,请重新运行此脚本继续安装 云睿资产管理系统"
}
check_and_install_dependencies() {
+1 -1
View File
@@ -81,7 +81,7 @@ function parseArgs() {
function showHelp() {
console.log(`
${colors.bright}IDC设备管理系统 - 安装部署脚本 v${SCRIPT_VERSION}${colors.reset}
${colors.bright}云睿资产管理系统 - 安装部署脚本 v${SCRIPT_VERSION}${colors.reset}
用法: node install.js [选项]
+10 -10
View File
@@ -29,7 +29,7 @@ async function configureDatabase(cmdArgs) {
config.dbConfig.port = process.env.MYSQL_PORT || '3306';
config.dbConfig.username = process.env.MYSQL_USER || 'root';
config.dbConfig.password = process.env.MYSQL_PASSWORD || '';
config.dbConfig.database = process.env.MYSQL_DATABASE || 'idc_management';
config.dbConfig.database = process.env.MYSQL_DATABASE || 'yunrui_management';
log.info(`MySQL 配置: ${config.dbConfig.host}:${config.dbConfig.port}/${config.dbConfig.database}`);
} else {
const mysqlOption = await select('MySQL 配置方式:', [
@@ -74,13 +74,13 @@ async function configureDatabase(cmdArgs) {
async function configureExistingMySQL() {
console.log('\n' + colors.yellow + '请确保 MySQL 服务已启动并创建了数据库' + colors.reset);
console.log(colors.gray + '创建数据库命令: CREATE DATABASE idc_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;' + colors.reset + '\n');
console.log(colors.gray + '创建数据库命令: CREATE DATABASE yunrui_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;' + colors.reset + '\n');
config.dbConfig.host = await ask('MySQL 主机地址', config.dbConfig.host || 'localhost');
config.dbConfig.port = await ask('MySQL 端口', config.dbConfig.port || '3306');
config.dbConfig.username = await ask('MySQL 用户名', config.dbConfig.username || 'root');
config.dbConfig.password = await askPassword('MySQL 密码');
config.dbConfig.database = await ask('数据库名称', config.dbConfig.database || 'idc_management');
config.dbConfig.database = await ask('数据库名称', config.dbConfig.database || 'yunrui_management');
}
async function installMySQL() {
@@ -94,7 +94,7 @@ async function installMySQL() {
console.log(' 1. 下载 MySQL: https://dev.mysql.com/downloads/mysql/');
console.log(' 2. 或使用 XAMPP/WAMP 等集成环境');
console.log(' 3. 安装后创建数据库:');
console.log(colors.gray + ' CREATE DATABASE idc_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;' + colors.reset);
console.log(colors.gray + ' CREATE DATABASE yunrui_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;' + colors.reset);
return { success: false };
}
@@ -135,7 +135,7 @@ async function installMySQL() {
config.dbConfig.port = '3306';
config.dbConfig.username = 'root';
config.dbConfig.password = mysqlRootPassword;
config.dbConfig.database = 'idc_management';
config.dbConfig.database = 'yunrui_management';
log.subStep('创建数据库...');
await createMySQLDatabase(mysqlRootPassword);
@@ -148,7 +148,7 @@ async function installMySQL() {
port: '3306',
username: 'root',
password: mysqlRootPassword,
database: 'idc_management'
database: 'yunrui_management'
}
};
} catch (error) {
@@ -191,14 +191,14 @@ async function installMySQLRHEL(rootPassword) {
async function createMySQLDatabase(rootPassword) {
log.subStep('创建数据库...');
const createDbSql = 'CREATE DATABASE IF NOT EXISTS idc_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;';
const createDbSql = 'CREATE DATABASE IF NOT EXISTS yunrui_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;';
try {
execSync(`mysql -u root -p'${rootPassword}' -e "${createDbSql}"`, {
shell: '/bin/bash',
stdio: ['pipe', 'pipe', 'pipe']
});
log.success('数据库 idc_management 创建成功');
log.success('数据库 yunrui_management 创建成功');
return;
} catch (error) {
const errorMsg = error.stderr ? error.stderr.toString() : error.message;
@@ -210,7 +210,7 @@ async function createMySQLDatabase(rootPassword) {
shell: '/bin/bash',
stdio: ['pipe', 'pipe', 'pipe']
});
log.success('数据库 idc_management 创建成功');
log.success('数据库 yunrui_management 创建成功');
return;
} catch (e2) {
log.warning(`无密码连接也失败: ${e2.message}`);
@@ -220,7 +220,7 @@ async function createMySQLDatabase(rootPassword) {
log.warning(`数据库自动创建失败: ${errorMsg.trim()}`);
log.info('请手动创建数据库:');
console.log(colors.cyan + ' mysql -u root -p' + colors.reset);
console.log(colors.cyan + ' CREATE DATABASE idc_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;' + colors.reset);
console.log(colors.cyan + ' CREATE DATABASE yunrui_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;' + colors.reset);
}
}
+8 -8
View File
@@ -11,7 +11,7 @@ function generateBackendEnv() {
try {
const jwtSecret = generateSecretKey(64);
let envContent = `# IDC设备管理系统 - 环境配置
let envContent = `# 云睿资产管理系统 - 环境配置
# 生成时间: ${new Date().toISOString()}
# ==============================================
@@ -42,7 +42,7 @@ DB_TYPE=${config.dbType}
if (config.dbType === 'sqlite') {
envContent += `
# SQLite 配置
DB_PATH=./idc_management.db
DB_PATH=./yunrui_management.db
`;
} else {
envContent += `
@@ -85,7 +85,7 @@ function generatePM2Config() {
const pm2Config = {
apps: [{
name: 'idc-backend',
name: 'yunrui_asset-backend',
script: './server.js',
cwd: path.join(__dirname, '..', 'backend'),
instances: 1,
@@ -106,7 +106,7 @@ function generatePM2Config() {
if (config.frontendDeploy === 'pm2') {
pm2Config.apps.push({
name: 'idc-frontend',
name: 'yunrui_asset-frontend',
script: 'serve',
cwd: path.join(__dirname, '..', 'frontend'),
args: `-s dist -l ${config.frontendPort}`,
@@ -145,12 +145,12 @@ function generateNginxConfig() {
if (isWindows) {
frontendPath = path.join(__dirname, '..', 'frontend', 'dist').replace(/\\/g, '/');
} else {
frontendPath = '/var/www/idc';
frontendPath = '/var/www/yunrui_asset';
}
config.nginxRoot = frontendPath;
const nginxConfig = `# IDC设备管理系统 - Nginx配置
const nginxConfig = `# 云睿资产管理系统 - Nginx配置
# 生成时间: ${new Date().toISOString()}
server {
@@ -210,8 +210,8 @@ server {
}
`;
fs.writeFileSync(path.join(deployDir, 'nginx-idc.conf'), nginxConfig);
log.success('Nginx 配置文件已生成 (deploy/nginx-idc.conf)');
fs.writeFileSync(path.join(deployDir, 'nginx-yunrui.conf'), nginxConfig);
log.success('Nginx 配置文件已生成 (deploy/nginx-yunrui.conf)');
if (isWindows) {
log.info('Windows Nginx 配置路径示例:');
+4 -4
View File
@@ -35,9 +35,9 @@ function printSummary() {
log.section('服务管理命令');
console.log(` ${ICONS.pipe} ${colors.cyan}pm2 status${colors.reset} 查看服务状态`);
console.log(` ${ICONS.pipe} ${colors.cyan}pm2 logs idc-backend${colors.reset} 查看后端日志`);
console.log(` ${ICONS.pipe} ${colors.cyan}pm2 restart idc-backend${colors.reset} 重启后端`);
console.log(` ${ICONS.pipe} ${colors.cyan}pm2 stop idc-backend${colors.reset} 停止后端`);
console.log(` ${ICONS.pipe} ${colors.cyan}pm2 logs yunrui_asset-backend${colors.reset} 查看后端日志`);
console.log(` ${ICONS.pipe} ${colors.cyan}pm2 restart yunrui_asset-backend${colors.reset} 重启后端`);
console.log(` ${ICONS.pipe} ${colors.cyan}pm2 stop yunrui_asset-backend${colors.reset} 停止后端`);
log.divider();
@@ -70,7 +70,7 @@ async function main() {
initLogFile(LOG_DIR);
log.banner(
'IDC 设备管理系统',
'云睿资产管理系统',
'安装部署脚本',
SCRIPT_VERSION
);
+10 -10
View File
@@ -180,25 +180,25 @@ async function startServices() {
log.info('停止已有服务...');
const stopCmd = process.platform === 'win32'
? 'pm2 stop idc-backend idc-frontend 2>nul || exit 0'
: 'pm2 stop idc-backend idc-frontend 2>/dev/null || true';
? 'pm2 stop yunrui_asset-backend yunrui_asset-frontend 2>nul || exit 0'
: 'pm2 stop yunrui_asset-backend yunrui_asset-frontend 2>/dev/null || true';
runCommand(stopCmd, { silent: true });
log.info('启动后端服务...');
const backendResult = runCommand(
`pm2 start server.js --name "idc-backend" --env ${config.nodeEnv}`,
`pm2 start server.js --name "yunrui_asset-backend" --env ${config.nodeEnv}`,
{ cwd: path.join(__dirname, '..', 'backend') }
);
if (backendResult.success) {
log.success(`后端服务已启动 (端口: ${config.backendPort})`);
rollbackSteps.push(() => {
runCommand('pm2 stop idc-backend', { silent: true });
runCommand('pm2 delete idc-backend', { silent: true });
runCommand('pm2 stop yunrui_asset-backend', { silent: true });
runCommand('pm2 delete yunrui_asset-backend', { silent: true });
});
} else {
log.error('后端服务启动失败');
log.info('请检查后端日志: pm2 logs idc-backend');
log.info('请检查后端日志: pm2 logs yunrui_asset-backend');
throw new Error('Backend service start failed');
}
@@ -208,19 +208,19 @@ async function startServices() {
log.info('启动前端服务...');
const frontendResult = runCommand(
`pm2 start serve --name "idc-frontend" -- -s dist -l ${config.frontendPort}`,
`pm2 start serve --name "yunrui_asset-frontend" -- -s dist -l ${config.frontendPort}`,
{ cwd: path.join(__dirname, '..', 'frontend') }
);
if (frontendResult.success) {
log.success(`前端服务已启动 (端口: ${config.frontendPort})`);
rollbackSteps.push(() => {
runCommand('pm2 stop idc-frontend', { silent: true });
runCommand('pm2 delete idc-frontend', { silent: true });
runCommand('pm2 stop yunrui_asset-frontend', { silent: true });
runCommand('pm2 delete yunrui_asset-frontend', { silent: true });
});
} else {
log.error('前端服务启动失败');
log.info('请检查前端日志: pm2 logs idc-frontend');
log.info('请检查前端日志: pm2 logs yunrui_asset-frontend');
throw new Error('Frontend service start failed');
}
}
+5 -5
View File
@@ -200,8 +200,8 @@ async function autoConfigureNginx() {
if (!installed) {
log.error('Nginx 自动安装失败');
log.info('请手动安装 Nginx 后执行:');
console.log(` ${colors.cyan}sudo cp deploy/nginx-idc.conf /etc/nginx/sites-available/idc${colors.reset}`);
console.log(` ${colors.cyan}sudo ln -sf /etc/nginx/sites-available/idc /etc/nginx/sites-enabled/idc${colors.reset}`);
console.log(` ${colors.cyan}sudo cp deploy/nginx-yunrui.conf /etc/nginx/sites-available/yunrui_asset${colors.reset}`);
console.log(` ${colors.cyan}sudo ln -sf /etc/nginx/sites-available/yunrui_asset /etc/nginx/sites-enabled/yunrui_asset${colors.reset}`);
console.log(` ${colors.cyan}sudo nginx -t && sudo systemctl restart nginx${colors.reset}`);
return;
}
@@ -222,7 +222,7 @@ async function autoConfigureNginx() {
wwwDir = '/www/wwwroot/idc';
log.info('检测到宝塔面板 Nginx 环境');
} else {
wwwDir = '/var/www/idc';
wwwDir = '/var/www/yunrui_asset';
}
const distDir = path.join(__dirname, '..', 'frontend', 'dist');
@@ -244,7 +244,7 @@ async function autoConfigureNginx() {
config.nginxRoot = wwwDir;
const configSource = path.join(__dirname, '..', 'deploy', 'nginx-idc.conf');
const configSource = path.join(__dirname, '..', 'deploy', 'nginx-yunrui.conf');
if (!fs.existsSync(configSource)) {
log.error('Nginx 配置文件不存在,请先运行安装脚本');
@@ -282,7 +282,7 @@ async function autoConfigureNginx() {
if (useSitesAvailable) {
log.info('创建站点软链接...');
runCommand(`${sudoPrefix}ln -sf "${configDest}" /etc/nginx/sites-enabled/idc.conf`);
runCommand(`${sudoPrefix}ln -sf "${configDest}" /etc/nginx/sites-enabled/yunrui_asset.conf`);
if (fs.existsSync('/etc/nginx/sites-enabled/default')) {
log.info('删除默认站点配置...');
+1 -1
View File
@@ -32,7 +32,7 @@ async function rollback() {
const configFiles = [
path.join(__dirname, '..', 'backend', '.env'),
path.join(__dirname, '..', 'ecosystem.config.js'),
path.join(__dirname, '..', 'deploy', 'nginx-idc.conf'),
path.join(__dirname, '..', 'deploy', 'nginx-yunrui.conf'),
];
for (const file of configFiles) {
+2 -2
View File
@@ -1,11 +1,11 @@
{
"name": "idc-device-management",
"name": "yunrui-asset-management",
"version": "2.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "idc-device-management",
"name": "yunrui-asset-management",
"version": "2.1.0",
"license": "MIT",
"dependencies": {
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "idc-device-management",
"name": "yunrui-asset-management",
"version": "2.1.1",
"description": "IDC设备管理系统",
"description": "云睿资产管理系统",
"scripts": {
"start": "concurrently \"npm run start:backend\" \"npm run start:frontend\"",
"start:backend": "cd backend && npm run dev",
+21 -21
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env node
/**
* IDC设备管理系统 - 卸载脚本 v2.0.0
* 云睿资产管理系统 - 卸载脚本 v2.0.0
*
* 功能说明
* - 停止并删除 PM2 管理的后端和前端服务
* - 清理 Nginx 配置文件可选
* - 删除生成的配置文件.envecosystem.config.jsnginx-idc.conf
* - 删除生成的配置文件.envecosystem.config.jsnginx-yunrui.conf
* - 可选删除数据库文件SQLite
* - 可选删除 node_modules 和构建产物
*
@@ -58,7 +58,7 @@ function parseArgs() {
function showHelp() {
console.log(`
${colors.bright}IDC设备管理系统 - 卸载脚本 v${SCRIPT_VERSION}${colors.reset}
${colors.bright}云睿资产管理系统 - 卸载脚本 v${SCRIPT_VERSION}${colors.reset}
${colors.bright}用法:${colors.reset} node uninstall.js [选项]
@@ -105,7 +105,7 @@ function commandExists(command) {
}
function getPM2ServiceNames() {
const defaultNames = { backendName: 'idc-backend', frontendName: 'idc-frontend' };
const defaultNames = { backendName: 'yunrui_asset-backend', frontendName: 'yunrui_asset-frontend' };
const configPath = path.join(__dirname, 'deploy', 'ecosystem.config.js');
if (!fs.existsSync(configPath)) {
@@ -123,7 +123,7 @@ function getPM2ServiceNames() {
if (app.name && app.name.startsWith('idc-')) {
if (app.name.includes('backend') || (app.script && app.script.includes('server'))) {
names.backendName = app.name;
} else if (app.name.includes('frontend') || app.name === 'idc-frontend') {
} else if (app.name.includes('frontend') || app.name === 'yunrui_asset-frontend') {
names.frontendName = app.name;
}
}
@@ -137,7 +137,7 @@ function getPM2ServiceNames() {
function getDatabaseConfig() {
const defaultConfig = {
dbType: 'sqlite',
sqliteDbPath: path.join(__dirname, 'backend', 'idc_management.db')
sqliteDbPath: path.join(__dirname, 'backend', 'yunrui_management.db')
};
const envPath = path.join(__dirname, 'backend', '.env');
@@ -304,13 +304,13 @@ async function cleanupNginxConfig(cmdArgs) {
const sudoPrefix = root ? '' : 'sudo ';
const idcConfigPaths = [
{ path: '/etc/nginx/sites-available/idc', label: 'sites-available/idc' },
{ path: '/etc/nginx/sites-enabled/idc', label: 'sites-enabled/idc(软链接)' },
{ path: '/etc/nginx/sites-available/yunrui_asset', label: 'sites-available/yunrui_asset' },
{ path: '/etc/nginx/sites-enabled/yunrui_asset', label: 'sites-enabled/yunrui_asset(软链接)' },
{ path: '/etc/nginx/conf.d/idc', label: 'conf.d/idc' },
{ path: '/etc/nginx/conf.d/idc.conf', label: 'conf.d/idc.conf' },
];
const wwwDir = '/var/www/idc';
const wwwDir = '/var/www/yunrui_asset';
const defaultSitePath = '/etc/nginx/sites-enabled/default';
const defaultAvailablePath = '/etc/nginx/sites-available/default';
@@ -331,15 +331,15 @@ async function cleanupNginxConfig(cmdArgs) {
}
if (!configRemoved) {
log.info('未找到 IDC Nginx 站点配置文件');
log.info('未找到云睿资产 Nginx 站点配置文件');
}
if (fs.existsSync(wwwDir)) {
log.info('清理前端部署目录...');
const result = runCommand(`${sudoPrefix}rm -rf "${wwwDir}"`, { silent: true });
if (result.success) {
log.success('前端部署目录已删除 (/var/www/idc)');
deletedItems.push({ type: '目录', name: '/var/www/idc' });
log.success('前端部署目录已删除 (/var/www/yunrui_asset)');
deletedItems.push({ type: '目录', name: '/var/www/yunrui_asset' });
} else {
log.warning('前端部署目录删除失败,请手动清理');
}
@@ -384,7 +384,7 @@ async function cleanupConfigFiles() {
const filesToDelete = [
{ path: path.join(__dirname, 'backend', '.env'), name: '后端环境变量 (.env)', type: '配置文件' },
{ path: path.join(__dirname, 'deploy', 'ecosystem.config.js'), name: 'PM2 配置 (ecosystem.config.js)', type: '配置文件' },
{ path: path.join(__dirname, 'deploy', 'nginx-idc.conf'), name: 'Nginx 配置 (nginx-idc.conf)', type: '配置文件' }
{ path: path.join(__dirname, 'deploy', 'nginx-yunrui.conf'), name: 'Nginx 配置 (nginx-yunrui.conf)', type: '配置文件' }
];
for (const file of filesToDelete) {
@@ -513,7 +513,7 @@ async function cleanupDatabase(cmdArgs) {
log.section('MySQL 删除方法');
console.log(` ${ICONS.pipe} 方法1 - MySQL 命令行:`);
console.log(` ${ICONS.pipe} ${colors.cyan}mysql -u root -p${colors.reset}`);
console.log(` ${ICONS.pipe} ${colors.cyan}DROP DATABASE idc_management;${colors.reset}`);
console.log(` ${ICONS.pipe} ${colors.cyan}DROP DATABASE yunrui_management;${colors.reset}`);
console.log(` ${ICONS.pipe} 方法2 - 使用数据库管理工具(如 Navicat、DBeaver、phpMyAdmin`);
console.log(` ${ICONS.pipe} 方法3 - 如果不再需要 MySQL 数据,可直接卸载 MySQL 服务`);
}
@@ -681,15 +681,15 @@ function showDryRunPreview(cmdArgs) {
console.log(`\n ${ICONS.pointer} ${colors.bright}2. 清理 Nginx 配置${colors.reset}`);
if (process.platform === 'linux') {
const nginxConfigPaths = ['/etc/nginx/sites-available/idc', '/etc/nginx/sites-enabled/idc',
const nginxConfigPaths = ['/etc/nginx/sites-available/yunrui_asset', '/etc/nginx/sites-enabled/yunrui_asset',
'/etc/nginx/conf.d/idc', '/etc/nginx/conf.d/idc.conf'];
nginxConfigPaths.forEach(p => {
if (fs.existsSync(p)) {
console.log(` ${ICONS.pipe} 删除 IDC 站点配置: ${p}`);
console.log(` ${ICONS.pipe} 删除云睿资产站点配置: ${p}`);
}
});
if (fs.existsSync('/var/www/idc')) {
console.log(` ${ICONS.pipe} 删除前端部署目录 (/var/www/idc)`);
if (fs.existsSync('/var/www/yunrui_asset')) {
console.log(` ${ICONS.pipe} 删除前端部署目录 (/var/www/yunrui_asset)`);
}
if (!fs.existsSync('/etc/nginx/sites-enabled/default') && fs.existsSync('/etc/nginx/sites-available/default')) {
console.log(` ${ICONS.pipe} 恢复 Nginx 默认站点`);
@@ -707,7 +707,7 @@ function showDryRunPreview(cmdArgs) {
const configFiles = [
{ path: path.join(__dirname, 'backend', '.env'), name: '后端环境变量 (.env)' },
{ path: path.join(__dirname, 'deploy', 'ecosystem.config.js'), name: 'PM2 配置' },
{ path: path.join(__dirname, 'deploy', 'nginx-idc.conf'), name: 'Nginx 配置' }
{ path: path.join(__dirname, 'deploy', 'nginx-yunrui.conf'), name: 'Nginx 配置' }
];
configFiles.forEach(f => {
if (fs.existsSync(f.path)) {
@@ -825,12 +825,12 @@ async function main() {
initLogFile(LOG_DIR);
log.banner(
'IDC 设备管理系统',
'云睿资产管理系统',
'卸载脚本',
SCRIPT_VERSION
);
log.warning('此脚本将卸载 IDC 设备管理系统');
log.warning('此脚本将卸载 云睿资产管理系统');
if (cmdArgs.force) {
log.info('运行模式: 强制卸载(无需确认)');
+8 -8
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
* IDC设备管理系统 - 一键更新脚本
* 云睿资产管理系统 - 一键更新脚本
* 功能拉取最新代码 安装依赖 数据库迁移 重建前端 重启服务 健康检查
* 版本2.0.0
*/
@@ -71,7 +71,7 @@ function parseArgs() {
function showHelp() {
console.log(`
${colors.bright}IDC设备管理系统 - 一键更新脚本 v${SCRIPT_VERSION}${colors.reset}
${colors.bright}云睿资产管理系统 - 一键更新脚本 v${SCRIPT_VERSION}${colors.reset}
${colors.bright}用法:${colors.reset} node update.js [选项]
@@ -194,7 +194,7 @@ function findBackendServiceName() {
}
for (const proc of processes) {
if (proc.name === 'server' || proc.name === 'idc-backend' || proc.name === 'backend') {
if (proc.name === 'server' || proc.name === 'yunrui_asset-backend' || proc.name === 'backend') {
return proc.name;
}
}
@@ -219,7 +219,7 @@ function findFrontendServiceName() {
if (script.includes('vite') || scriptPath.includes('vite') ||
script.includes('react') || script.includes('nginx') ||
proc.name === 'frontend' || proc.name === 'idc-frontend') {
proc.name === 'frontend' || proc.name === 'yunrui_asset-frontend') {
return proc.name;
}
}
@@ -247,7 +247,7 @@ function backupDatabase(options) {
const dbType = dbTypeMatch ? dbTypeMatch[1].toLowerCase() : 'sqlite';
if (dbType === 'sqlite') {
const dbPath = path.join(__dirname, 'backend', 'idc_management.db');
const dbPath = path.join(__dirname, 'backend', 'yunrui_management.db');
if (!fs.existsSync(dbPath)) {
log.warning('SQLite 数据库文件不存在,跳过备份');
return { success: true, skipped: true };
@@ -576,7 +576,7 @@ function syncFrontendToNginx(options) {
if (isBtPanel) {
nginxRoot = '/www/wwwroot/idc';
} else {
nginxRoot = '/var/www/idc';
nginxRoot = '/var/www/yunrui_asset';
}
log.info(`未配置 nginxRoot,自动检测: ${nginxRoot} (${isBtPanel ? '宝塔' : '标准'})`);
}
@@ -819,7 +819,7 @@ function rollback(reason) {
log.step('执行回滚...');
if (rollbackInfo.backupDbPath && fs.existsSync(rollbackInfo.backupDbPath)) {
const dbPath = path.join(__dirname, 'backend', 'idc_management.db');
const dbPath = path.join(__dirname, 'backend', 'yunrui_management.db');
fs.copyFileSync(rollbackInfo.backupDbPath, dbPath);
log.success('数据库已回滚');
}
@@ -897,7 +897,7 @@ async function main() {
initLogFile(LOG_DIR);
log.banner(
'IDC 设备管理系统',
'云睿资产管理系统',
'一键更新脚本',
SCRIPT_VERSION
);