PlanyDocs
Playpute

Settings and config files

How a game's declared settings become server.properties, and what a server can be told about itself.

A game declares the settings a server's owner can change. The console renders a form for any game from those declarations without knowing anything about it, and a config file template turns the answers into the files the server reads.

Declared settings

JSON
{
"key": "max-players",
"displayName": "Max players",
"type": "TYPE_INT",
"defaultValue": "20",
"minValue": 1,
"maxValue": 200,
"requiresRestart": true
}
FieldNotes
keyReferenced as ${key} from config files and the launch command.
typeTYPE_STRING, TYPE_INT, TYPE_BOOL or TYPE_ENUM.
default_valueUsed when a server does not set it.
allowed_valuesFor TYPE_ENUM.
min_value / max_valueFor TYPE_INT.
requires_restartWhether a change takes effect only on restart.

A game server sets them by key:

plany playpute servers create survival \
--game games/minecraft-java-vanilla-1-20-4 \
--setting max-players=40 \
--setting difficulty=hard

A changed setting reaches the game the next time it launches.

Config files

Files written into the build before the game launches.

JSON
{
"path": "server.properties",
"contents": "server-port=25565\nmax-players=${max-players}\nmotd=${motd}\nserver-ip=\n",
"mode": 420,
"preserveExisting": true
}

${VAR} is replaced from the game's environment and from the server's settings, which is how one template serves every server of a game.

preserve_existing matters on restart. server.properties is edited by admins in-game, and rewriting it on every launch would discard their changes. Set it on anything a person is expected to edit; leave it off for files you want to control from the game definition.

mode is the Unix file mode; zero means 0644.

What a server can be told about itself

A game server advertises itself to master servers and query protocols, and what it can see about itself is a private address no player can reach. So Plany supplies the address players use:

SubstitutionAvailable asValue
${plany.public_address}config files and the launch commandThe address players connect to
—PLANY_PUBLIC_ADDRESSThe same, in the environment
text
server-ip=
server-port=25565
# what the server tells a query about itself
public-address=${plany.public_address}

That address is filled in when the game launches, not when the server is created. Use the substitution rather than trying to compute it; a server with no public address gets an empty value. See Addresses and waking.

Resources

resources on a game is the minimum a server of it needs. A server does not set a size directly: it names a machine type, and a server that names none gets the smallest type that meets the game's minimum. A type below it is refused.

text
resources:
vcpus: 2
memory_bytes: 4294967296 # 4 GiB — a server of this game is at least standard-2

The disk the game declares is the disk every server of it gets. A server's own resources is output only: its machine type and the game's disk together.

Timeouts

FieldWhy it is generous
startup_timeoutA modded Minecraft server can take minutes to generate a world on first boot, and stopping it halfway leaves a corrupt save.
stop_timeoutGame servers write world state on exit; cutting that short loses player progress.

stop_signal is how the server is asked to exit — SIGTERM for most things.