Shield external portal jumps (keep EXTERNAL_* for later), serve /nav from static build, and proxy /book + /community to vertical Next apps with Caddy notes. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
import paramiko, sys
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
HOST = "107.173.30.245"
|
|
REMOTE = r"""set -e
|
|
export GIT_PASS=Xiao4669805
|
|
cd /var/www/ebook
|
|
git remote set-url origin https://eric:Xiao4669805@gitea.dsx2020.com/eric/ebook.git
|
|
git fetch origin dev1 && git reset --hard origin/dev1
|
|
cp deploy/caddy-book.caddy /etc/caddy/sites/book.nomadro.com.caddy
|
|
caddy validate --config /etc/caddy/Caddyfile
|
|
systemctl reload caddy
|
|
pm2 delete ebook 2>/dev/null || true
|
|
fuser -k 3022/tcp 2>/dev/null || true
|
|
pm2 start /var/www/ebook/deploy/ecosystem.config.cjs
|
|
pm2 save
|
|
sleep 2
|
|
pm2 describe ebook | head -20
|
|
curl -s -o /dev/null -w 'app:%{http_code}\n' http://127.0.0.1:3022/
|
|
curl -s -m 40 -H 'Content-Type: application/json' -d '{"amount":5}' http://127.0.0.1:3022/api/pay/invoice | head -c 300
|
|
echo
|
|
"""
|
|
client = paramiko.SSHClient()
|
|
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
client.connect(HOST, username="root", password="Xiao4669805", timeout=30)
|
|
_, stdout, _ = client.exec_command(REMOTE, get_pty=True)
|
|
for line in iter(stdout.readline, ""):
|
|
print(line, end="", flush=True)
|
|
print("exit", stdout.channel.recv_exit_status())
|
|
client.close()
|