chore(sylvania): artefacts - SQL spawn Klauss, scripts ops (reconcile/rollback), README du fork

This commit is contained in:
SylvaniaCore deploy
2026-06-17 09:02:33 +00:00
parent 23bfb33b30
commit 121a33dd2f
4 changed files with 85 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
# ROLLBACK vers ArgusCore (ancien stack intact, bases auth/characters/world figees).
set -x
touch /home/ubuntu/scripts/world-watchdog.disabled /home/ubuntu/scripts/bnet-watchdog.disabled
tmux kill-session -t world 2>/dev/null; pkill -f 'dc-server/bin/worldserver' 2>/dev/null
pkill -x bnetserver 2>/dev/null; sleep 4
# restaurer watchdogs ArgusCore
[ -f /home/ubuntu/scripts/world-watchdog.sh.arguscore ] && cp /home/ubuntu/scripts/world-watchdog.sh.arguscore /home/ubuntu/scripts/world-watchdog.sh
[ -f /home/ubuntu/scripts/bnet-watchdog.sh.arguscore ] && cp /home/ubuntu/scripts/bnet-watchdog.sh.arguscore /home/ubuntu/scripts/bnet-watchdog.sh
# restaurer site
[ -f /var/www/html/config/secrets.php.precutover ] && sudo cp /var/www/html/config/secrets.php.precutover /var/www/html/config/secrets.php
# relancer ANCIEN stack
cd /home/ubuntu/server/bin && setsid ./bnetserver > /home/ubuntu/bnet.log 2>&1 < /dev/null &
tmux new-session -d -s world "cd /home/ubuntu/server/bin && ./worldserver 2>&1 | tee -a /home/ubuntu/world.log"
# reactiver watchdogs (ArgusCore)
rm -f /home/ubuntu/scripts/world-watchdog.disabled /home/ubuntu/scripts/bnet-watchdog.disabled
echo "ROLLBACK fait : ArgusCore relance, site repointe, watchdogs ArgusCore ON."
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
# reconcile_schema.sh <GOLDEN_DB> <TARGET_DB>
# Ajoute au TARGET les tables et colonnes presentes dans GOLDEN mais absentes (additif, non destructif).
G="$1"; T="$2"
Q(){ sudo mysql -N -e "$1"; }
# Tables golden absentes du target -> creation (structure seule)
for tbl in $(Q "SELECT table_name FROM information_schema.tables WHERE table_schema='$G' AND table_type='BASE TABLE' AND table_name NOT IN (SELECT table_name FROM information_schema.tables WHERE table_schema='$T')"); do
echo " + TABLE $tbl"
sudo mysqldump --no-data --no-tablespaces "$G" "$tbl" | grep -ivE '^[[:space:]]*(USE|CREATE DATABASE|DROP DATABASE)' | sudo mysql "$T"
done
# Colonnes golden (tables communes) absentes du target -> ALTER ADD
Q "SELECT c.table_name,c.column_name,c.column_type,c.is_nullable,c.extra
FROM information_schema.columns c
WHERE c.table_schema='$G'
AND c.table_name IN (SELECT table_name FROM information_schema.tables WHERE table_schema='$T')
AND NOT EXISTS (SELECT 1 FROM information_schema.columns t WHERE t.table_schema='$T' AND t.table_name=c.table_name AND t.column_name=c.column_name)" \
| while IFS=$'\t' read tbl col ctype isnull extra; do
nullsql="NULL"; [ "$isnull" = "NO" ] && nullsql="NOT NULL DEFAULT 0"
echo " + COLONNE $tbl.$col ($ctype)"
sudo mysql "$T" -e "ALTER TABLE \`$tbl\` ADD COLUMN \`$col\` $ctype $nullsql $extra" 2>&1 | grep -v '^$' || true
done