refactor: replace old bot code with Matrix infra configs and scripts
- Remove obsolete Python bot (Wordle, commands, callbacks, welcome) - Add hookshot/ — all 11 webhook transformation functions + deploy.sh - Add cinny/ — config.json and dev-update.sh (nightly dev branch build) - Add landing/ — matrix.lotusguild.org landing page HTML - Add systemd/ — livekit-server, draupnir, cinny cron unit files - Add draupnir/ — production config (access token redacted) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
59
cinny/dev-update.sh
Normal file
59
cinny/dev-update.sh
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
# Cinny dev branch nightly build and deploy
|
||||
set -e
|
||||
|
||||
REPO_DIR="/opt/cinny-dev"
|
||||
WEB_ROOT="/var/www/html"
|
||||
CONFIG_SAVED="/opt/cinny-dev/.cinny-config.json"
|
||||
BUILD_DIR="/opt/cinny-dev/dist"
|
||||
LOG="/var/log/cinny-dev-update.log"
|
||||
|
||||
exec >> "$LOG" 2>&1
|
||||
echo "=== $(date) === Starting Cinny dev update ==="
|
||||
|
||||
# Save config from live site (skip if web root is already broken)
|
||||
if [ -f "$WEB_ROOT/config.json" ]; then
|
||||
cp "$WEB_ROOT/config.json" "$CONFIG_SAVED"
|
||||
fi
|
||||
|
||||
# Pull latest dev
|
||||
cd "$REPO_DIR"
|
||||
git fetch --depth=1 origin dev
|
||||
PREV=$(git rev-parse HEAD)
|
||||
git reset --hard origin/dev
|
||||
NEW=$(git rev-parse HEAD)
|
||||
|
||||
if [ "$PREV" = "$NEW" ]; then
|
||||
echo "No changes since last build ($NEW), skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "New commits since $PREV, building $NEW..."
|
||||
|
||||
# Clean previous dist so stale files don't get deployed on partial build
|
||||
rm -rf "$BUILD_DIR"
|
||||
|
||||
# Build — cap at 896MB to stay within 1GB RAM + swap headroom
|
||||
export NODE_OPTIONS='--max_old_space_size=896'
|
||||
npm ci 2>&1 | tail -5
|
||||
npm run build 2>&1 | tail -10
|
||||
|
||||
# Verify build actually produced output before touching web root
|
||||
if [ ! -f "$BUILD_DIR/index.html" ]; then
|
||||
echo "ERROR: Build failed — dist/index.html missing. Web root untouched."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Deploy only now that we know the build succeeded
|
||||
rm -rf "$WEB_ROOT"/*
|
||||
cp -r "$BUILD_DIR"/* "$WEB_ROOT/"
|
||||
|
||||
# Restore config
|
||||
if [ -f "$CONFIG_SAVED" ]; then
|
||||
cp "$CONFIG_SAVED" "$WEB_ROOT/config.json"
|
||||
else
|
||||
echo "WARNING: No saved config found — default config from build will be used."
|
||||
fi
|
||||
|
||||
nginx -s reload
|
||||
echo "=== Deploy complete: $NEW ==="
|
||||
Reference in New Issue
Block a user