Introduce production-ready CLI for hosting Commonwealth Online servers in cloud and on-premises environments. Features: - Server orchestration service (server_service.py) wrapping relay lifecycle - JSON configuration system (config.py) for hosted deployments - Typer+Rich CLI (consumer_server_cli.py) with serve/status/clients/world commands - Windows launcher (start.bat) for one-click server startup - Auto-detection of LAN addresses and dependency installation - Machine-readable JSON output for monitoring and automation Cli commands: serve - Start server with optional config overrides status - Display server stats and packet counters clients - List connected players world time - Set in-game time for all clients world weather - Set weather for all clients config init - Generate default configuration file Documentation: - Updated docs/setup.md with CLI quick-start guide - Added server/README.md with usage instructions - Updated changelog and dev-log with test results Testing: - Verified config generation and loading - Verified server startup banner and LAN detection - Verified fake client connection and welcome packet - Verified CLI help and command routing Co-authored-by: Cursor <cursoragent@cursor.com>
Commonwealth Online Server - Quick Start
For Windows Users
Simply double-click start.bat to launch the server:
start.bat
The script will:
- Check that Python 3.9+ is installed
- Install required dependencies (typer, rich)
- Generate a default
commonwealth-server.jsonconfig file (if needed) - Start the server listening on
0.0.0.0:7777
First Run
On first run, a default commonwealth-server.json file is created in the server directory with these settings:
{
"host": "0.0.0.0",
"port": 7777,
"server_name": "Commonwealth Online Server",
"max_players": 16,
"log_verbosity": "info"
}
Customizing the Server
Edit commonwealth-server.json to customize:
- host: Bind address (default
0.0.0.0for all interfaces) - port: Server port (default
7777) - server_name: Display name
- max_players: Metadata for client displays
- log_verbosity:
debug,info,warning, orerror
Connecting Clients
Once the server is running:
- Local PC: Connect to
127.0.0.1:7777 - LAN: Connect to your PC's local IP (displayed on startup, e.g.,
192.168.1.64:7777) - Remote: Forward port 7777/TCP on your router and use your public IP
Stopping the Server
Press Ctrl+C in the terminal to stop the server gracefully.
For Advanced Users (Command Line)
If you prefer command-line usage, use the CLI directly:
cd server
pip install -r requirements.txt
# Generate config
python consumer_server_cli.py config init my-config.json
# Start server
python consumer_server_cli.py serve --config my-config.json
# Check server status (from another terminal)
python consumer_server_cli.py status
# List connected clients
python consumer_server_cli.py clients
# Set in-game time
python consumer_server_cli.py world time 1430
# Set weather
python consumer_server_cli.py world weather 0002b52a
Run python consumer_server_cli.py --help to see all available commands.