Update 2026-06-23 10:40:10
This commit is contained in:
+10
-10
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user