← Back to Rustball

Headless Server

A headless server is a program that runs on a computer of yours, all the time, and hosts Rustball rooms for everyone. Players join it from the Online Game list like any other room. The game runs on your computer, as the authoritative server.

What you need

ItemWhere it comes fromWhat it is for
Headless Grant TokenThe site administrator gives it to you.Authorises you to run servers. If it is revoked, all your servers disconnect at once.
Headless TokenYou create it on the token page, using your Headless Grant Token.Identifies one server. It expires after 2 hours without use; a room that stays open keeps it alive.
A computerYours: a mini PC, a NAS, a Mac, or a Linux machine that stays on.Runs the server. Windows is not supported yet.

Setup in 5 steps

  1. Get a Headless Grant Token from the administrator.
  2. Create a Headless Token on the token page: fill in the bot name, the room name, the visibility, an optional password and your grant, then press Create Headless Token.
  3. Download rustball-headless.toml from that page. It already contains the site, both tokens and your first room. Keep it private.
  4. Download the package for your computer (below) and install it (step 5 of the guide).
  5. Start it and check the log: your room must appear in the Online Game list.

Package for Linux (x86_64) · Package for macOS · Create a Headless Token

Configuration guide: rustball-headless.toml

Plain text, open it with any editor. Lines starting with # are comments.

FieldWhat to write
signal_urlLeave it as it is: wss://www.rustball.eu/ws.
bind_ipThe address of this computer on your network (see below). Players must be able to reach it.
[auth] grant_tokenYour Headless Grant Token.
[auth] headless_tokenYour Headless Token.
[[rooms]] nameRoom name in the list, 1 to 40 characters. Unique in the file.
[[rooms]] visibilitypublic (listed) or private (only with the code or link).
[[rooms]] passwordRoom password, or "" for none.
[[rooms]] max_connectionsMaximum players, from 1 to 22 (default 22).

Find bind_ip

SystemCommand
macOSipconfig getifaddr en0 (Wi-Fi), or en1
Linuxhostname -I, then take the address of your network interface

More rooms on one server

Add one [[rooms]] block per room. Each room opens on its own, with its own settings:

[[rooms]]
name = "Evening match"
visibility = "public"
password = ""
max_connections = 22

[[rooms]]
name = "Private room"
visibility = "private"
password = "secret"
max_connections = 6

After changing the file, restart the server.

Start it

Linux (as a service):

sudo install -m 755 bin/rustball-headless /usr/local/bin/rustball-headless
sudo install -m 755 bin/room-server /usr/local/bin/room-server
sudo cp rustball-headless.toml /etc/rustball-headless.toml
sudo chmod 600 /etc/rustball-headless.toml
sudo install -m 644 rustball-headless.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now rustball-headless
journalctl -u rustball-headless -n 20

macOS (from the folder of the package, with the file next to run.sh):

./run.sh

Keep the terminal open. To stop the Mac from sleeping: caffeinate -i ./run.sh.

Check that it works

The log shows each step, one line per event:

INFO  token      Headless Grant Token accepted
INFO  token      accepted · server authorised
INFO  stanza     open · code A4WGRDYN · waiting for players
INFO  giocatore  joined: p1 (session 1)
INFO  partita    started · score 0-0
INFO  partita    GOAL Red · score 1-0
INFO  partita    ended · final score 1-0

If something does not work

Log messageWhat to do
invalid_token / not valid or expiredThe Headless Token is wrong, expired or revoked. Create a new one on the token page.
invalid_grantThe Headless Grant Token is wrong or revoked. Ask the administrator.
grant_requiredThe two tokens do not belong together. Create the Headless Token again with your grant.
REVOKED by the administratorYour Headless Grant Token or this Headless Token was revoked. The server stops and does not restart.
Room is not in the listCheck the log: the server must be running and show accepted.
Players cannot joinCheck bind_ip and open the UDP ports 1024–65535 on your router, or use a machine on the same network.

← Back to Rustball