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
+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
);