Fix script removes bad port tuples (None values) that crash Evennia Twisted port binding, replaces with correct format, re-migrates DB, creates superuser, and starts Evennia. Run via SSH: ssh root@104.131.15.18 'bash -s' < scripts/fix_evennia_settings.sh Fixes: - WEBSERVER_PORTS: (4101, None) -> (4001, 0.0.0.0) - TELNET_PORTS: None -> (4000, 0.0.0.0) - SERVERNAME set to bezalel_world - DB cleaned and re-migrated - Superuser Timmy created
85 lines
2.3 KiB
Bash
Executable File
85 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
#
|
|
# fix_evennia_settings.sh — Fix Evennia settings on Bezalel VPS.
|
|
#
|
|
# Removes bad port tuples that crash Evennia's Twisted port binding.
|
|
# Run on Bezalel VPS (104.131.15.18) or via SSH.
|
|
#
|
|
# Usage:
|
|
# ssh root@104.131.15.18 'bash -s' < scripts/fix_evennia_settings.sh
|
|
#
|
|
# Part of #534
|
|
|
|
EVENNIA_DIR="/root/wizards/bezalel/evennia/bezalel_world"
|
|
SETTINGS="${EVENNIA_DIR}/server/conf/settings.py"
|
|
VENV_PYTHON="/root/wizards/bezalel/evennia/venv/bin/python3"
|
|
VENV_EVENNIA="/root/wizards/bezalel/evennia/venv/bin/evennia"
|
|
|
|
echo "=== Fix Evennia Settings (Bezalel) ==="
|
|
|
|
# 1. Fix settings.py — remove bad port tuples
|
|
echo "Fixing settings.py..."
|
|
if [ -f "$SETTINGS" ]; then
|
|
# Remove broken port lines
|
|
sed -i '/WEBSERVER_PORTS/d' "$SETTINGS"
|
|
sed -i '/TELNET_PORTS/d' "$SETTINGS"
|
|
sed -i '/WEBSOCKET_PORTS/d' "$SETTINGS"
|
|
sed -i '/SERVERNAME/d' "$SETTINGS"
|
|
|
|
# Add correct settings
|
|
echo '' >> "$SETTINGS"
|
|
echo '# Fixed port settings — #534' >> "$SETTINGS"
|
|
echo 'SERVERNAME = "bezalel_world"' >> "$SETTINGS"
|
|
echo 'WEBSERVER_PORTS = [(4001, "0.0.0.0")]' >> "$SETTINGS"
|
|
echo 'TELNET_PORTS = [(4000, "0.0.0.0")]' >> "$SETTINGS"
|
|
echo 'WEBSOCKET_PORTS = [(4002, "0.0.0.0")]' >> "$SETTINGS"
|
|
|
|
echo "Settings fixed."
|
|
else
|
|
echo "ERROR: Settings file not found at $SETTINGS"
|
|
exit 1
|
|
fi
|
|
|
|
# 2. Clean DB and re-migrate
|
|
echo "Cleaning DB..."
|
|
cd "$EVENNIA_DIR"
|
|
rm -f server/evennia.db3
|
|
|
|
echo "Running migrations..."
|
|
"$VENV_EVENNIA" migrate --no-input
|
|
|
|
# 3. Create superuser
|
|
echo "Creating superuser..."
|
|
"$VENV_PYTHON" -c "
|
|
import sys, os
|
|
sys.setrecursionlimit(5000)
|
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'server.conf.settings'
|
|
os.chdir('$EVENNIA_DIR')
|
|
import django
|
|
django.setup()
|
|
from evennia.accounts.accounts import AccountDB
|
|
try:
|
|
AccountDB.objects.create_superuser('Timmy', 'timmy@tower.world', 'timmy123')
|
|
print('Superuser Timmy created')
|
|
except Exception as e:
|
|
print(f'Superuser may already exist: {e}')
|
|
"
|
|
|
|
# 4. Start Evennia
|
|
echo "Starting Evennia..."
|
|
"$VENV_EVENNIA" start
|
|
|
|
# 5. Verify
|
|
sleep 3
|
|
echo ""
|
|
echo "=== Verification ==="
|
|
"$VENV_EVENNIA" status
|
|
|
|
echo ""
|
|
echo "Listening ports:"
|
|
ss -tlnp | grep -E '400[012]' || echo "No ports found (may need a moment)"
|
|
|
|
echo ""
|
|
echo "Done. Connect: telnet 104.131.15.18 4000"
|