Skip to content

Experimental dedicated server in Docker (Wine + Madeira Dock) - #435

Open
ampynjord wants to merge 60 commits into
dkdknight:mainfrom
ampynjord:feature/dedicated-server
Open

ampynjord wants to merge 60 commits into
dkdknight:mainfrom
ampynjord:feature/dedicated-server

Conversation

@ampynjord

@ampynjord ampynjord commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Ready for review, and EXPERIMENTAL. This adds a dedicated server in a Linux Docker container. It runs and has been played with, but it relies on a Windows game under Wine and on Valve's private Steam client library, it has had little real use (one tester at a time), and it can stop working when Valve or the game changes. Read "Experimental: what to expect" below first. The guide is docs/DOCKER-SERVER.md. The long-lived branch keeps receiving main by merge (never rebased).

Experimental: what to expect, and how it compares

This is experimental. It runs, it has been played with, and it can break: it relies on a Windows game under Wine and on Valve's private Steam client library (through Madeira Dock), neither of which is a supported setup. Do not host a save you cannot lose without keeping your own copies, and expect settings and behaviour to change between releases.

Which one to use

Classic host Relay (mpfever-relay) Dedicated server, Windows (--server, SERVER.txt) Dedicated server, Docker (this)
What runs the world A player's own game, on that player's PC A player's own game (the relay runs no game) The full game on a PC of its own, hidden (no display) The full game in a Linux container (Wine), no display, no GPU
World lives when the players leave No (the host leaves, the session ends, unless migration, experimental) No (same; optional migration and save on the relay, experimental) Yes, paused while nobody is there, saved every 10 minutes Yes, same server mode: paused while nobody is there, saved every 10 minutes, backups kept
Needs The host's PC on and a reachable port or Steam A cheap VPS; nothing to open on the host's side A Windows PC with the game, Steam and a graphics card able to run the game Docker (Linux, or Windows with Docker Desktop), 12 GB RAM minimum (16 GB for a 120 MB world), no GPU, a Steam account that owns the game
Steam licence The player's own The player's own The PC's own Steam The server's account must own the game; one playing session per account at a time (see the Steam offline mode below)
Status Released Works with real games; migration and saved copy experimental Released Experimental
  • The Docker server and the Windows dedicated server are the same server mode of MPFever (MPFever.exe --server, the same settings file, console and rules); the Docker one packages it for Linux hosts and removes the need for a Windows PC with a graphics card. It is not a different game server and not a rewrite: the world is still simulated by Transport Fever 3.
  • A relay is not a dedicated server: it carries the connections, nobody simulates the world on it. A dedicated server can optionally use a relay (SRV_RELAY) when its network cannot receive connections (mobile box, CGNAT); otherwise the server needs no relay.
  • Compared with a classic host, a dedicated server keeps the world up without anyone's PC, and no player's game is the authority.

What has been tested

On a real Steam account, with real Windows clients, on Docker Desktop (Windows) and a built image:

  • install, login, import, first start on empty volumes, restart restores the saved world, clean stop (the world is saved), healthcheck;
  • one client at a time joins, resynchronises, IDENTICAL on 2 games, 0 desynchronisations; a 40-minute run on a real 122 MB world (16 GB, 2 CPUs) with 0 desynchronisations and no memory growth after warm-up;
  • a public test server on a home PC behind a mobile box through a relay on a VPS, with Steam offline mode, while the owner played the same game on the same PC with the same account (2026-11-20): join, pause and resume, in sync, leave; mods installed from mod.io and the world loaded in sync with them;
  • the 0.9.5 image published, pulled, and started with a world loaded (2026-11-23), without a client.
  • the 0.9.7 image (with the fixes of the review of 2026-11-24) published, pulled and run on the public test server: the world loaded and runs in sync, the relay's first attempt failed and the retry worked, the server is listed publicly; no client played on it yet.

What has not been tested (risks)

