chore(scripts): add development, DSH and sidecar launchers

This commit is contained in:
yi
2026-09-16 19:06:21 +08:00
parent 85f6e3be86
commit 470f8f01ab
11 changed files with 502 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
# 启动独立 DSH 内容生产 Worker。API 与 DSH 必须使用同一个 YAWAN_DATA_DIR,
# 以共享 SQLite 队列、知识库、向量索引和 artifacts 产物目录。
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT/server"
if [ -f "$ROOT/.env.production" ]; then
set -a
. "$ROOT/.env.production"
set +a
fi
export YAWAN_ENV="${YAWAN_ENV:-prod}"
export YAWAN_EXECUTION_BACKEND="${YAWAN_EXECUTION_BACKEND:-dsh}"
export YAWAN_DSH_LOG_LEVEL="${YAWAN_DSH_LOG_LEVEL:-INFO}"
if [ -x "$ROOT/server/.venv/bin/python" ]; then
PY="$ROOT/server/.venv/bin/python"
elif [ -x "$ROOT/.venv/bin/python" ]; then
PY="$ROOT/.venv/bin/python"
else
PY="${PYTHON:-python3}"
fi
LOG_FILE="${YAWAN_DSH_LOG_FILE:-/tmp/yawan-dsh.log}"
nohup "$PY" -m app.dsh_worker >> "$LOG_FILE" 2>&1 &
pid=$!
echo "DSH worker started: pid=$pid log=$LOG_FILE backend=$YAWAN_EXECUTION_BACKEND env=$YAWAN_ENV"