Files

21 lines
846 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
# 开发环境启动脚本(8011,独立数据 data-dev/,可随便折腾不影响生产)
# 用法: bash scripts/dev_start.sh [restart]
set -e
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
PORT=8011
export YAWAN_ENV=dev
# dev 单实例收敛:先杀旧 dev
pkill -f "uvicorn.*8011" 2>/dev/null || true
sleep 1
cd "$ROOT/server"
if [ -f .venv/bin/activate ]; then PY=.venv/bin/python; else PY=python3; fi
# 首次启动 dev 库自动初始化(bootstrap admin 走页面上注册流程即可)
nohup env YAWAN_ENV=dev "$PY" -m uvicorn app.main:app --host 127.0.0.1 --port $PORT >> "$ROOT/server/data-dev/dev.log" 2>&1 &
echo "dev 已启动: http://127.0.0.1:$PORT/admin (日志 $ROOT/server/data-dev/dev.log)"
sleep 3
curl -s -m 5 --noproxy '*' -o /dev/null -w "dev health: %{http_code}\n" "http://127.0.0.1:$PORT/api/health"