fix: add environment variable exports to startup scripts
- 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.
This commit is contained in:
40
run-worker-3002.sh
Executable file
40
run-worker-3002.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
# Start production worker on port 3002
|
||||
# Logs to logs/worker_3002.log
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
mkdir -p logs
|
||||
|
||||
# Production environment variables
|
||||
export MOMENTRY_OUTPUT_DIR=/Users/accusys/momentry/output
|
||||
export DATABASE_SCHEMA=public
|
||||
export MOMENTRY_REDIS_PREFIX=momentry:
|
||||
|
||||
# Kill existing worker via PID file
|
||||
if [ -f logs/worker_3002.pid ]; then
|
||||
WPID=$(cat logs/worker_3002.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_3002.pid
|
||||
fi
|
||||
|
||||
# Build if needed
|
||||
if [ ! -f target/release/momentry ]; then
|
||||
echo "Building release binary..."
|
||||
cargo build --release --bin momentry
|
||||
fi
|
||||
|
||||
# Start worker
|
||||
echo "Starting momentry worker (DATABASE_SCHEMA=${DATABASE_SCHEMA})..."
|
||||
nohup ./target/release/momentry worker > logs/worker_3002.log 2>&1 &
|
||||
WPID=$!
|
||||
echo "$WPID" > logs/worker_3002.pid
|
||||
echo "Worker started (PID: $WPID)"
|
||||
echo "Worker logs: logs/worker_3002.log"
|
||||
Reference in New Issue
Block a user