fix: 前端类型修复(@types/node + vite-env.d.ts + ufw SSHD_PORT)
- frontend: 加 @types/node / vite/client 类型声明 - frontend: tsconfig 加 types: [node, vite/client] - scripts: deploy_remote.sh 用 sg docker + dc() 函数避免引号问题 - scripts: deploy_remote.sh ufw 改用 \ 变量
This commit is contained in:
23
scripts/_run_deploy.py
Normal file
23
scripts/_run_deploy.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import os, paramiko
|
||||
HOST, PORT, USER = "207.57.129.228", 19717, "root"
|
||||
PW = os.environ["REMOTE_PASS"]
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(HOST, port=PORT, username=USER, password=PW, timeout=15, allow_agent=False, look_for_keys=False)
|
||||
|
||||
# 1) 推更新后的部署脚本
|
||||
sftp = c.open_sftp()
|
||||
sftp.put("D:/selftools/diary-news/scripts/deploy_remote.sh", "/root/deploy_news.sh")
|
||||
sftp.chmod("/root/deploy_news.sh", 0o755)
|
||||
sftp.close()
|
||||
print("[ok] script pushed")
|
||||
|
||||
# 2) 杀掉旧进程(若有)
|
||||
si, so, se = c.exec_command("pkill -f deploy_news.sh 2>/dev/null; sleep 2; echo done")
|
||||
print(so.read().decode().strip())
|
||||
|
||||
# 3) 后台启动,设 SSHD_PORT=19717
|
||||
si, so, se = c.exec_command("nohup env SSHD_PORT=19717 bash /root/deploy_news.sh > /root/deploy_news.log 2>&1 & echo $!", timeout=10)
|
||||
pid = so.read().decode().strip()
|
||||
print(f"[ok] deploy started, PID={pid}")
|
||||
c.close()
|
||||
Reference in New Issue
Block a user