Add Linux support for LocalMultiplayerAgent (containers and processes)#210
Add Linux support for LocalMultiplayerAgent (containers and processes)#210
Conversation
- Remove Linux container mode restriction in MultiplayerSettingsValidator - Set GameServerEnvironment to Linux on native Linux OS in Program.cs - Allow Linux process mode on native Linux in validator - Force docker pull on Linux for container mode - Fix hardcoded Windows path separator in ProcessRunner - Create setup_linux.sh setup script - Create sample configs for Linux containers and processes - Create linux.md documentation - Update README.md with Linux platform support - Update tests to reflect Linux now supports both modes Agent-Logs-Url: https://github.com/PlayFab/MpsAgent/sessions/ef46bb0d-1884-40a4-a3be-8f778e0967be Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
| // (and were based off of the parameters for containers). | ||
| string executablePath = sessionHostsStartInfo.AssetDetails[0].MountPath?.Length > 0 | ||
| ? parts[0].Replace(sessionHostsStartInfo.AssetDetails[0].MountPath, $"{localPathForAsset0}\\") | ||
| ? parts[0].Replace(sessionHostsStartInfo.AssetDetails[0].MountPath, $"{localPathForAsset0}{Path.DirectorySeparatorChar}") |
There was a problem hiding this comment.
@copilot how come was this line working on MacOS?
There was a problem hiding this comment.
This line was never reached on MacOS — MacOS only supports container mode (RunContainer=true is enforced by the validator at MultiplayerSettingsValidator.cs:115-122), so ProcessRunner is never instantiated or used there. The \\ was only ever executed on Windows. With this PR enabling process mode on Linux, the hardcoded \\ would produce incorrect paths on Linux, hence the fix to Path.DirectorySeparatorChar.
There was a problem hiding this comment.
@copilot yeah but on the production PlayFab Multiplayer Servers page, we have this code running on Linux processes and containers,
There was a problem hiding this comment.
You're right — my earlier answer was too narrow. VmAgent.Core is shared with production MPS, so this \\ was a pre-existing latent bug on Linux there as well, not just a LocalMultiplayerAgent issue. It would produce incorrect paths any time the MountPath?.Length > 0 back-compat branch is taken on a Linux host. The fix to Path.DirectorySeparatorChar corrects it for all platforms (production MPS and LocalMultiplayerAgent alike).
There was a problem hiding this comment.
@copilot but there is no bug on the production MPS service, Linux processes and containers work just fine.
There was a problem hiding this comment.
You're right — this branch is never reached on Linux. In process mode, MountPath is set to null (see MultiplayerSettings.cs:66: MountPath = RunContainer ? x.MountPath : null), so the MountPath?.Length > 0 condition is always false and the \\ is never executed. Reverted in 3a22157.
There was a problem hiding this comment.
You're right — this branch is never reached on Linux. In process mode, MountPath is set to null (MultiplayerSettings.cs:66: MountPath = RunContainer ? x.MountPath : null), so the MountPath?.Length > 0 condition is always false and the \\ is never executed. In container mode, ProcessRunner isn't used at all. Reverted in 3a22157.
| @@ -0,0 +1,161 @@ | |||
| # Linux Support | |||
There was a problem hiding this comment.
@copilot can we move these OS related md files into their own folder? Make sure to update all references
There was a problem hiding this comment.
Moved linux.md, macos.md, and lcow.md into a docs/ folder and updated all references in README.md and LocalMultiplayerAgent/readme.md (5e28122).
Agent-Logs-Url: https://github.com/PlayFab/MpsAgent/sessions/d05f2051-b8cb-49dc-be6d-723ac8c87075 Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
… taken on Linux Agent-Logs-Url: https://github.com/PlayFab/MpsAgent/sessions/1c40afcc-5189-4bdd-86d5-6c86de49f0d6 Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
| @@ -0,0 +1,40 @@ | |||
| { | |||
There was a problem hiding this comment.
@copilot let's remove all this MultiplayerSettings sample files on a separate folder. Make sure to update all references
There was a problem hiding this comment.
Moved all 4 sample JSON files into LocalMultiplayerAgent/Samples/ and updated references in the .csproj, docs, and readme (2cc8e4c).
… all references Agent-Logs-Url: https://github.com/PlayFab/MpsAgent/sessions/61f546a2-ffa9-4df1-a391-95ea4fb3bf80 Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
|
@copilot make sure to state in the README that this running on Linux is a beta (like we did for MacOS) |
Agent-Logs-Url: https://github.com/PlayFab/MpsAgent/sessions/78085e91-d9bf-4b9a-9085-b72d3f40747c Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
LocalMultiplayerAgent supported MacOS (containers only) and Windows (both modes), but Linux was limited to process mode only with container mode explicitly rejected. This PR enables both Linux containers and Linux processes on native Linux. Linux support is marked as beta, matching the MacOS pattern.
Core changes
Program.cs: Auto-setGameServerEnvironment.Linuxon Linux OS, matching the MacOS patternMultiplayerSettingsValidator.cs: Remove theRunContainer=truerejection on Linux; narrow theLinux+!RunContainerguard to only reject on non-Linux hosts (Windows LCOW still requires containers)MultiplayerServerManager.cs: Add Linux to the docker image pull path alongside MacOS/WindowsNew files
setup_linux.sh— Docker network setup script (mirrorssetup_macos.sh)Samples/MultiplayerSettingsLinuxContainersOnLinuxSample.json/Samples/MultiplayerSettingsLinuxProcessOnLinuxSample.json— Sample configs for both modesdocs/linux.md— Documentation covering container mode, process mode, building from source, and troubleshootingProject reorganization
linux.md,macos.md,lcow.md) from the repository root into adocs/folderLocalMultiplayerAgent/Samples/folderREADME.md,LocalMultiplayerAgent/readme.md,LocalMultiplayerAgent.csproj, and docs to point to the new pathsDocumentation
README.mdandLocalMultiplayerAgent/readme.md, consistent with the MacOS beta labelingLocalMultiplayerAgent/readme.mdTests
LinuxOsRejectsContainerModewithLinuxOsAcceptsContainerMode+LinuxOsAcceptsProcessModeAssert.Inconclusive/ skip guards on container-mode tests that were gated on!Linux— these now run on LinuxLinuxGameServerEnvironmentWithoutContainerFailsnarrowed to skip on native Linux where process mode is valid