feat: gateway management scripts (start, stop, status)

This commit is contained in:
Claude Code
2026-03-28 18:58:03 -04:00
commit e8a23f2b11
4 changed files with 72 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
# Start the Mortdecai gateway (uvicorn on port 8500)
set -e
GATEWAY_DIR="$HOME/bin/Mortdecai-2.0"
PID_FILE="/tmp/mortdecai-gateway.pid"
LOG_FILE="/tmp/mortdecai-gateway.log"
# Check if already running
if [ -f "$PID_FILE" ] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
echo "Gateway already running (PID $(cat "$PID_FILE"))"
exit 0
fi
cd "$GATEWAY_DIR"
source .env 2>/dev/null
nohup python3 -m uvicorn gateway.api:app --host 0.0.0.0 --port 8500 > "$LOG_FILE" 2>&1 &
echo $! > "$PID_FILE"
# Wait for health
for i in $(seq 1 10); do
if curl -sf http://localhost:8500/v2/health > /dev/null 2>&1; then
echo "Gateway started (PID $(cat "$PID_FILE"))"
exit 0
fi
sleep 1
done
echo "ERROR: Gateway failed to start within 10s. Check $LOG_FILE"
exit 1