This commit is contained in:
nearxos
2026-02-20 09:47:24 +02:00
parent b33afb41dc
commit a1c60cb7e4

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash
# Deploy only the dashboard to the LXC by IP (no Proxmox host needed).
# Uses rsync so all files (app, templates, service file, etc.) stay in sync.
# Usage: ./deploy-dashboard-to-lxc.sh [user@lxc_ip]
# Example: ./deploy-dashboard-to-lxc.sh root@10.130.60.119
@@ -16,13 +17,17 @@ if [[ ! -d "$DASHBOARD_DIR" ]]; then
fi
echo "Deploying dashboard to $LXC ($REMOTE_DIR) ..."
ssh "$LXC" "mkdir -p $REMOTE_DIR/templates"
# Ensure remote has rsync (Debian/Ubuntu LXC)
ssh "$LXC" "command -v rsync >/dev/null 2>&1 || (apt-get update -qq && apt-get install -y rsync)"
scp -q "$DASHBOARD_DIR/app.py" "$DASHBOARD_DIR/cm4-dashboard.service" "$LXC:$REMOTE_DIR/"
for f in "$DASHBOARD_DIR"/templates/*; do
[[ -f "$f" ]] && scp -q "$f" "$LXC:$REMOTE_DIR/templates/"
done
# Sync entire dashboard: app, templates, service file, README, requirements, etc.
rsync -avz --delete \
--exclude='.git' \
--exclude='__pycache__' \
--exclude='*.pyc' \
--exclude='.env' \
"$DASHBOARD_DIR/" \
"$LXC:$REMOTE_DIR/"
echo "Installing systemd unit and restarting ..."
ssh "$LXC" "cp $REMOTE_DIR/cm4-dashboard.service /etc/systemd/system/ && systemctl daemon-reload && systemctl restart cm4-dashboard && systemctl is-active --quiet cm4-dashboard && echo 'Dashboard restarted and running.'"