This guide covers deploying Lode Runner 2099 to a production environment with optimal performance.
The production setup uses:
- Vite for building optimized static assets
- Go server for serving files with proper caching headers
- systemd for process management and auto-restart
- Node.js 18+ and npm
- Go 1.21+
- Linux server with systemd
- (Optional) Reverse proxy like nginx or Caddy for HTTPS
# Install dependencies
npm install
# Build production assets
npm run buildThis creates optimized files in dist/:
index.html- Entry pointassets/*.js- Bundled JavaScript with content hashesassets/*.css- Bundled styles with content hashes
The Go server (server.go) provides:
- Static file serving from
dist/ - Optimized caching headers
- Gzip compression support
# Build the server binary
go build -o server server.goThe server implements a smart caching strategy:
| File Type | Cache Control | Rationale |
|---|---|---|
index.html |
no-cache, must-revalidate |
Always check for updates |
*.js, *.css (hashed) |
max-age=31536000, immutable |
1 year, content-addressed |
| Images | max-age=604800 |
1 week |
| Fonts | max-age=31536000, immutable |
1 year |
| Other | max-age=3600 |
1 hour default |
This ensures:
- Users always get the latest
index.html - Hashed assets are cached aggressively (they change on every build)
- Good balance of freshness and performance
Create /etc/systemd/system/loderunner2099.service:
[Unit]
Description=Lode Runner 2099 Game Server
After=network.target
[Service]
Type=simple
User=exedev
Group=exedev
WorkingDirectory=/home/exedev/loderunner2099
ExecStart=/home/exedev/loderunner2099/server
Restart=always
RestartSec=5
# Security hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ReadWritePaths=/home/exedev/loderunner2099
[Install]
WantedBy=multi-user.target# Copy service file
sudo cp loderunner2099.service /etc/systemd/system/
# Reload systemd
sudo systemctl daemon-reload
# Enable auto-start on boot
sudo systemctl enable loderunner2099
# Start the service
sudo systemctl start loderunner2099# Check status
sudo systemctl status loderunner2099
# View logs
journalctl -u loderunner2099 -f
# Restart after updates
sudo systemctl restart loderunner2099
# Stop the service
sudo systemctl stop loderunner2099Create a deploy.sh script for easy updates:
#!/bin/bash
set -e
echo "Building game assets..."
npm run build
echo "Building server..."
go build -o server server.go
echo "Restarting service..."
sudo systemctl restart loderunner2099
echo "Deployment complete!"
sudo systemctl status loderunner2099 --no-pagerchmod +x deploy.sh
./deploy.shThe Go server listens on port 8000 by default. Key configuration in server.go:
const (
port = ":8000"
distDir = "dist"
)To change the port, modify server.go and rebuild.
For production HTTPS, use a reverse proxy. Example with Caddy:
loderunner2099.example.com {
reverse_proxy localhost:8000
}
Or with nginx:
server {
listen 443 ssl http2;
server_name loderunner2099.example.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}The server responds to requests at / with the game. For monitoring, check:
curl -I http://localhost:8000/Expected: HTTP/1.1 200 OK
# Recent errors
journalctl -u loderunner2099 -p err -n 50
# Access patterns (if logging enabled)
journalctl -u loderunner2099 --since "1 hour ago"# Check for errors
journalctl -u loderunner2099 -n 100
# Verify binary exists and is executable
ls -la /home/exedev/loderunner2099/server
# Test running manually
cd /home/exedev/loderunner2099 && ./server# Find what's using port 8000
sudo lsof -i :8000
# Kill the process or change the port in server.go- Ensure
npm run buildcompleted successfully - Hard refresh browser (Ctrl+Shift+R)
- Check that
dist/contains new files with new hashes - Verify server was restarted after build
- Enable gzip - The Go server supports Accept-Encoding; ensure your proxy passes it through
- Use HTTP/2 - Configure your reverse proxy for HTTP/2 support
- CDN - For global distribution, put a CDN in front of the server
- Preload hints - The
index.htmlcan include preload hints for critical assets