Compare commits

...

1 Commits

Author SHA1 Message Date
Alexander Whitestone
9c7b558d20 fix(evennia): Bezalel settings — remove bad port tuples, fix crash (#534)
Some checks failed
Self-Healing Smoke / self-healing-smoke (pull_request) Failing after 26s
Smoke Test / smoke (pull_request) Failing after 28s
Agent PR Gate / gate (pull_request) Failing after 37s
Agent PR Gate / report (pull_request) Successful in 7s
- Add evennia/bezalel_world/server/conf/settings.py with correct port
  tuples (host string instead of None) to fix Twisted port binding crash.
- Update scripts/fix_evennia_settings.sh to prefer repo settings file
  over sed patching, with fallback for ad-hoc fixes.
- Add evennia/bezalel_world/server/README.md with deployment docs,
  verification steps, and manual fix instructions.

Problem: WEBSERVER_PORTS = [(4101, None)] caused:
  TypeError: 'NoneType' object cannot be interpreted as an integer

Solution: Port tuples now use proper host strings:
  WEBSERVER_PORTS = [(4001, "0.0.0.0")]
  TELNET_PORTS = [(4000, "0.0.0.0")]
  WEBSOCKET_PORTS = [(4002, "0.0.0.0")]

Closes #534
2026-04-22 03:24:35 -04:00
4 changed files with 185 additions and 4 deletions

View File

@@ -0,0 +1,87 @@
# Bezalel World Server Configuration
This directory contains the Evennia server configuration for Bezalel, the forge-and-testbed wizard house.
## Quick Start
To fix the Evennia settings on the Bezalel VPS (104.131.15.18):
```bash
# SSH to Bezalel and run the fix script
ssh root@104.131.15.18 'bash -s' < scripts/fix_evennia_settings.sh
```
Or manually:
```bash
cd /root/wizards/bezalel/evennia/bezalel_world/server/conf
# Copy the fixed settings
cp ~/timmy-home/evennia/bezalel_world/server/conf/settings.py ./settings.py
# Clean and reinitialize DB
cd /root/wizards/bezalel/evennia/bezalel_world
rm -f server/evennia.db3
/root/wizards/bezalel/evennia/venv/bin/evennia migrate
# Create superuser
/root/wizards/bezalel/evennia/venv/bin/python3 -c "
import sys, os
sys.setrecursionlimit(5000)
os.environ['DJANGO_SETTINGS_MODULE'] = 'server.conf.settings'
import django
django.setup()
from evennia.accounts.accounts import AccountDB
AccountDB.objects.create_superuser('Timmy', 'timmy@tower.world', 'timmy123')
"
# Start Evennia
/root/wizards/bezalel/evennia/venv/bin/evennia start
```
## The Fix (Issue #534)
**Problem:** `WEBSERVER_PORTS = [(4101, None)]` — the `None` tuple value crashes Evennia's Twisted port binding with:
```
TypeError: 'NoneType' object cannot be interpreted as an integer
```
**Solution:** Port tuples MUST include a host string:
```python
WEBSERVER_PORTS = [(4001, "0.0.0.0")]
TELNET_PORTS = [(4000, "0.0.0.0")]
WEBSOCKET_PORTS = [(4002, "0.0.0.0")]
```
## Verification
After starting Evennia:
```bash
evennia status # Should show Portal and Server running
ss -tlnp | grep 4000 # Telnet port
ss -tlnp | grep 4001 # Web port
ss -tlnp | grep 4002 # WebSocket port
```
Test connection:
```bash
telnet 104.131.15.18 4000
```
## File Structure
```
server/
├── conf/
│ ├── __init__.py
│ └── settings.py # Main settings file (FIXED for #534)
├── logs/ # Evennia logs
└── evennia.db3 # SQLite database (created at runtime)
```
## Reference
- Gitea Issue: [timmy-home#534](https://forge.alexanderwhitestone.com/Timmy_Foundation/timmy-home/issues/534)
- Evennia Docs: https://www.evennia.com/docs/latest/Setup/Settings-Default.html
- World Plan: docs/BEZALEL_EVENNIA_WORLD.md

View File

@@ -0,0 +1,87 @@
r"""
Evennia settings file for Bezalel World.
This is the sovereign Evennia configuration for the Bezalel forge-and-testbed wizard.
Reference: timmy-home#534
The available options are found in the default settings file found here:
https://www.evennia.com/docs/latest/Setup/Settings-Default.html
"""
# Use the defaults from Evennia unless explicitly overridden
from evennia.settings_default import *
######################################################################
# Evennia base server config
######################################################################
# Server name
SERVERNAME = "bezalel_world"
######################################################################
# Network ports - FIXED for #534
# Port tuples MUST include a host string, not None
######################################################################
# Web server port (HTTP)
WEBSERVER_PORTS = [(4001, "0.0.0.0")]
# Telnet server port
TELNET_PORTS = [(4000, "0.0.0.0")]
# WebSocket port for webclient
WEBSOCKET_PORTS = [(4002, "0.0.0.0")]
######################################################################
# Database configuration
# Using SQLite for sovereign local deployment
######################################################################
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(GAME_DIR, 'server', 'evennia.db3'),
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': ''
}
}
######################################################################
# Security settings
######################################################################
# Lockdown mode for VPS - only bind to localhost unless needed
# To allow external connections, use 0.0.0.0 in port tuples above
ALLOWED_HOSTS = ['*'] # VPS needs this for external access
######################################################################
# Game world defaults
######################################################################
# Start location for new characters
DEFAULT_HOME = "#2" # Limbo
# Start location for guests
GUEST_HOME = "#2"
######################################################################
# Telnet settings
######################################################################
TELNET_INTERFACES = ['0.0.0.0']
######################################################################
# Web server settings
######################################################################
WEBSERVER_INTERFACES = ['0.0.0.0']
######################################################################
# Settings given in secret_settings.py override those in this file.
######################################################################
try:
from server.conf.secret_settings import *
except ImportError:
print("secret_settings.py file not found or failed to import.")

View File

@@ -15,13 +15,20 @@ 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"
TIMMY_HOME="${TIMMY_HOME:-/root/timmy-home}" # Or wherever the repo is cloned
echo "=== Fix Evennia Settings (Bezalel) ==="
# 1. Fix settings.py — remove bad port tuples
# 1. Fix settings.py — prefer repo version, fallback to sed patch
echo "Fixing settings.py..."
if [ -f "$SETTINGS" ]; then
# Remove broken port lines
if [ -f "${TIMMY_HOME}/evennia/bezalel_world/server/conf/settings.py" ]; then
# Use the fixed settings from the repo
mkdir -p "$(dirname "$SETTINGS")"
cp "${TIMMY_HOME}/evennia/bezalel_world/server/conf/settings.py" "$SETTINGS"
echo "Copied fixed settings from timmy-home repo."
elif [ -f "$SETTINGS" ]; then
# Fallback: patch in place
echo "Patching existing settings..."
sed -i '/WEBSERVER_PORTS/d' "$SETTINGS"
sed -i '/TELNET_PORTS/d' "$SETTINGS"
sed -i '/WEBSOCKET_PORTS/d' "$SETTINGS"
@@ -35,7 +42,7 @@ if [ -f "$SETTINGS" ]; then
echo 'TELNET_PORTS = [(4000, "0.0.0.0")]' >> "$SETTINGS"
echo 'WEBSOCKET_PORTS = [(4002, "0.0.0.0")]' >> "$SETTINGS"
echo "Settings fixed."
echo "Patched existing settings file."
else
echo "ERROR: Settings file not found at $SETTINGS"
exit 1