Updated server configuration; add UPnP and JVM memory options, and enhance startup behaviour with dynamic memory allocation and ZUncommitDelay settings.

This commit is contained in:
Overlord committed 2026-10-04 15:17:38 +02:00
1 parent 151e1d459f
commit 05eed7e205
4 files changed
+132 -62

No files matched your search

+50 -40
View File
@@ -22,10 +22,10 @@ podman build --platform linux/amd64 -t zomboidforge . # or: docker build ...
| `FORGE_VERSION` | `0.0.0-prerelease` | ZomboidForge version (jar manifest, image label). The build stage has no `git`, so the version is never read from a tag there; `ci/release.sh` passes it |
| `DISABLED_PATCHES` | | Comma-separated simple class names of build-time patches to skip (debug builds only), e.g. `IsoZombieVehiclePerformancePatch` |
Published images are tagged `<forge>-pz<major.minor.build>` (never overwritten),
`<forge>-pz<major.minor>` (the newest hotfix of that minor version), and `latest`. A new image
is built for every ZomboidForge release and every Project Zomboid version, hotfixes included:
the server only admits clients with the same version.
> [!NOTE]
> Published images are tagged `<forge>-pz<major.minor.build>`, `<forge>-pz<major.minor>`, and `latest`. <br>
> A new image is built for every ZomboidForge release and every Project Zomboid version,
> hotfixes included, as the server only admits client with the exact same version.
## Running
@@ -38,24 +38,26 @@ podman run -d --name zomboidforge \
Unset variables keep the value in the server `.ini` (or the game default).
| Variable | Default | |
|-------------------|----------------|-----------------------------------------------------------------------------------------------------|
| `SERVER_NAME` | `zomboidforge` | Server config name (`/data/Server/<name>.ini`) |
| `SERVER_PASSWORD` | | Password clients need to join (`.ini` `Password`) |
| `PUBLIC` | | `true`/`false`: listed in the in-game server browser |
| `PUBLIC_NAME` | | Name in the server browser |
| `PORT` | `16261` | Game port (`-port`) |
| `UDP_PORT` | `16262` | Direct connection port (`-udpport`) |
| `ADMIN_USERNAME` | `admin` | First start only |
| `ADMIN_PASSWORD` | | Required on the first start, ignored afterwards |
| `SERVER_PRESET` | | Sandbox preset for a new server: `Apocalypse`, `Extinction`, `Outbreak`, `Rising`, `SixMonthsLater` |
| `MODS` | | Mod IDs, Build 42 format: `\ModA;\ModB` |
| `WORKSHOP_ITEMS` | | Workshop item IDs: `123;456` |
| `RCON_PASSWORD` | | Written into the `.ini` on every start; RCON is disabled without it |
| `JVM_MIN_HEAP` | `JVM_MAX_HEAP` | `-Xms` |
| `JVM_MAX_HEAP` | `8g` | `-Xmx` |
| `STEAM` | `1` | `0` runs the server without Steam |
| `SOFT_RESET` | | `true` starts once in soft reset mode (`-Dsoftreset`); unset it afterwards |
| Variable | Default | |
|----------------------|--------------------------|-----------------------------------------------------------------------------------------------------|
| `SERVER_NAME` | `zomboidforge` | Server config name (`/data/Server/<name>.ini`) |
| `SERVER_PASSWORD` | | Password clients need to join (`.ini` `Password`) |
| `PUBLIC` | | `true`/`false`: listed in the in-game server browser |
| `PUBLIC_NAME` | | Name in the server browser |
| `PORT` | `16261` | Game port (`-port`) |
| `UDP_PORT` | `16262` | Direct connection port (`-udpport`) |
| `UPNP` | | `true`/`false`: UPnP port mapping on the router (`.ini` `UPnP`); `false` recommended (see below) |
| `ADMIN_USERNAME` | `admin` | First start only |
| `ADMIN_PASSWORD` | | Required on the first start, ignored afterwards |
| `SERVER_PRESET` | | Sandbox preset for a new server: `Apocalypse`, `Extinction`, `Outbreak`, `Rising`, `SixMonthsLater` |
| `MODS` | | Mod IDs, Build 42 format: `\ModA;\ModB` |
| `WORKSHOP_ITEMS` | | Workshop item IDs: `123;456` |
| `RCON_PASSWORD` | | Written into the `.ini` on every start; RCON is disabled without it |
| `JVM_MIN_HEAP` | JVM default | `-Xms`; unused heap memory is returned to the system only down to this size |
| `JVM_MAX_HEAP` | 75 % of the memory limit | `-Xmx`; `8g` when the container has no memory limit |
| `JVM_UNCOMMIT_DELAY` | `60` | Seconds after which unused heap memory is returned to the system (`-XX:ZUncommitDelay`) |
| `STEAM` | `1` | `0` runs the server without Steam |
| `SOFT_RESET` | | `true` starts once in soft reset mode (`-Dsoftreset`); unset it afterwards |
Notes:
@@ -66,10 +68,16 @@ Notes:
items (`/data/steamapps`). The server runs as UID 1000. A bind-mounted host directory
must be writable by UID 1000 (`chown 1000:1000 <dir>`); with rootless Podman, use
`--userns=keep-id:uid=1000,gid=1000` to map it to your own user.
- **Stopping:** `SIGTERM` triggers the game's own save-and-quit. Allow enough time for large
worlds (`podman stop -t 120`, `stop_grace_period` in compose).
- **UPnP:** the game enables UPnP by default. In a container the server sees only its own
container address and cannot map the host's ports, and the router search delays every start
by about 12 s; set `UPNP=false` and publish the ports instead.
- **Memory:** with a memory limit (`--memory`, `mem_limit`), the heap gets 75 % of it and the
rest stays for native memory. The startup briefly needs a large heap; with 8 players
exploring, the heap held up to 4.4 GB of live data in tests. A limit below about 6 GB is
not recommended. Without a limit the heap is `8g`, as in vanilla.
- **Stopping:** `SIGTERM` triggers the game's own save-and-quit. Allow enough time for large worlds.
For local testing there is `compose.yaml` (`podman compose up --build`, settings from `.env`).
For local testing use `compose.yaml` (`podman compose up --build`, settings from `.env`).
## Mods
@@ -95,24 +103,24 @@ forge/
podman run ... -v ./forge:/forge zomboidforge
```
Mods are trusted code. They run inside the server process with its full privileges: they can
read and write any file the server can, open network connections, and stop the server. The
class loader isolation and the startup checks catch mistakes; they do not contain a malicious
mod. Install only mods whose authors you trust.
A mod's settings live in its `config.toml`. When the file is missing, it is created from the
mod's defaults if the folder is writable by UID 1000; otherwise the defaults are used without a
file. Keys missing from `config.toml` take the default. `enabled = false` in its `[forge]`
table switches the mod off; mods that depend on it then fail to load.
> [!WARNING]
> Mods are trusted code. <br>
> They run inside the server process with its full privileges, which means they can
> read and write any file the server can, open network connections, and stop the server. <br>
> The class loader isolation and the startup checks catch mistakes; they do not contain
> or restrict a malicious mod.
>
> Install only mods whose authors you trust, or whose code you can verify yourself!
Mods keep their data in `zomboidforge.db` in the world's save folder
(`/data/Saves/Multiplayer/<server>/`). Vanilla backups include it, and deleting the world
deletes it.
A mod that cannot be loaded stops the server with exit code 1, and the log lists every
problem: a missing or too old dependency, an unsupported game version, game classes or methods
that do not exist in the running version, invalid settings, or an exception in the mod's
startup code. Changes to mods and their settings take effect when the server restarts.
problem. For example, a missing or too old dependency, an unsupported game version,
game classes or methods that do not exist in the running version, invalid settings,
or an exception in the mod's startup code. Changes to mods and their settings take
effect when the server restarts.
`forge.toml`, every key optional:
@@ -139,9 +147,11 @@ server jar, `lib/server/java/projectzomboid.jar` by default (override with `-Ppz
./gradlew :patcher:patchServerJar # -> patcher/build/server/projectzomboid.jar
```
Game-specific code lives in `compat/b<major>/`; `api` and `core` are version-independent.
`pz.version` in `gradle.properties` selects the targeted version. `mod-tools` (the build-time
mod checks) and `gradle-plugin` (the plugin for mod authors) are for mod builds, not the server.
> [!IMPORTANT]
> Game-specific code lives in `compat/b<major>/`; `api` and `core` are version-independent. <br>
> `pz.version` in `gradle.properties` selects the targeted version. <br>
> `mod-tools` (the build-time mod checks) and `gradle-plugin` (the plugin for mod authors)
> are for mod builds, not the server.
Release tags publish `api`, `mod-tools`, and the Gradle plugin to the Gitea Maven registry
(`.gitea/workflows/publish.yml`, `ci/publish.sh`); tags with a `-` are only tested.