feat: scaffold gold_monitor web hub, API, PM2 deploy and docs

This commit is contained in:
dekun
2026-10-17 17:43:17 +08:00
commit fb35968a1f
35 changed files with 2080 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "${ROOT}"
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get install -y python3 python3-venv python3-pip git ca-certificates curl
if [[ ! -d .venv ]]; then
python3 -m venv .venv
fi
# shellcheck disable=SC1091
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
if [[ ! -f .env ]]; then
cp .env.example .env
# 生成随机 SECRET
SECRET="$(python3 - <<'PY'
import secrets
print(secrets.token_urlsafe(32))
PY
)"
IP="$(hostname -I 2>/dev/null | awk '{print $1}')"
IP="${IP:-127.0.0.1}"
sed -i "s|^FLASK_SECRET_KEY=.*|FLASK_SECRET_KEY=${SECRET}|" .env
sed -i "s|^PUBLIC_BASE_URL=.*|PUBLIC_BASE_URL=http://${IP}:5800|" .env
echo "已生成 .env (PUBLIC_BASE_URL=http://${IP}:5800)"
fi
mkdir -p data releases
echo "setup_env 完成"