feat: add db-restore, maintenance, doctor scripts and update dashboard
This commit is contained in:
1 parent
a605807c69
commit
bd977da3a5
4 files changed
+55
No files matched your search
@@ -16,6 +16,9 @@ echo "9) Monitor (./scripts/monitor.sh)"
|
||||
echo "10) Perf Report (./scripts/perf-report.sh)"
|
||||
echo "11) Setup Dev (./scripts/setup-dev.sh)"
|
||||
echo "12) Check Updates (./scripts/check-updates.sh)"
|
||||
echo "13) Restore DB (./scripts/db-restore.sh)"
|
||||
echo "14) Maintenance Mode (./scripts/maintenance.sh)"
|
||||
echo "15) Doctor (./scripts/doctor.sh)"
|
||||
echo "q) Quit"
|
||||
|
||||
read -p "Choice: " choice
|
||||
@@ -33,6 +36,9 @@ case $choice in
|
||||
10) $SCRIPT_DIR/perf-report.sh ;;
|
||||
11) $SCRIPT_DIR/setup-dev.sh ;;
|
||||
12) $SCRIPT_DIR/check-updates.sh ;;
|
||||
13) $SCRIPT_DIR/db-restore.sh ;;
|
||||
14) $SCRIPT_DIR/maintenance.sh ;;
|
||||
15) $SCRIPT_DIR/doctor.sh ;;
|
||||
q) exit 0 ;;
|
||||
*) echo "Invalid choice" ;;
|
||||
esac
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Restore database from a backup
|
||||
cd "$(dirname "$0")/.."
|
||||
BACKUP_DIR="backups"
|
||||
|
||||
echo "Available backups:"
|
||||
ls -1 "$BACKUP_DIR"
|
||||
|
||||
read -p "Enter filename to restore: " filename
|
||||
|
||||
if [ -f "$BACKUP_DIR/$filename" ]; then
|
||||
echo "Restoring $filename..."
|
||||
[ -f .env ] && source .env
|
||||
DB_USER=${MARIADB_USER:-cms}
|
||||
DB_PASS=${MARIADB_PASSWORD:-cms}
|
||||
DB_NAME=${MARIADB_DATABASE:-habbo}
|
||||
|
||||
docker compose exec -T mariadb-turbo mariadb -u"$DB_USER" -p"$DB_PASS" "$DB_NAME" < "$BACKUP_DIR/$filename"
|
||||
echo "Restore complete."
|
||||
else
|
||||
echo "File not found."
|
||||
fi
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# System diagnostic tool
|
||||
echo "=== Doctor Report ==="
|
||||
echo "Checking Docker..."
|
||||
docker ps > /dev/null || echo "Error: Docker not running."
|
||||
|
||||
echo "Checking port 3002..."
|
||||
if lsof -i :3002 > /dev/null; then echo "Port 3002 is in use."; else echo "Port 3002 is free."; fi
|
||||
|
||||
echo "Checking .env..."
|
||||
if [ -f .env ]; then echo ".env exists."; else echo "Error: .env missing."; fi
|
||||
|
||||
echo "Checking health..."
|
||||
if curl -s http://localhost:3002/api/health > /dev/null; then echo "Health endpoint OK."; else echo "Health endpoint failing."; fi
|
||||
|
||||
echo "Disk usage:"
|
||||
df -h / | tail -n 1
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# Toggle maintenance mode
|
||||
FILE=".maintenance"
|
||||
if [ -f "$FILE" ]; then
|
||||
rm "$FILE"
|
||||
echo "Maintenance mode disabled."
|
||||
else
|
||||
touch "$FILE"
|
||||
echo "Maintenance mode enabled."
|
||||
fi
|
||||
Reference in new issue
Block a user