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>
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
import paramiko, sys
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
HOST = "107.173.30.245"
|
|
PASS = "Xiao4669805"
|
|
|
|
REMOTE = """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
|
|
mkdir -p /etc/caddy/sites
|
|
cp deploy/caddy-book.caddy /etc/caddy/sites/book.caddy
|
|
caddy validate --config /etc/caddy/Caddyfile
|
|
systemctl reload caddy
|
|
sleep 2
|
|
curl -sf -o /dev/null -w 'app:%{http_code}\n' http://127.0.0.1:3000/
|
|
curl -sI -H 'Host: book.noamdro.com' http://127.0.0.1/ | head -5
|
|
curl -sk -o /dev/null -w 'https:%{http_code}\n' https://book.noamdro.com/ || echo https:pending_dns
|
|
"""
|
|
|
|
client = paramiko.SSHClient()
|
|
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
client.connect(HOST, username="root", password=PASS, timeout=30)
|
|
_, stdout, _ = client.exec_command(REMOTE, get_pty=True)
|
|
for line in iter(stdout.readline, ""):
|
|
print(line, end="")
|
|
client.close()
|