Everything not validated below (and the items still unchecked in the lists further down) will be done in the next pull request, not in this one: this PR is the experimental base, merged as is, with its limits stated.

  • Several real clients at once, runs of several hours, and a player receiving the mods from the server (unit and local level only).
  • The offline logon ticket's lifetime (Steam offline mode): it is renewed by one online start; how long it lasts is unknown.
  • A second PC for the owner's game, the GPU variant (compose.gpu.yaml), ARM hosts (not supported).
  • Valve changes its client (Dock calls a private API): the server can stop working until the table in server/dock/src/client_layout.c is rebuilt (server/dock/MAINTAINING.md). The same goes for a game update (a new image, a new game import).
  • Memory: 10.6 to 11.8 GB for a small world (see Measured); not for small hosts.
  • The branch is large (the launcher changes are about 55 lines for the base, more for the mods, votes, relay host key and offline mode); a review is still needed, and it could be split.

Details (written as the work went)

What it is

A dedicated server that runs the real Transport Fever 3 simulation in one Linux Docker container (any x86-64 Docker host: Linux, or Windows with Docker Desktop): the Windows game under Wine 11, started through Madeira Dock and
Valve's own Steam client library (real sign-in, real licence check, no Steam desktop, no web helper). No GPU, no screen, nothing graphical exposed. Windows MPFever clients join it like any host.

Users bring their own licence: the image contains no TF3 file and no Valve file. The game is imported from the user's own install (install-game, a sparse "lite" copy: 66 GB become about 1.3 GB on disk) and
Valve's client library is fetched from Valve at the first start (pinned build, hash-checked). No Steamworks emulation, no DRM bypass.

Architecture

Part Choice Reason
Game Windows exe under Wine 11 A native Linux game drifts from Windows clients; the same exe stays in sync
Steam Madeira Dock + Valve's steamclient64.dll (Jan 2026 build, pinned) Steam desktop under Wine costs 2.7 GB; Dock about 280 MB
Dock our copy in server/dock/ (imported unmodified from willfaust/madeira-dock 67780ba, GPL-3.0-or-later, maintained by this project: server/dock/MAINTAINING.md) Valve's client is private API: we own the table of supported builds. Unit-tested and built from these sources in the image build
Rendering Lavapipe + a Vulkan layer making draws/copies no-ops (server/vklayer) + NORENDER/10 FPS CPU 1.3 -> 0.6 core, RAM -0.7 GB, no GPU needed
Launcher MPFever.exe under Mono; Wine/Dock start mode (MPFEVER_WINE, MPFEVER_DOCK) and MPFEVER_STOPFILE (clean stop: world saved first) about 55 changed lines in launcher/, no behaviour change on Windows
Disk server/scripts/mklite.py the engine reads archives at fixed offsets: archives keep their layout, textures become file holes

Install (user view)

docker compose pull
docker compose run --rm -v "<Steam>/steamapps:/src:ro" mpfever-server install-game /src   # once
docker compose run --rm mpfever-server login                                              # once: QR code, approve in the Steam mobile app
docker compose run --rm -v "<saves>:/in:ro" mpfever-server import-save /in/myworld.sav    # once
docker compose up -d

Settings in .env (no rebuild), two named volumes (mpfever-data, mpfever-game), restart policy, healthcheck, clean stop (docker compose stop saves the world), rollback by image tag.
Container: uid 1001, read-only root, all capabilities dropped, no ports but the game's, no secret in the image; the Steam refresh token lives only in the data volume (0600).

