Fix dual deploy when physical /opt/douyinWEB has no .git (tarball install).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
eric 2026-09-05 01:25:19 -05:00
parent 732d93e5d4
commit e82407fceb
2 changed files with 24 additions and 2 deletions

View File

@ -55,9 +55,12 @@ def git_sync(c: paramiko.SSHClient, *, sudo_prefix: str, label: str) -> int:
code, _ = run(
c,
f"{sudo_prefix}bash -lc 'set -e; cd {REPO}; "
f"git remote set-url origin \"{REMOTE}\"; "
# Tarball physical installs may lack .git — bootstrap tracking without wiping data/.
f"if [ ! -d .git ]; then git init -b {BRANCH}; fi; "
f"git remote remove origin 2>/dev/null || true; "
f"git remote add origin \"{REMOTE}\"; "
f"git fetch origin {BRANCH}; "
f"git reset --hard HEAD; "
f"git reset --hard HEAD 2>/dev/null || true; "
f"git clean -fd -e backend/data -e frontend/.next -e node_modules -e frontend/node_modules "
f"-e backend/.venv -e .venv -e \"*.db\" -e \"*.db-*\"; "
f"git checkout -f -B {BRANCH} origin/{BRANCH}; "

View File

@ -0,0 +1,19 @@
#!/usr/bin/env python3
"""Deploy origin/test1 to physical guest only (after dylive already OK)."""
from __future__ import annotations
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from _deploy_git_pull_both import PHYSICAL, deploy_host # noqa: E402
if __name__ == "__main__":
raise SystemExit(
deploy_host(
PHYSICAL,
label="physical",
public_health="https://dy.nomadro.com/api/health",
use_sudo=True,
)
)