chore: import storyforge baseline clean
This commit is contained in:
7
scripts/bootstrap.sh
Executable file
7
scripts/bootstrap.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd /Users/kris/code/StoryForge/collector-service
|
||||
python3 -m venv .venv
|
||||
. .venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
uvicorn app.main:app --host 0.0.0.0 --port 8081 --reload
|
||||
25
scripts/start_collector.sh
Executable file
25
scripts/start_collector.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
ROOT="/Users/kris/code/StoryForge"
|
||||
PID_FILE="$ROOT/data/collector/collector.pid"
|
||||
LOG_FILE="$ROOT/data/collector/collector.log"
|
||||
VENV="$ROOT/collector-service/.venv311"
|
||||
mkdir -p "$ROOT/data/collector"
|
||||
if [ ! -x "$VENV/bin/python" ]; then
|
||||
/opt/homebrew/bin/python3.11 -m venv "$VENV"
|
||||
. "$VENV/bin/activate"
|
||||
pip install -q -r "$ROOT/collector-service/requirements.txt"
|
||||
else
|
||||
. "$VENV/bin/activate"
|
||||
fi
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID="$(cat "$PID_FILE" || true)"
|
||||
if [ -n "$PID" ] && kill -0 "$PID" 2>/dev/null; then
|
||||
echo "collector already running: $PID"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
cd "$ROOT/collector-service"
|
||||
nohup "$VENV/bin/python" -m uvicorn app.main:app --host 0.0.0.0 --port 8081 >"$LOG_FILE" 2>&1 &
|
||||
echo $! > "$PID_FILE"
|
||||
echo "collector started: $(cat "$PID_FILE")"
|
||||
15
scripts/status_collector.sh
Executable file
15
scripts/status_collector.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
PID_FILE="/Users/kris/code/StoryForge/data/collector/collector.pid"
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID="$(cat "$PID_FILE" || true)"
|
||||
if [ -n "$PID" ] && kill -0 "$PID" 2>/dev/null; then
|
||||
echo "running:$PID"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
if lsof -nP -iTCP:8081 -sTCP:LISTEN >/dev/null 2>&1; then
|
||||
echo "running:port"
|
||||
else
|
||||
echo "stopped"
|
||||
fi
|
||||
15
scripts/stop_collector.sh
Executable file
15
scripts/stop_collector.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
PID_FILE="/Users/kris/code/StoryForge/data/collector/collector.pid"
|
||||
if [ ! -f "$PID_FILE" ]; then
|
||||
echo "collector not running"
|
||||
exit 0
|
||||
fi
|
||||
PID="$(cat "$PID_FILE" || true)"
|
||||
if [ -n "$PID" ] && kill -0 "$PID" 2>/dev/null; then
|
||||
kill "$PID"
|
||||
echo "collector stopped: $PID"
|
||||
else
|
||||
echo "collector pid stale: $PID"
|
||||
fi
|
||||
rm -f "$PID_FILE"
|
||||
Reference in New Issue
Block a user