Names, versions, CI/CD

  • Image ghcr.io/<owner>/mpfever-server (and the relay's, in Relay Docker image: name it mpfever-relay (no -docker suffix) #436, mpfever-relay: no -docker suffix, the registry only holds images). Compose project/service/container mpfever-server. Published today under ghcr.io/ampynjord/mpfever-server.
  • Tags: the MPFever version (0.9.1) and experimental. The image is built from the release's own server archive, so the version of the server and of the players' client match.
  • CI artifact MPFever-<sha> (already the project's); no release asset is named MPFever*.zip besides the players' and the server's archives (updater rule, docs/REGRESSIONS.md).
  • CI/CD lives in the project's two workflows, like the relay's image (no separate workflow):
    • ci.yml, every push/PR: docker-server-checks (server/tests/check.sh: shell + shellcheck, Python tests, Dock's unit tests, Compose, no secrets/binaries) and docker-server (builds the image from the build job's server archive, then server/tests/smoke.sh: unprivileged, no game or Valve file inside, pinned runtimes, explicit errors on empty volumes). Nothing is pushed.
    • release.yml (started by hand): the new docker_server option publishes ghcr.io/<owner>/mpfever-server:<version> and :experimental, built from that run's server archive and smoke-tested first (docker stays the relay's image). Run it on a release tag to get that release's image.

Measured (small world, no GPU, one real Windows client)

Container 10.6 to 11.8 GB (anonymous 9.5 GB, reclaimable cache 1 to 2 GB, shared 0.7 GB); game PSS 10.0 GB; Dock 256 MB RSS and about 0 CPU; game 0.6 core at x0.98; image 3.5 GB. scripts/measure.sh prints these.

Validated end to end (built image, volumes created empty, real account, real Windows client)

  • Image built from the Dockerfile; unprivileged; no TF3/Valve file inside; explicit errors on empty volumes
  • install-game from a real Steam library (2 min); Steam QR login; token hand-over to Dock (Steamworks initialised with no Steam desktop, real licence check, real launch)
  • First start on empty volumes; import-save; world load; MPFever server mode
  • Windows client joins, resynchronises, IDENTICAL on 2 games, 0 desynchronisations (about 6 minutes)
  • docker compose stop (about 10 s, exit 0, world saved at stop); restart restores the saved world; healthcheck healthy
  • CI green (static, package with 333 tests, image build, smoke tests); image published to GHCR and pulled without login and run (mpfever-server:0.9.1, built earlier by a temporary workflow of this branch), in sync
  • Dock built from the vendored sources in the image: sign-in, licence check, launch and sync work

Long run (real account, real Windows client, built image)

  • A real 122 MB world, 16 GB and 2 CPUs, 40 minutes: 0 desynchronisations, 0 errors, no OOM; game memory climbs 11.2 -> 12.5 GB during the first 18 minutes of simulation then stays flat (warm-up, not a leak); about 1.1 CPU. 16 GB is the minimum for that size.
  • The small world at the minimum limits (12 GB, 1 CPU): runs (container peak 11.6 GB), slower to start (5 min 17 s) and to resynchronise a client (285 s).
  • docker compose stop with a client that vanished (killed): 71 s, exit 0, world saved.
  • Findings: a world with mods could not load before the mods work below; a client with personal mods stayed stuck on "loading" with the 122 MB world; a settings bug (Windows' PUBLIC variable overrode .env and put the server in MPFever's public list; a stranger joined through Steam) is fixed: every setting is now SRV_-prefixed, the entrypoint validates its settings, and check.sh refuses any unprefixed variable in Compose.

Administration, logs, updates (added; validated live on a built image)

  • Logs: one JSON object per line on docker logs for every component ({"ts","level","component","msg"}: the launcher writes them with MPFEVER_LOG_JSON=1, the scripts the same shape); SRV_LOG_FORMAT=text for plain lines.
  • mpfever-admin: the server window's console commands from outside (docker compose exec mpfever-server mpfever-admin status|say|kick|save|help|...): the launcher reads one file per command from MPFEVER_CMDDIR. Tested: status, say, help against the running server.
  • Updates: autoupdate=notify (SRV_UPDATE_CHECK=notify, default): a new MPFever release is announced once in the log, never installed; the image is updated. (The positive case needs a newer release than the server's: not exercised.)
  • Launcher changes: Core.cs (JSON log), Server.cs (command folder), Updater.cs/MainForm.cs (notify mode), Mods.cs/MainForm.cs/SelfTest.cs (mod store, see Mods); English log line, nothing to translate (tests/test_lang.py passes).

Mods (added; validated live on a built image, the player side not yet)

  • mods login | list | sync | status (server/scripts/mods.py, 8 unit tests against a fake mod.io): the mod.io key is typed once and kept in the data volume only (0600). Each mod is downloaded (hash checked), unpacked (path-checked; entries a publisher left with a wrong CRC are kept with a warning), then stored twice: a reduced copy the game runs from (mklite.py: same paths and sizes, files a headless server never reads left empty) and the full copy in /data/mods/full.
  • Checked and updated at every start (SRV_MODS_SYNC=auto), so mods follow the server's updates; a mod.io outage never stops the server.
  • The game's mod.io library lists only what its signed-in user is subscribed to, and Wine cannot use an existing Z: folder as mod.io's root (error 4390): the server writes the library's state file and a local subscription record, and reaches the root as C:\modio. Found and checked on a real world.
  • Players get the mods from the server: with MPFEVER_MODSTORE (a Docker server only) the launcher also offers the Mod Hub's mods it holds in full, at once, to a joining player who lacks them (the existing mod sending path: the player accepts, nothing is installed unasked). Launcher changes: Mods.cs (store, zip without the store's note), MainForm.cs (OfferMods, a missing field in the player's modcheck), a self-test (RunModStore).
  • Validated: a real 595 MB world with 15 mod.io mods, mods sync then start: "IN SYNC", no missing mod. Not validated: a player actually receiving the mods (needs a client; unit level only).

Logs of the game and Dock, local mods, administration page (added; run on a built image with a real world)

  • Logs: the game's and Dock's own logs join the JSON stream (component game / dock, levels mapped, SRV_GAME_LOG=off|error|warn|info|debug, warn by default). Seen live: ~900 game lines at info during a start.
  • mods import <folder>: the administrator's local mods (a mounted folder; each folder with mod.lua) get the reduced copy for the game and the full copy for the players; mods list <world> shows what the server lacks. Run against the real volume. Transport Fever 3 has no Steam Workshop, so nothing else needs importing.
  • Administration page, off by default (SRV_ADMIN_UI=on): standard-library only, no external resource, token in secrets/admin-token (0600, mpfever-admin token), console verbs status list say save pause resume speed kick resync restart (never stop), every command and refusal logged (admin-ui); its port is published on 127.0.0.1 only through compose.admin.yaml. Exercised with curl against the running server (page, 401 without a token, status, refused stop); 12 unit tests. Not opened in a browser.
  • No launcher change in this part.

Next (decided with the maintainer, not started)

  • Logging of the launcher's remaining text outputs in the same shape, and a Prometheus-style metrics view if wanted

Published image (2026-11-19, MPFever 0.9.2 and game build 40444)

ghcr.io/ampynjord/mpfever-server:0.9.2 (also :experimental, same digest sha256:a4639ecf...), published by the manual "Release build" run with docker_server on the fork, from a throw-away branch (deleted) where every version string was set to 0.9.2: this branch's code is the 0.9.2 release plus the Docker changes, so the image speaks 0.9.2 to the players' clients. The running server uses it, with install-game run again from the updated Steam library. Not yet: a 0.9.2 client joining it.

Public test server, votes, diagnostics (2026-11-20, MPFever 0.9.3)

  • Image ghcr.io/ampynjord/mpfever-server:0.9.3 (also :experimental) republished with the changes below (the instance lock, exit code 60, is in the branch but not yet in the image).
  • speed-vote=true (Docker: SRV_SPEED_VOTE): the players' pause/speed requests are votes, carried by more than half of the connected players within a minute (one player alone: at once; progress told in the chat; the console always can). Launcher change in Server.cs / MainForm.cs with a self-test (RunSpeedVote).
  • Diagnostics: the launcher's session folders and the game's logs are kept in the data volume, mpfever-admin bundle makes a support zip without secrets, the game's log is shipped at info by default (server-only noise is info, not an error).
  • Public server on a home PC: SRV_BIND=127.0.0.1 (nothing reachable from the network, players join through Steam), SRV_PUBLIC_ADDRESS so the list does not show the IP, pids_limit, guide section. Run live: world experimental (a new medium map, start year 1900, made with the game's New Game page), SRV_PUBLIC=true, pause when empty, listed with address steam-only.invalid:28090 (no IP) and its Steam ID.
  • Constraint found: Steam allows one instance of the game per account; the server and the host's own game cannot run together on the same account.

One licence, server and owner's game together; the relay, optionally (2026-11-20)

Cause of the conflict. Steam lets an account run Transport Fever 3 on one device at a time: the server's Dock session is a playing session of the owner's account on Steam's servers, so launching the game elsewhere asks "another session is already playing" and ends one of them.

Solution (experimental, off by default): SRV_STEAM_MODE=offline. The repository already carried Valve's own offline logon in Dock (server/dock/docs/OFFLINE.md, MADEIRA_DOCK_OFFLINE=1): Valve's client logs the account on with the offline logon ticket it stored during an online start (desktop Steam's Offline Mode), answers the licence from its cache and Dock starts the game through the same LaunchApp. Nothing is forged. Run on the PC that hosts the server (build 40444): session-offline-ready=1 after an online start; offline start: session-offline-can=1, logon accepted, game listed among 864 cached licences, launch-game-running=1, no session-online line, no connection to Steam's servers from the container; Transport Fever 3 then started on the same PC with the same account without the "another session" question; an MPFever client joined the offline server over TCP, then through a relay, in sync. Limits: no Steam networking while offline (players join by address or relay), and how long Valve keeps the ticket valid is Valve's (result 50 = renew with one online start); nothing was run for days; the two-PC variant (server and game on different machines) was not run, the backend sees the same single session either way.

The relay, optionally (SRV_RELAY, off by default). A server behind a mobile box (CGNAT) cannot receive connections, and Steam networking is gone offline: it can host through an MPFever relay (relay=, relay-host-key=, relay-password=), connecting out to it. New relay option --host-key (MPFEVER_RELAY_HOST_KEY): only the launcher that shows the key may host (wrong key refused as hostkey, counted like wrong passwords), players need no password; excluded with --migration and --resume-without-host. Not used behind a relay: migration, the relay's kept save, the takeover state. Lost relay: the world is saved and hosted again; unreachable relay at start: retried every 30 s. Run end to end: server in Docker (offline Steam) -> relay on a VPS -> MPFever client at the VPS's public address, in sync (relay of the VPS: a second container on port 28091, the first relay untouched).

Public list. It listed only servers it could reach or with a Steam ID, so a relay-hosted server with Steam offline was invisible (measured: 0 entries). Two ways now: (1) the relay announces its host (--list-url, with --host-key: from the relay's public address, with the data the server's launcher sends in tun_list; no Steam, no address of the host's choosing; takes the entry off when the host leaves) -- run on the VPS against the real list: the server is listed with the relay's address, reachable, no Steam ID; (2) the list service looks at an announced public address (serverlist/ + tests; the deployed list is not updated by this PR). When the server needs no relay nothing changes: it announces itself.

Also: shutdown-warning=N (players warned and counted down before a stop or restart; Docker SRV_SHUTDOWN_WARNING, 60), one instance per data volume (exit 60), SRV_STEAM_MODE, SRV_RELAY* in the guide.

Roadmap of the dedicated server (owner's decisions, 2026-11-20)

World creation with no game session to click through (command line first, the graphical flow only as a last resort); the optional administration page reaching every option (server settings, game options and computer companies, players, savegames/backups/mods); the remaining checks are on hold. See the guide's roadmap.

Not validated yet / remaining before merge

  • Mods: a player joining a world with mods and receiving them from the server (a client is needed); local mods imported but not yet played with a client
  • Several clients at once (local test clients); runs of several hours
  • GPU variant (compose.gpu.yaml, Linux hosts with /dev/dri; cannot work on Docker Desktop/WSL2 as written)
  • The docker_server option of release.yml run once on a release tag
  • First start and login re-run on a fresh machine by someone else; ARM hosts are not supported
  • Decision on what to do when Valve changes its client (remedy: a new build in server/dock/src/client_layout.c, see MAINTAINING.md)
  • Review of the launcher changes (WineMode, MPFEVER_DOCK, MPFEVER_STOPFILE, MPFEVER_LOG_JSON, MPFEVER_CMDDIR, autoupdate=notify)
  • If merged: point the README's raw links and the default image at the project's own namespace; the history contains merges of main (squash on merge)

Companion: #436 names the relay's image mpfever-relay (it edits release.yml and the changelog too: whichever is merged second needs a trivial rebase of the changelog entry).

Review of 2026-11-24 (the maintainer's changes requested) and 0.9.7

main is 0.9.7 now (#436 is merged); the branch contains it (merge, no rebase) and the changelog entries are under 0.9.7. Every point of the review is addressed; what is only partly done or not tested is said here.

Before a merge:

  • 1. serverlist/ServerList.cs ProbeTarget: an announced host:port is connected to only when it resolves to the address the announce came from (a relay announcing itself with --list-url); the name lookup has a 2 s limit; PublicTarget also refuses 64:ff9b::/96, 198.18.0.0/15, 192.0.0.0/24. tests/test_serverlist.py: the relay's own address is listed, someone else's port is not.
  • 2. The default image of compose.yaml, .env.example and the guide is ghcr.io/dkdknight/mpfever-server; the guide says how to build it yourself and that another source is a knowing choice; its quick start takes compose.yaml and .env.example from the project's main (until the merge: from a branch you have read).
  • [~] 3. Secrets readable by a mod's code: Wine's Z: shows a folder of links that leaves /data/secrets out (SRV_WINE_RESTRICT_Z=0 to undo), and Dock's transfer file (the token) is written only while the game is not running and removed 15 s after it started (Dock does not delete it itself: seen on a test container). Not a boundary: the game and the secrets are the same Unix user, so a path that does not go through Z: is not stopped; the guide says so and advises SRV_MODS_SYNC=off to review mod updates. Running the secrets under another user is not done.

Should fix:

  • 4. A failed StartHost clears hostGame, so the relay= retry runs (seen on the public test server at its restart: first attempt failed, the retry 30 s later worked).
  • 5. A stop during a restart's countdown wins: the countdown goes on, the players are told, the server stops instead of restarting. Not tested (built and self-tested only).
  • 6. SRV_STOP_GRACE (200 s) is a setting; the server refuses to start when SRV_SHUTDOWN_WARNING + 90 s does not fit in it (server/tests/test_settings.py).
  • 7. The administration page accepts a proxy's X-Forwarded-Host or an origin listed in SRV_ADMIN_ORIGINS (one test; not tried behind a real proxy).

Minor: [x] the Ubuntu base is pinned by digest and WineHQ's key and source file by SHA-256 (the image build passed with them); [x] a line break in .env is refused (test); [x] the Steam login name is out of the start log (the status command still shows it, not in the container's logs); [x] . and .. are refused as a mod id (test); [x] the guide's list-announce sentence matches ListAnnounce.cs; [x] the changelog entries are under 0.9.7.

Checks: server tests 61 OK (3 skipped), tests/test_serverlist.py, tests/check_repo.py, launcher self-test OK. A throw-away container (0.9.5 image, changed scripts) loaded the world in sync with the restricted Z: and no token file during play; the 0.9.7 image then ran on the public test server.

Left to the maintainer: SRV_STEAM_MODE=offline (he wants to look at it himself). Not tested: items 5 and 7 as said, and a stop with players connected on the new image.

Image ghcr.io/ampynjord/mpfever-server:0.9.7 (also :experimental), published from this branch by the manual "Release build" run (docker_server).

Updated with the latest release (2026-11-23, MPFever 0.9.5; main = 0.9.6 in progress)

  • The branch contains upstream main (0.9.6 in progress, on top of the 0.9.5 release); merges, no rebase. Checks: server tests 49 OK, relay self-test 177/177, check_repo.py OK, launcher --selftest OK. The full suite passes except test_ptpull0713.py (random model, "its process died twice"): its files are identical to main, so it is not caused by this branch (not investigated further).
  • Images ghcr.io/ampynjord/mpfever-server:0.9.5 (sha256:6be7af50..., also :experimental) and ghcr.io/ampynjord/mpfever-relay:0.9.5, published from a throw-away branch (deleted) by the manual "Release build" run on the fork; the server image was pulled and run.
  • The public test server ran on 0.9.3 for a few days with the relay on a VPS; the owner joined from the game while the server ran (Steam offline mode), games in sync. Several clients at once and the player-side mod download are still untested (see the list below).

Remaining (2026-11-23)

Everything not validated below (and the items still unchecked in the lists further down) will be done in the next pull request, not in this one: this PR is the experimental base, merged as is, with its limits stated.

Not verified yet:

  • A player receiving the mods from the server; several clients at once; runs of several hours
  • The offline logon ticket's lifetime; a second PC for the owner's game; the GPU variant
  • The server on a real run with 0.9.5 and the 0.9.6 in progress (started only, not played with clients)
  • The C# fix of review point 5 (a stop during a restart's countdown) with players connected; the administration page behind a real reverse proxy; a stop with players on the 0.9.7 image
  • tests/test_ptpull0713.py fails on the author's PC ("its process died twice"), files identical to main: cause not found

On hold (owner's decision): creating a world from the command line (the game's graphical flow only as a last resort); an administration page covering every option (server settings, game options and computer companies, players kick/ban, saves and backups, mods).

Before a merge: review of the launcher changes, a first start by someone else, a decision on Valve's client updates, and a split into separate pull requests for the maintainer (#436 already is one; the rest is one block).

The Windows game runs under Wine on Linux; Valve's own client library is driven by
Madeira Dock (real sign-in and licence check, no Steam desktop). Launcher: a Wine/Dock
start mode and a stop file for a clean container stop. server/ holds the Dockerfile,
Compose files, entrypoint (install-game, login, import-save, status, run), the Steam QR
sign-in helper, the Vulkan no-op layer, tests and docs; a workflow builds and smoke-tests
the image and publishes to GHCR only on a manual run.
…her changes; publish only on a version tag or a manual run
…ed with the MPFever version, MPFever-server-package artifact, compose project name
@ampynjord ampynjord changed the title Experimental Linux dedicated server (Wine + Madeira Dock) Experimental dedicated server in Docker (Wine + Madeira Dock) Nov 19, 2026
…ocker-server) and release.yml (docker_server option) like the relay's image; shared smoke tests; standalone workflow removed
…project's test reads the end of the inputs block)
…LIC put the server in the public list); entrypoint validates its settings; long-run results (122 MB world, minimum limits, vanished client) and limits in the guide; default memory 16g
…cripts), mpfever-admin (console commands from outside through a command folder), autoupdate=notify (new release announced, never installed)
…parse copy for the game, full copy kept apart, game library registration (state.json, local subscription record), sync at start (SRV_MODS_SYNC)
…e: run on MPFever 0.9.2 and game build 40444
…data volume, mpfever-admin bundle, game log at info by default, server-only noise is info; Release build input docker_server_revision
…wn before a stop or restart), SRV_SHUTDOWN_WARNING
…elay-password=), relay --host-key (only the key holder hosts, players need no password), reconnect after a lost relay, tests
…ver through a relay does not use the kept save or the takeover state; docs for the relay, offline Steam mode and what differs
…s looked at there, so a relay-hosted server behind a router is listed; tests, docs
…r-relay): this branch includes the rename, as if that change were merged
…y's own address (with --host-key): a dedicated server behind a router and Steam offline is listed; tests, docs
…dministration page for every option, remaining checks)
@ampynjord
ampynjord marked this pull request as ready for review November 23, 2026 18:40

