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>
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""切换 book.nomadro.com → ebook + 重建"""
|
|
import paramiko, sys
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
HOST = "107.173.30.245"
|
|
PASS = "Xiao4669805"
|
|
|
|
REMOTE = """set -e
|
|
export GIT_USER=eric
|
|
export GIT_PASS=Xiao4669805
|
|
export NEXT_PUBLIC_SITE_URL=https://book.nomadro.com
|
|
export NEXT_PUBLIC_SHARE_CAMPAIGN=nomad-code
|
|
|
|
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
|
|
|
|
bash deploy/install.sh
|
|
|
|
mkdir -p /etc/caddy/sites
|
|
cp deploy/caddy-book.caddy /etc/caddy/sites/book.nomadro.com.caddy
|
|
rm -f /etc/caddy/sites/book.caddy
|
|
caddy validate --config /etc/caddy/Caddyfile
|
|
systemctl reload caddy
|
|
|
|
sleep 2
|
|
curl -sk -o /dev/null -w 'https:%{http_code}\n' https://book.nomadro.com/
|
|
curl -s https://book.nomadro.com/ | head -c 200
|
|
echo
|
|
"""
|
|
|
|
client = paramiko.SSHClient()
|
|
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
print("Deploying book.nomadro.com...")
|
|
client.connect(HOST, username="root", password=PASS, timeout=30, banner_timeout=60)
|
|
_, stdout, _ = client.exec_command(REMOTE, get_pty=True)
|
|
for line in iter(stdout.readline, ""):
|
|
print(line, end="", flush=True)
|
|
code = stdout.channel.recv_exit_status()
|
|
client.close()
|
|
sys.exit(code)
|