feat(deploy): sync CyberSecur-Global to CT7810 via pct; optional CF cache purge
Made-with: Cursor
This commit is contained in:
38
scripts/deployment/sync-cybersecur-global-to-ct7810.sh
Executable file
38
scripts/deployment/sync-cybersecur-global-to-ct7810.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# Deploy CyberSecur-Global static site to CT 7810 (no direct SSH to container IP required).
|
||||
# Uses SSH to Proxmox host + pct exec (same pattern as operator workflows).
|
||||
#
|
||||
# Prerequisites: SSH key to root@PROXMOX_HOST (default r630-02); CT 7810 running nginx with
|
||||
# root /var/www/cybersecur-d-bis (see deploy/nginx-cybersecur-d-bis.conf.example in repo).
|
||||
#
|
||||
# Usage:
|
||||
# CYBERSECUR_REPO=/path/to/CyberSecur-Global ./scripts/deployment/sync-cybersecur-global-to-ct7810.sh
|
||||
#
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
# shellcheck disable=1091
|
||||
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
|
||||
|
||||
REPO="${CYBERSECUR_REPO:-${PROJECT_ROOT}/../CyberSecur-Global}"
|
||||
REPO="$(cd "$REPO" && pwd)"
|
||||
PROXMOX_HOST="${CYBERSECUR_PROXMOX_HOST:-${PROXMOX_HOST_R630_02:-192.168.11.12}}"
|
||||
VMID="${CYBERSECUR_VMID:-7810}"
|
||||
REMOTE="${CYBERSECUR_REMOTE_PATH:-/var/www/cybersecur-d-bis}"
|
||||
|
||||
if [[ ! -f "$REPO/index.html" ]]; then
|
||||
echo "❌ CYBERSECUR_REPO must point to CyberSecur-Global clone (missing index.html): $REPO" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Packing $REPO → root@${PROXMOX_HOST} pct exec $VMID → ${REMOTE}/"
|
||||
(
|
||||
cd "$REPO"
|
||||
tar czf - \
|
||||
--exclude=.git \
|
||||
--exclude='deploy/*.sh' \
|
||||
.
|
||||
) | ssh -o BatchMode=yes "root@${PROXMOX_HOST}" \
|
||||
"pct exec ${VMID} -- bash -c 'set -euo pipefail; mkdir -p ${REMOTE}; tar xzf - -C ${REMOTE}; chown -R www-data:www-data ${REMOTE}; nginx -t && systemctl reload nginx'"
|
||||
|
||||
echo "✓ Deployed. Verify: curl -sSI https://cybersecur.d-bis.org/robots.txt https://cybersecur.d-bis.org/sitemap.xml https://cybersecur.d-bis.org/favicon.ico | head"
|
||||
Reference in New Issue
Block a user