@dkdknight dkdknight left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this work. I ran it through my usual checks on a merge with today's main (0.9.7 in progress, #436 merged): the build and the 357 tests pass, the launcher self-test too, CI is green, and two 2-game sessions on the merged build (builds, then loans in a pause) stayed in sync with a clean Lua log. Nothing changes for players who don't use the new settings, which is good.

I'm not merging it yet, because of these points (my own reading plus an independent review):

Before a merge

  1. serverlist/ServerList.cs ProbeTarget: the list would connect to any public host:port named in an announce (again every 10 s while it doesn't answer), so it becomes a port prober running from my server, and it can show someone else's port as a reachable MPFever server. The relay's --list-url already covers the CGNAT case: please drop ProbeTarget, or probe the announced address only when it resolves to the announcer's own IP. Dns.GetHostAddresses also runs there without a timeout, on the pool that answers the list.
  2. server/compose.yaml defaults to ghcr.io/ampynjord/mpfever-server. The default has to be the project's image, or a local build, since that container holds the operator's Steam token.
  3. The secrets are readable by mod code: Wine's Z: maps /, the game runs as the user that owns /data/secrets (Steam refresh token, mod.io key, admin token), and TF3 mods have io. With SRV_MODS_SYNC=auto, a mod update could read and send them. Narrow drive mappings, or secrets owned by another user, would close it. Also, steam_session.py feed rewrites the transfer file every second, so it is always on disk; writing it once per launch would be better.

Should fix
4. relay= retry: StartHost sets hostGame before ConnectRemote, and the failure path doesn't clear it. So the hostGame == null check in ServerRelayRetry never passes, and the same happens after a lost relay.
5. A stop that arrives during a restart countdown is swallowed (if (shutdownWarning) return true;). The stop should win.
6. stop_grace_period is a fixed 200 s, but the save comes after SRV_SHUTDOWN_WARNING. Above about 110 s, the final save is cut off. Please cap the setting or derive the grace period from it.
7. In webadmin.py, the Origin == Host check refuses every POST behind a reverse proxy that rewrites Host.

Minor

  • PublicTarget misses 64:ff9b::/96, 198.18.0.0/15 and 192.0.0.0/24.
  • The WineHQ key and the ubuntu:24.04 base aren't pinned.
  • .env values with a newline can add lines to the properties file.
  • The Steam login name goes to docker logs.
  • mods.py accepts . and .. as a mod id.
  • DOCKER-SERVER.md:231 doesn't match ListAnnounce.cs, which always sends an empty address.
  • The changelog entries sit under 0.9.6, which is released now: they belong under 0.9.7.

Separately, I want to look at SRV_STEAM_MODE=offline (one account running the game in two places at once) myself before it goes in.

…ress, project image by default, secrets narrowed, relay retry, stop during a restart, stop grace, proxy origin, pins, minor points
@ampynjord

Copy link
Copy Markdown
Contributor Author

Thank you for the detailed review. The branch is updated (merged with today's main, 0.9.7; the changelog entries are under 0.9.7 now) and every point is addressed, with one limit on point 3 that I say plainly below.

Before a merge

  1. ProbeTarget (serverlist/ServerList.cs): the announced host:port is now used only when it resolves to the address the announce came from (a relay announcing itself with --list-url). Anyone else's address is never connected to. The name lookup has a 2 s limit. tests/test_serverlist.py has a case for the relay's own address (listed) and one for someone else's port (not listed).
  2. server/compose.yaml, .env.example and the guide now default to ghcr.io/dkdknight/mpfever-server, and the guide says the container holds the Steam token, how to build it yourself (compose.build.yaml) and that another source is a knowing choice.
  3. Secrets read by mod code. Done: Wine's Z: now points to a folder of links that leaves /data/secrets out (SRV_WINE_RESTRICT_Z=0 to undo), and the Steam transfer file is written only while the game is not running and removed 15 s after it started (Dock reads it at the start and does not delete it: I saw it stay on disk, so the feeder now removes it). Not done: the game and the secrets are still the same Unix user, so this narrows what a mod's Lua reaches through Z:, it is not a boundary. The guide says so, and says to install only mods you trust (SRV_MODS_SYNC=off to review updates). Running the secrets under another user is a bigger change that I did not make.

Should fix

  1. The relay= retry: a failed StartHost now clears hostGame, so the retry runs.
  2. A stop during a restart's countdown now wins: the countdown goes on, the players are told, and the server stops instead of restarting.
  3. SRV_STOP_GRACE (200 s) is a setting now, and the server refuses to start when SRV_SHUTDOWN_WARNING + 90 s does not fit in it.
  4. The administration page accepts a proxy's X-Forwarded-Host, or an origin listed in SRV_ADMIN_ORIGINS.

Minor: PublicTarget refuses 64:ff9b::/96, 198.18.0.0/15 and 192.0.0.0/24; the Ubuntu base is pinned by digest and the WineHQ key and source file by SHA-256 (the build fails if they change); a line break in .env is refused; the Steam login name is no longer logged; . and .. are refused as a mod id; the guide's list-announce sentence now matches ListAnnounce.cs.

Checked: the 53 server tests, tests/test_serverlist.py, tests/check_repo.py and the launcher self-test pass. On a throw-away container (image 0.9.5 with the changed scripts), the world loaded and ran in sync with the restricted Z:, and the transfer file was gone once the game ran. Not tested: the C# changes of points 4 and 5 (built and self-tested only, no test with a failing relay or a stop during a restart), the image build with the pins (not rebuilt), the admin page behind a real proxy, and the proxy and SRV_STOP_GRACE paths on a real stop with players.

For SRV_STEAM_MODE=offline, I will not touch it and will wait for your look at it.

…ngs checks (line break, stop grace) and the mod id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants