Files
momentry_core/scripts/start_all_services.sh
T
Accusys 63fbbe1225 release: v1.3.1 - Pipeline Queue Integration, OCR Fix, Worker Compatibility
Major Changes:
- Pipeline Queue integration completed (internal.file + pipeline.commands)
- Fixed old job_worker database compatibility with new command_queue table
- Compiled Swift OCR binary (was missing, causing empty OCR results)
- Added deep scan functionality through re-scan API

Fixes:
- Changed CommandJob.id from i32 to i64 for database compatibility
- Added UUID generation in create_command (message_id field)
- Fixed claim_pending_commands to query queue_name = 'internal.file'
- Fixed field mappings: command_id → message_id, job_type → command_type
- Added support for 'processing' status in CommandJobStatus

Queue System:
- internal.file queue: for register/unregister/re-scan commands (job_worker)
- pipeline.commands queue: for vectorize/store_asrx/etc commands (pipeline_worker)

Documentation:
- Added comprehensive queue system documentation
- Created M4 workspace status reports
- Updated AGENTS.md with queue system details
2026-10-12 10:00:51 +08:00

134 lines
3.3 KiB
Bash
Executable File

#!/bin/bash
# Momentry Core 启动脚本
# 用途:一键启动所有必要服务
set -e
echo "===================================="
echo " Momentry Core 启动脚本"
echo "===================================="
echo ""
# 检查环境变量
if [ ! -f .env ]; then
echo "❌ 错误: .env 文件不存在"
exit 1
fi
# 加载环境变量
export $(cat .env | grep -v '^#' | xargs)
echo "✅ 环境变量已加载"
echo ""
# 1. 检查数据库服务
echo "1️⃣ 检查数据库服务..."
# PostgreSQL
if ! pg_isready -q 2>/dev/null; then
echo "❌ PostgreSQL 未运行"
echo " 请启动: brew services start postgresql@14"
exit 1
fi
echo " ✅ PostgreSQL: 运行中"
# Redis
if ! redis-cli -a "$REDIS_PASSWORD" ping 2>/dev/null | grep -q PONG; then
echo "❌ Redis 未运行"
echo " 请启动: brew services start redis"
exit 1
fi
echo " ✅ Redis: 运行中"
# Qdrant
if ! curl -s http://localhost:6333/health 2>/dev/null | grep -q "ok"; then
echo "⚠️ Qdrant 未运行 (可选)"
else
echo " ✅ Qdrant: 运行中"
fi
echo ""
# 2. 检查 LLM 服务
echo "2️⃣ 检查 LLM 服务..."
# VLM/Chat Service (llama.cpp)
if ! curl -s http://localhost:8080/v1/models 2>/dev/null | grep -q "gemma"; then
echo "❌ LLM 服务未运行"
echo " 请启动: launchctl start gui/$(id -u)/com.momentry.chat-llamacpp"
exit 1
fi
echo " ✅ LLM Service (port 8080): 运行中"
echo ""
# 3. 检查 Momentry 服务是否已运行
echo "3️⃣ 检查 Momentry 服务..."
if pgrep -f "momentry server" > /dev/null; then
echo "⚠️ Momentry Server 已在运行"
echo " 如需重启,请先运行: pkill -f 'momentry server'"
echo " 或使用: launchctl stop gui/$(id -u)/com.momentry.server"
# 检查 API 是否响应
if curl -s http://localhost:3002/api/v1/health 2>/dev/null | grep -q "ok"; then
echo " ✅ API 正常响应"
exit 0
else
echo " ❌ API 无响应,建议重启"
exit 1
fi
fi
echo " ✅ Momentry Server 未运行,准备启动..."
echo ""
# 4. 启动 Momentry Server
echo "4️⃣ 启动 Momentry Server..."
# 创建日志目录
mkdir -p logs
# 启动服务
if [ -f target/release/momentry ]; then
echo " 使用 release binary..."
./target/release/momentry server > logs/momentry_3002.log 2>&1 &
else
echo " 使用 cargo run (debug mode)..."
cargo run -- server > logs/momentry_3002.log 2>&1 &
fi
SERVER_PID=$!
echo " 服务已启动 (PID: $SERVER_PID)"
# 等待服务启动
echo " 等待服务就绪..."
sleep 5
# 检查服务是否正常
if curl -s http://localhost:3002/api/v1/health 2>/dev/null | grep -q "ok"; then
echo " ✅ 服务启动成功!"
else
echo " ❌ 服务启动失败,检查日志:"
echo " tail -f logs/momentry_3002.log"
exit 1
fi
echo ""
echo "===================================="
echo " 🎉 所有服务启动完成!"
echo "===================================="
echo ""
echo "服务状态:"
echo " API Server: http://localhost:3002"
echo " LLM Service: http://localhost:8080"
echo " 日志: logs/momentry_3002.log"
echo ""
echo "停止服务:"
echo " pkill -f 'momentry server'"
echo ""
echo "查看日志:"
echo " tail -f logs/momentry_3002.log"
echo ""