feat(devtools): add memory-service & tool-engine management, fix .gitignore
- Add memory-service and tool-engine to devtools config (ports, env, healthUrl) - Add GOWORK=off to process-manager build for Go workspace compatibility - Update DB check and startup order to include new services - Add backend/tool-engine/main to .gitignore for Go binary
This commit is contained in:
@@ -30,6 +30,7 @@ backend/iot-debug-service/iot-debug-service
|
|||||||
backend/memory-service/main
|
backend/memory-service/main
|
||||||
backend/memory-service/cmd/main
|
backend/memory-service/cmd/main
|
||||||
backend/memory-service/memory-service
|
backend/memory-service/memory-service
|
||||||
|
backend/tool-engine/main
|
||||||
backend/tool-engine/cmd/tool-engine
|
backend/tool-engine/cmd/tool-engine
|
||||||
backend/tool-engine/tool-engine
|
backend/tool-engine/tool-engine
|
||||||
backend/voice-service/voice-service
|
backend/voice-service/voice-service
|
||||||
|
|||||||
@@ -67,6 +67,35 @@ export const SERVICES = {
|
|||||||
buildArgs: ['build', '-o', 'main', './cmd/main.go'],
|
buildArgs: ['build', '-o', 'main', './cmd/main.go'],
|
||||||
goBin: '/usr/local/go/bin/go',
|
goBin: '/usr/local/go/bin/go',
|
||||||
},
|
},
|
||||||
|
'memory-service': {
|
||||||
|
name: '记忆服务',
|
||||||
|
cwd: path.join(ROOT, 'backend/memory-service'),
|
||||||
|
command: './main',
|
||||||
|
env: {
|
||||||
|
PORT: '8091',
|
||||||
|
DB_URL: process.env.DB_URL || 'postgres://cyrene:change_me@localhost:5432/cyrene_ai?sslmode=disable',
|
||||||
|
},
|
||||||
|
healthUrl: 'http://localhost:8091/api/v1/health',
|
||||||
|
port: 8091,
|
||||||
|
buildCommand: 'go',
|
||||||
|
buildArgs: ['build', '-o', 'main', './cmd/main.go'],
|
||||||
|
goBin: '/usr/local/go/bin/go',
|
||||||
|
},
|
||||||
|
'tool-engine': {
|
||||||
|
name: '工具引擎',
|
||||||
|
cwd: path.join(ROOT, 'backend/tool-engine'),
|
||||||
|
command: './main',
|
||||||
|
env: {
|
||||||
|
PORT: '8092',
|
||||||
|
DB_URL: process.env.DB_URL || 'postgres://cyrene:change_me@localhost:5432/cyrene_ai?sslmode=disable',
|
||||||
|
IOT_SERVICE_URL: process.env.IOT_DEBUG_SERVICE_URL || 'http://localhost:8083',
|
||||||
|
},
|
||||||
|
healthUrl: 'http://localhost:8092/api/v1/health',
|
||||||
|
port: 8092,
|
||||||
|
buildCommand: 'go',
|
||||||
|
buildArgs: ['build', '-o', 'main', './cmd/main.go'],
|
||||||
|
goBin: '/usr/local/go/bin/go',
|
||||||
|
},
|
||||||
'voice-service': {
|
'voice-service': {
|
||||||
name: '语音识别服务',
|
name: '语音识别服务',
|
||||||
cwd: path.join(ROOT, 'backend/voice-service'),
|
cwd: path.join(ROOT, 'backend/voice-service'),
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ class ProcessManager extends EventEmitter {
|
|||||||
throw new Error(`${svc.name} 已在运行中`);
|
throw new Error(`${svc.name} 已在运行中`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对 gateway 和 ai-core 做数据库前置检查
|
// 对需要数据库的服务做前置检查
|
||||||
if (serviceId === 'gateway' || serviceId === 'ai-core') {
|
if (['gateway', 'ai-core', 'memory-service', 'tool-engine'].includes(serviceId)) {
|
||||||
this.emit('log', serviceId, 'system', '检查数据库连接状态...');
|
this.emit('log', serviceId, 'system', '检查数据库连接状态...');
|
||||||
await ensureDBOnline(serviceId, this);
|
await ensureDBOnline(serviceId, this);
|
||||||
}
|
}
|
||||||
@@ -288,7 +288,7 @@ class ProcessManager extends EventEmitter {
|
|||||||
|
|
||||||
const child = spawn(buildCmd, buildArgs, {
|
const child = spawn(buildCmd, buildArgs, {
|
||||||
cwd: svc.cwd,
|
cwd: svc.cwd,
|
||||||
env: { ...process.env, GOPROXY: 'https://goproxy.cn,direct' },
|
env: { ...process.env, GOPROXY: 'https://goproxy.cn,direct', GOWORK: 'off' },
|
||||||
stdio: ['ignore', 'pipe', 'pipe'],
|
stdio: ['ignore', 'pipe', 'pipe'],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ class ProcessManager extends EventEmitter {
|
|||||||
* 每步等待健康检查通过后再启动下一个
|
* 每步等待健康检查通过后再启动下一个
|
||||||
*/
|
*/
|
||||||
async startAllSequential() {
|
async startAllSequential() {
|
||||||
const order = ['iot-debug-service', 'ai-core', 'gateway', 'frontend'];
|
const order = ['memory-service', 'tool-engine', 'iot-debug-service', 'ai-core', 'gateway', 'frontend'];
|
||||||
const results = [];
|
const results = [];
|
||||||
|
|
||||||
for (const id of order) {
|
for (const id of order) {
|
||||||
|
|||||||
Reference in New Issue
Block a user