- Added MOMENTRY_OUTPUT_DIR, DATABASE_SCHEMA, MOMENTRY_REDIS_PREFIX exports - Created run-worker-3002.sh for standalone worker - Created config/ directory with environment-specific files - Updated AGENTS.md with critical variables section and release checklist This fixes Python subprocess environment variable inheritance issue where store_traced_faces.py was using wrong output directory.
56 lines
1.6 KiB
Bash
Executable File
56 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Start playground server on port 3003
|
|
# Logs to logs/momentry_3003.log
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
mkdir -p logs
|
|
|
|
# Ensure development environment variables
|
|
export DATABASE_SCHEMA=dev
|
|
export MOMENTRY_SERVER_PORT=3003
|
|
export MOMENTRY_REDIS_PREFIX=momentry_dev:
|
|
export MOMENTRY_OUTPUT_DIR=/Users/accusys/momentry/output_dev
|
|
|
|
# Kill existing server on port 3003
|
|
PID=$(lsof -ti :3003 2>/dev/null || true)
|
|
if [ -n "$PID" ]; then
|
|
echo "Killing existing server on port 3003 (PID: $PID)"
|
|
kill "$PID" 2>/dev/null || true
|
|
sleep 2
|
|
fi
|
|
|
|
# Kill existing worker via PID file
|
|
if [ -f logs/worker_3003.pid ]; then
|
|
WPID=$(cat logs/worker_3003.pid)
|
|
if kill -0 "$WPID" 2>/dev/null; then
|
|
echo "Killing existing worker (PID: $WPID)"
|
|
kill "$WPID" 2>/dev/null || true
|
|
sleep 1
|
|
fi
|
|
rm -f logs/worker_3003.pid
|
|
fi
|
|
|
|
# Build if needed
|
|
if [ ! -f target/debug/momentry_playground ]; then
|
|
echo "Building playground binary..."
|
|
cargo build --bin momentry_playground
|
|
fi
|
|
|
|
# Start server
|
|
echo "Starting momentry_playground server on port 3003 (DATABASE_SCHEMA=${DATABASE_SCHEMA})..."
|
|
./target/debug/momentry_playground server --port 3003 > logs/momentry_3003.log 2>&1 &
|
|
echo "Server started (PID: $!)"
|
|
echo "Logs: logs/momentry_3003.log"
|
|
|
|
# Start companion worker
|
|
echo "Starting momentry_playground worker (DATABASE_SCHEMA=${DATABASE_SCHEMA})..."
|
|
nohup ./target/debug/momentry_playground worker --max-concurrent 6 --poll-interval 10 --batch-size 5 > logs/worker_3003.log 2>&1 &
|
|
WPID=$!
|
|
echo "$WPID" > logs/worker_3003.pid
|
|
echo "Worker started (PID: $WPID)"
|
|
echo "Worker logs: logs/worker_3003.log"
|