Files
momentry_core/run-server-3002.sh
T
Accusys 193af91cd7 docs: switch production 3002 management to launchd (release binary)
- com.momentry.server + com.momentry.worker manage target/release/momentry
- mark run-server-3002.sh as dev/emergency only (conflicts with launchd)
- AGENTS.md: update startup/log tables, add launchd worker bootstrap note
2026-10-02 12:47:55 +08:00

55 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Start production server (port 3002) — DEV/EMERGENCY use only.
# NOTE: Production is normally managed by launchd (com.momentry.server + com.momentry.worker).
# Running this script while launchd agents are loaded creates duplicate processes.
# Use it only to temporarily run outside launchd (e.g. debugging), and stop launchd agents first.
set -euo pipefail
cd /Users/accusys/momentry_core
# Binary selection: default to release binary (production); override with
# MOMENTRY_PROD_BIN=debug to run the debug build instead.
BIN="${MOMENTRY_PROD_BIN:-release}"
MOMENTRY_BIN="target/${BIN}/momentry"
if [ ! -f "$MOMENTRY_BIN" ]; then
echo "Binary not found: $MOMENTRY_BIN (build it first or set MOMENTRY_PROD_BIN=debug)" >&2
exit 1
fi
# Kill existing processes
pkill -f "momentry server" 2>/dev/null || true
pkill -f "momentry worker" 2>/dev/null || true
sleep 2
# Start server
echo "Starting server on port 3002 (binary: $MOMENTRY_BIN)..."
export MOMENTRY_SERVER_PORT=3002
export MOMENTRY_REDIS_PREFIX=momentry:
export DATABASE_SCHEMA=public
export MOMENTRY_OUTPUT_DIR=/Users/accusys/momentry/output
nohup "$MOMENTRY_BIN" server > logs/momentry_3002.log 2>&1 &
SERVER_PID=$!
echo "Server PID: $SERVER_PID"
sleep 2
# Start worker
echo "Starting worker with max_concurrent=6..."
nohup "$MOMENTRY_BIN" worker \
--max-concurrent 6 \
--poll-interval 5 \
--batch-size 10 \
> logs/worker_3002.log 2>&1 &
WORKER_PID=$!
echo "Worker PID: $WORKER_PID"
sleep 2
# Verify
echo ""
echo "=== Status ==="
ps aux | grep -E "momentry (server|worker)" | grep -v grep
echo ""
echo "✅ Server and Worker started on port 3002"