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
This commit is contained in:
Accusys
2026-10-02 12:47:55 +08:00
parent e0d04e242f
commit 193af91cd7
2 changed files with 27 additions and 11 deletions
+18 -6
View File
@@ -1,22 +1,34 @@
#!/usr/bin/env bash
# Start production server (port 3002)
# 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 "target/debug/momentry server" 2>/dev/null || true
pkill -f "target/debug/momentry worker" 2>/dev/null || true
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..."
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 ./target/debug/momentry server > logs/momentry_3002.log 2>&1 &
nohup "$MOMENTRY_BIN" server > logs/momentry_3002.log 2>&1 &
SERVER_PID=$!
echo "Server PID: $SERVER_PID"
@@ -24,7 +36,7 @@ sleep 2
# Start worker
echo "Starting worker with max_concurrent=6..."
nohup ./target/debug/momentry worker \
nohup "$MOMENTRY_BIN" worker \
--max-concurrent 6 \
--poll-interval 5 \
--batch-size 10 \