Files

Remote (VPS) deployment

Use nginx in front of the Python asset server for VPS hosting.

1. Put a real static edge in front of the asset server

nginx provides a disk cache and HTTP byte-range support for asset downloads. The server prepares smaller card bundles before accepting players; see asset performance and cache settings.

client ──HTTP :8000──> nginx (cache + range) ──> Python asset server 127.0.0.1:8001

Run the Python server on 8001 so nginx can own the public port:

sudo SPIRIT_HTTP_PORT=8001 SPIRIT_PUBLIC_HOST=YOUR_VPS_IP bash run.sh

AssetURL is built from the client's Host header, so it keeps resolving to :8000 (nginx) with no server code change.

nginx setup

Stand up the edge on the VPS:

sudo cp deploy/nginx-spirit.conf /etc/nginx/sites-available/spirit
sudo ln -s /etc/nginx/sites-available/spirit /etc/nginx/sites-enabled/
sudo mkdir -p /var/cache/spirit_assets && sudo chown www-data:www-data /var/cache/spirit_assets
sudo nginx -t && sudo systemctl reload nginx

Then start the game server on 8001 (command above). Firewall: open 8000 (nginx) and 39389 (TCP game server); keep 8001 closed — nginx reaches Python over loopback.

Verify range/resume works

# should return HTTP/1.1 206 Partial Content and a Content-Range header
curl -s -D- -o /dev/null -r 0-1023 http://YOUR_VPS_IP:8000/en_US/en_US_SWSH8.unity3d
# second hit should show X-Cache-Status: HIT (nginx)
curl -s -D- -o /dev/null http://YOUR_VPS_IP:8000/en_US/en_US_SWSH8.unity3d | grep -i x-cache

2. (Optional) config.py default host

spirit/config.py defaults PUBLIC_HOST to a hardcoded IP. On the VPS always set SPIRIT_PUBLIC_HOST=YOUR_VPS_IP (env) rather than relying on the committed default — it's the address the Warg login handshake redirects clients to for TCP.