Server Installation
This guide walks you through setting up a new PlayRen game server from a fresh Ubuntu installation.
Prerequisites
Before starting, make sure your server meets the prerequisites. You'll need:
- A fresh Ubuntu 22.04+ server with root access.
- A DNS record pointing a hostname to the server (e.g.,
gs01.play.ren.bd). - SSH access to the server.
Step 1: Download the Setup Script
SSH into your server and download the game server setup script:
ssh root@gs01.play.ren.bd
# Download the setup script
curl -O https://play.ren.bd/deploy/setup-game-server.sh
chmod +x setup-game-server.shStep 2: Run the Setup Script
Execute the script with the required parameters:
./setup-game-server.sh \
--hostname gs01.play.ren.bd \
--platform-url https://play.ren.bd \
--agent-secret your-agent-secret-hereWhat the Script Does
The setup script automates the entire installation:
- System updates — runs
apt update && apt upgrade. - Docker installation — installs Docker Engine and configures the Docker daemon.
- Docker image — pulls or builds the
xgame9-cloud:latestcontainer image. - Python environment — installs Python 3.10+, creates a virtual environment, and installs pool agent dependencies.
- Pool agent deployment — copies the agent code to
/home/play.ren.bd/pool-agent/and configures it. - Systemd service — creates and enables the
xgame9-agentservice for automatic startup. - Nginx configuration — sets up a reverse proxy for the pool agent API.
- SSL certificates — runs Certbot to provision Let's Encrypt certificates for your hostname.
- Firewall — configures
ufwto allow SSH, HTTP, HTTPS, and WebRTC UDP ports. - Directories — creates game cache and temporary directories.
The script takes approximately 5-10 minutes to complete.
Step 3: Verify the Agent
After the script completes, verify that the pool agent is running:
# Check systemd service status
systemctl status xgame9-agent
# Test the health endpoint
curl https://gs01.play.ren.bd/api/healthThe health endpoint should return:
{
"status": "ok",
"containers": 0,
"cpu_percent": 5.2,
"memory_percent": 12.8,
"disk_percent": 15.0
}Step 4: Register the Server
Add the server to PlayRen's database so the scheduler can assign sessions to it. This is done through the admin panel:
- Log in to the PlayRen admin panel at
https://play.ren.bd/admin. - Navigate to Servers.
- Click Add Server.
- Enter:
- Name: A friendly identifier (e.g., "Game Server 01").
- Hostname: The server's hostname (e.g.,
gs01.play.ren.bd). - Agent URL:
https://gs01.play.ren.bd(the Nginx-proxied agent endpoint). - Agent Secret: The same secret you used in the setup script.
- Max containers: The recommended concurrent session limit for this server.
- Click Save.
The server is now live and will start receiving game sessions.
Step 5: Test a Launch
To verify everything works end-to-end:
- Go to the PlayRen website and launch a game.
- Check if the session is assigned to your new server (visible in the admin session list).
- Verify the game streams correctly in the browser.
Troubleshooting
- Agent won't start — check logs with
journalctl -u xgame9-agent -f. - SSL fails — ensure DNS is properly configured and port 80 is accessible for the ACME challenge.
- Docker issues — run
docker infoto verify Docker is running. Checkdocker psfor container status. - Firewall blocking — run
ufw statusto verify the correct ports are open.
Next Steps
- Configuration — Fine-tune agent settings and review firewall rules.
- Monitoring — Set up health checks and monitor server metrics.