's'
This commit is contained in:
18
d2ypp2/start.sh
Normal file
18
d2ypp2/start.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# 生产/运维:自动构建前端(若缺失)+ 单进程 uvicorn(API 与静态页同端口)
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
export HOST="${HOST:-0.0.0.0}"
|
||||
export PORT="${PORT:-8001}"
|
||||
hard_nofile="$(ulimit -Hn 2>/dev/null || true)"
|
||||
target_nofile="${LIVE_NOFILE_SOFT:-$hard_nofile}"
|
||||
if [[ -n "$target_nofile" && "$target_nofile" != "unlimited" ]]; then
|
||||
ulimit -Sn "$target_nofile" >/dev/null 2>&1 || true
|
||||
fi
|
||||
if [[ -x ".venv/bin/python" ]]; then
|
||||
PY=".venv/bin/python"
|
||||
else
|
||||
PY=python3
|
||||
command -v python3 >/dev/null 2>&1 || PY=python
|
||||
fi
|
||||
exec "$PY" scripts/launch.py --host "$HOST" --port "$PORT"
|
||||
Reference in New Issue
Block a user