From b9a251bd7a73d35fc5e8cacf42cdf4092ada1003 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Mon, 20 Apr 2026 16:18:10 -0400 Subject: [PATCH] Integrate matrixbot into existing LXC 151 deploy hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed standalone matrixbot/deploy.sh — deploy is handled by the existing webhook system. Added matrixbot/ block to deploy/lxc151-hookshot.sh: on push, if any matrixbot/ file changed, source files are synced to /opt/matrixbot and matrixbot.service is restarted automatically. Co-Authored-By: Claude Sonnet 4.6 --- deploy/lxc151-hookshot.sh | 21 ++++++++++++++++++++- matrixbot/deploy.sh | 23 ----------------------- 2 files changed, 20 insertions(+), 24 deletions(-) delete mode 100644 matrixbot/deploy.sh diff --git a/deploy/lxc151-hookshot.sh b/deploy/lxc151-hookshot.sh index 0c8c5fa..2f392a2 100644 --- a/deploy/lxc151-hookshot.sh +++ b/deploy/lxc151-hookshot.sh @@ -1,6 +1,6 @@ #!/bin/bash # Auto-deploy script for LXC 151 (matrix homeserver) -# Handles: hookshot transformation functions, livekit service file (graceful) +# Handles: hookshot transformation functions, livekit service file (graceful), matrixbot # Triggered by: Gitea webhook on push to main set -euo pipefail @@ -45,6 +45,25 @@ else touch /run/livekit-restart-pending echo "Restart pending — will apply when no active calls." fi + + # Matrixbot source files + if echo "$CHANGED" | grep -q '^matrixbot/'; then + echo "Deploying matrixbot changes..." + BOT_DIR="/opt/matrixbot" + BOT_FILES="bot.py callbacks.py commands.py config.py utils.py welcome.py wordle.py wordlist_answers.py wordlist_valid.py requirements.txt" + for f in $BOT_FILES; do + if [ -f "$REPO_DIR/matrixbot/$f" ]; then + cp "$REPO_DIR/matrixbot/$f" "$BOT_DIR/$f" + fi + done + systemctl restart matrixbot + sleep 2 + if systemctl is-active --quiet matrixbot; then + echo "matrixbot restarted successfully." + else + echo "ERROR: matrixbot failed to restart." + fi + fi fi echo "=== $(date) === LXC151 deploy complete ===" diff --git a/matrixbot/deploy.sh b/matrixbot/deploy.sh deleted file mode 100644 index 86b10cf..0000000 --- a/matrixbot/deploy.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# Deploy script for matrixbot on LXC 151 -# Run as root on LXC 151: bash /opt/matrixbot/deploy.sh -set -e - -REPO_DIR="$(cd "$(dirname "$0")" && pwd)" -BOT_DIR="/opt/matrixbot" -SERVICE="matrixbot" - -echo "[deploy] Pulling latest from git..." -cd "$REPO_DIR" -git pull - -echo "[deploy] Syncing source files to $BOT_DIR..." -FILES="bot.py callbacks.py commands.py config.py utils.py welcome.py wordle.py wordlist_answers.py wordlist_valid.py requirements.txt" -for f in $FILES; do - cp "$REPO_DIR/$f" "$BOT_DIR/$f" -done - -echo "[deploy] Restarting $SERVICE..." -systemctl restart "$SERVICE" -sleep 2 -systemctl is-active "$SERVICE" && echo "[deploy] Done — $SERVICE is running." || echo "[deploy] ERROR — $SERVICE failed to start."