Repository navigation
Conversation
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.
…lean-stop timeouts
…ts in the docs, CI runtime checks
…her changes; publish only on a version tag or a manual run
…ed with the MPFever version, MPFever-server-package artifact, compose project name
…og entry, server/README.md as an index
…nly Linux), table of supported hosts
…n the image from them), maintenance guide, docs and CI wording
…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
…elog move under 0.9.4
…data volume, mpfever-admin bundle, game log at info by default, server-only noise is info; Release build input docker_server_revision
…s votes), SRV_SPEED_VOTE, self-test
…mit, guide on a public server on a home PC
…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
…hey take warned since the shutdown warning)
…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)
…nistration page scope, on hold)
…as tested and the risks
dkdknight
left a comment
There was a problem hiding this comment.
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
serverlist/ServerList.csProbeTarget: the list would connect to any publichost:portnamed 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-urlalready covers the CGNAT case: please dropProbeTarget, or probe the announced address only when it resolves to the announcer's own IP.Dns.GetHostAddressesalso runs there without a timeout, on the pool that answers the list.server/compose.yamldefaults toghcr.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.- 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 haveio. WithSRV_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 feedrewrites 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
PublicTargetmisses64:ff9b::/96,198.18.0.0/15and192.0.0.0/24.- The WineHQ key and the
ubuntu:24.04base aren't pinned. .envvalues with a newline can add lines to the properties file.- The Steam login name goes to
docker logs. mods.pyaccepts.and..as a mod id.DOCKER-SERVER.md:231doesn't matchListAnnounce.cs, which always sends an emptyaddress.- 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
|
Thank you for the detailed review. The branch is updated (merged with today's Before a merge
Should fix
Minor: Checked: the 53 server tests, For |
…ngs checks (line break, stop grace) and the mod id
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 receivingmainby 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
mpfever-relay)--server, SERVER.txt)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.SRV_RELAY) when its network cannot receive connections (mobile box, CGNAT); otherwise the server needs no relay.What has been tested
On a real Steam account, with real Windows clients, on Docker Desktop (Windows) and a built image:
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;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.
compose.gpu.yaml), ARM hosts (not supported).server/dock/src/client_layout.cis rebuilt (server/dock/MAINTAINING.md). The same goes for a game update (a new image, a new game import).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) andValve's client library is fetched from Valve at the first start (pinned build, hash-checked). No Steamworks emulation, no DRM bypass.
Architecture
steamclient64.dll(Jan 2026 build, pinned)server/dock/(imported unmodified from willfaust/madeira-dock67780ba, GPL-3.0-or-later, maintained by this project:server/dock/MAINTAINING.md)server/vklayer) +NORENDER/10 FPSMPFever.exeunder Mono; Wine/Dock start mode (MPFEVER_WINE,MPFEVER_DOCK) andMPFEVER_STOPFILE(clean stop: world saved first)launcher/, no behaviour change on Windowsserver/scripts/mklite.pyInstall (user view)
Settings in
.env(no rebuild), two named volumes (mpfever-data,mpfever-game), restart policy, healthcheck, clean stop (docker compose stopsaves 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
ghcr.io/<owner>/mpfever-server(and the relay's, in Relay Docker image: name it mpfever-relay (no -docker suffix) #436,mpfever-relay: no-dockersuffix, the registry only holds images). Compose project/service/containermpfever-server. Published today underghcr.io/ampynjord/mpfever-server.0.9.1) andexperimental. The image is built from the release's own server archive, so the version of the server and of the players' client match.MPFever-<sha>(already the project's); no release asset is namedMPFever*.zipbesides the players' and the server's archives (updater rule,docs/REGRESSIONS.md).ci.yml, every push/PR:docker-server-checks(server/tests/check.sh: shell + shellcheck, Python tests, Dock's unit tests, Compose, no secrets/binaries) anddocker-server(builds the image from thebuildjob's server archive, thenserver/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 newdocker_serveroption publishesghcr.io/<owner>/mpfever-server:<version>and:experimental, built from that run's server archive and smoke-tested first (dockerstays 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.shprints these.Validated end to end (built image, volumes created empty, real account, real Windows client)
install-gamefrom a real Steam library (2 min); Steam QRlogin; token hand-over to Dock (Steamworks initialised with no Steam desktop, real licence check, real launch)import-save; world load; MPFever server modeIDENTICAL 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 healthympfever-server:0.9.1, built earlier by a temporary workflow of this branch), in syncLong run (real account, real Windows client, built image)
docker compose stopwith a client that vanished (killed): 71 s, exit 0, world saved.PUBLICvariable overrode.envand put the server in MPFever's public list; a stranger joined through Steam) is fixed: every setting is nowSRV_-prefixed, the entrypoint validates its settings, andcheck.shrefuses any unprefixed variable in Compose.Administration, logs, updates (added; validated live on a built image)
docker logsfor every component ({"ts","level","component","msg"}: the launcher writes them withMPFEVER_LOG_JSON=1, the scripts the same shape);SRV_LOG_FORMAT=textfor 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 fromMPFEVER_CMDDIR. Tested:status,say,helpagainst the running server.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.)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.pypasses).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.SRV_MODS_SYNC=auto), so mods follow the server's updates; a mod.io outage never stops the server.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 asC:\modio. Found and checked on a real world.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, amissingfield in the player'smodcheck), a self-test (RunModStore).mods syncthen 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)
componentgame/dock, levels mapped,SRV_GAME_LOG=off|error|warn|info|debug,warnby default). Seen live: ~900 game lines atinfoduring a start.mods import <folder>: the administrator's local mods (a mounted folder; each folder withmod.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.SRV_ADMIN_UI=on): standard-library only, no external resource, token insecrets/admin-token(0600,mpfever-admin token), console verbsstatus list say save pause resume speed kick resync restart(neverstop), every command and refusal logged (admin-ui); its port is published on127.0.0.1only throughcompose.admin.yaml. Exercised with curl against the running server (page, 401 without a token,status, refusedstop); 12 unit tests. Not opened in a browser.Next (decided with the maintainer, not started)
Published image (2026-11-19, MPFever 0.9.2 and game build 40444)
ghcr.io/ampynjord/mpfever-server:0.9.2(also:experimental, same digestsha256:a4639ecf...), published by the manual "Release build" run withdocker_serveron 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, withinstall-gamerun 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)
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 inServer.cs/MainForm.cswith a self-test (RunSpeedVote).mpfever-admin bundlemakes a support zip without secrets, the game's log is shipped atinfoby default (server-only noise isinfo, not an error).SRV_BIND=127.0.0.1(nothing reachable from the network, players join through Steam),SRV_PUBLIC_ADDRESSso the list does not show the IP,pids_limit, guide section. Run live: worldexperimental(a new medium map, start year 1900, made with the game's New Game page),SRV_PUBLIC=true, pause when empty, listed with addresssteam-only.invalid:28090(no IP) and its Steam ID.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 sameLaunchApp. Nothing is forged. Run on the PC that hosts the server (build 40444):session-offline-ready=1after an online start; offline start:session-offline-can=1, logon accepted, game listed among 864 cached licences,launch-game-running=1, nosession-onlineline, 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 ashostkey, counted like wrong passwords), players need no password; excluded with--migrationand--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 intun_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; DockerSRV_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
compose.gpu.yaml, Linux hosts with/dev/dri; cannot work on Docker Desktop/WSL2 as written)docker_serveroption ofrelease.ymlrun once on a release tagloginre-run on a fresh machine by someone else; ARM hosts are not supportedserver/dock/src/client_layout.c, seeMAINTAINING.md)WineMode,MPFEVER_DOCK,MPFEVER_STOPFILE,MPFEVER_LOG_JSON,MPFEVER_CMDDIR,autoupdate=notify)main(squash on merge)Companion: #436 names the relay's image
mpfever-relay(it editsrelease.ymland 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
mainis 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:
serverlist/ServerList.csProbeTarget: an announcedhost:portis 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;PublicTargetalso refuses64: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.compose.yaml,.env.exampleand the guide isghcr.io/dkdknight/mpfever-server; the guide says how to build it yourself and that another source is a knowing choice; its quick start takescompose.yamland.env.examplefrom the project'smain(until the merge: from a branch you have read).Z:shows a folder of links that leaves/data/secretsout (SRV_WINE_RESTRICT_Z=0to 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 throughZ:is not stopped; the guide says so and advisesSRV_MODS_SYNC=offto review mod updates. Running the secrets under another user is not done.Should fix:
StartHostclearshostGame, so therelay=retry runs (seen on the public test server at its restart: first attempt failed, the retry 30 s later worked).SRV_STOP_GRACE(200 s) is a setting; the server refuses to start whenSRV_SHUTDOWN_WARNING+ 90 s does not fit in it (server/tests/test_settings.py).X-Forwarded-Hostor an origin listed inSRV_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
.envis refused (test); [x] the Steam login name is out of the start log (thestatuscommand 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 matchesListAnnounce.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 restrictedZ: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)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.pyOK, launcher--selftestOK. The full suite passes excepttest_ptpull0713.py(random model, "its process died twice"): its files are identical tomain, so it is not caused by this branch (not investigated further).ghcr.io/ampynjord/mpfever-server:0.9.5(sha256:6be7af50..., also:experimental) andghcr.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.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:
tests/test_ptpull0713.pyfails on the author's PC ("its process died twice"), files identical tomain: cause not foundOn 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).