首次上传
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PROJECT_DIR="${1:-/root/onchain_scout_gate}"
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -U pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
if [ ! -f config.yaml ]; then
|
||||
cp config.example.yaml config.yaml
|
||||
echo "config.yaml created from template, please edit keys/password before start."
|
||||
fi
|
||||
|
||||
mkdir -p runtime
|
||||
echo "Bootstrap done."
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* PM2 守护 onchain_scout_gate(Gate USDT 永续行情扫描)
|
||||
*
|
||||
* 在项目根目录:
|
||||
* pm2 start deploy/ecosystem.config.cjs
|
||||
* pm2 logs onchain-scout
|
||||
*
|
||||
* 监听地址与端口来自 config.yaml → app.host / app.port(python -m app.main 内 uvicorn)。
|
||||
*/
|
||||
const path = require("path");
|
||||
const ROOT = path.resolve(__dirname, "..");
|
||||
const isWin = process.platform === "win32";
|
||||
const py = path.join(ROOT, isWin ? path.join(".venv", "Scripts", "python.exe") : path.join(".venv", "bin", "python"));
|
||||
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "onchain-scout",
|
||||
cwd: ROOT,
|
||||
script: py,
|
||||
args: ["-m", "app.main"],
|
||||
interpreter: "none",
|
||||
autorestart: true,
|
||||
watch: false,
|
||||
max_restarts: 15,
|
||||
min_uptime: "10s",
|
||||
exp_backoff_restart_delay: 2000,
|
||||
error_file: path.join(ROOT, "runtime", "pm2-error.log"),
|
||||
out_file: path.join(ROOT, "runtime", "pm2-out.log"),
|
||||
merge_logs: true,
|
||||
time: true,
|
||||
env: {
|
||||
PYTHONUNBUFFERED: "1",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=Onchain Scout (Gate) via PM2 runtime
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/root/onchain_scout_gate
|
||||
Environment=NODE_ENV=production
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
# 需全局安装 pm2:npm install -g pm2
|
||||
# 路径按实际安装位置调整(which pm2-runtime)
|
||||
ExecStart=/usr/bin/pm2-runtime start deploy/ecosystem.config.cjs
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# 前台调试:直接 uvicorn(无守护)。生产环境请用 PM2:pm2 start deploy/ecosystem.config.cjs
|
||||
set -euo pipefail
|
||||
|
||||
PROJECT_DIR="${1:-/root/onchain_scout_gate}"
|
||||
cd "$PROJECT_DIR"
|
||||
source .venv/bin/activate
|
||||
exec uvicorn app.main:app --host 0.0.0.0 --port 8088 --workers 1
|
||||
|
||||
Reference in New Issue
Block a user