deploy: 安全部署脚本,清理实验配置由仓库脚本负责
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,28 +1,6 @@
|
||||
#!/bin/bash
|
||||
# 部署卡顿修复并验证 rt=
|
||||
# 兼容旧名:转 safe-deploy + 清理实验配置
|
||||
set -e
|
||||
DJANGO_DIR="/opt/1panel/apps/openresty/nginx/www/sites/43.142.166.152.443/django"
|
||||
NGINX_LOG="/opt/1panel/apps/openresty/nginx/log/access.log"
|
||||
cd "$DJANGO_DIR"
|
||||
|
||||
echo ">>> git pull"
|
||||
git pull origin main
|
||||
|
||||
echo ">>> 更新 systemd (6 workers)"
|
||||
cp deploy/systemd/gunicorn-dianjing.service /etc/systemd/system/gunicorn-dianjing.service
|
||||
systemctl daemon-reload
|
||||
systemctl restart gunicorn-dianjing.service
|
||||
sleep 2
|
||||
systemctl is-active gunicorn-dianjing.service
|
||||
pgrep -cf 'gunicorn.*a_long_dianjing' || true
|
||||
|
||||
echo ""
|
||||
echo ">>> 最近慢请求 (rt>=0.5s):"
|
||||
grep -a 'hqhd' "$NGINX_LOG" | awk 'match($0,/rt=([0-9.]+)/,a){if(a[1]+0>=0.5)print}' | tail -5
|
||||
|
||||
echo ""
|
||||
echo ">>> 最近 dddhq / merchant-staff/me:"
|
||||
grep -a 'hqhd' "$NGINX_LOG" | grep -E 'ddhq|merchant-staff/me' | tail -8 | awk 'match($0,/rt=([0-9.]+)/,a){rt=a[1]} match($0,/POST ([^ ]+)/,b){print " rt="rt"s "b[1]}'
|
||||
|
||||
echo ""
|
||||
echo "部署完成。请用手机再试,然后看上面 rt 是否都 <0.2s"
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
bash "$DIR/cleanup-lag-experiments.sh" 2>/dev/null || true
|
||||
bash "$DIR/safe-deploy.sh"
|
||||
|
||||
Reference in New Issue
Block a user