Files

30 lines
920 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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"