question

Cedric Neukirchen avatar image
Cedric Neukirchen asked

Outdated Documentation (on a "new" feature?) - Linux Servers on Demand

Hello everyone,


Our team is quite shocked that the "new" Multiplayer 2.0 feature (https://api.playfab.com/blog/introducing-playfab-multiplayer-servers), which is supposed to have Windows and Linux Servers, seems to be not at all supporting Linux Servers?
I can see the pricing page listing Linux Servers, as well as the blog post listing it.


The documentation however seems to be outdated compared to the actual PlayFab page:


https://api.playfab.com/docs/tutorials/landing-tournaments/multiplayer-servers-2.0/deploying-playcompute-builds

The first image on this page shows a "Container Image" dropdown menu. This doesn't exist on our end. Here it also states that you are only supporting Windows. Now I'm not sure which part of this documentation page is uptodate and which is outdated.

Maybe it's on the second page of the process, but given I have to upload a build already on the first page which kinda forces us to a Window's .exe file, makes me think that the Linux option is not existing (anymore?).

We would like to take advantage of UE4 allowing us to easily build Linux Servers.
Now as far as it seems, PlayFab doesn't support this. Other forum posts seem to suggest that you (PlayFab) are planning on adding this later this year. We sadly can't really wait until the end of the year to have this feature.

Is there any way we can use Linux Builds with PlayFab or do we need to move away from PlayFab for our Servers? I assume we can simply use Azure directly or even GameLift, utilizing their ServerSDK and REST API.

Kind regards,
Cedric Neukirchen

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brandon@uprootstudios.com avatar image
brandon@uprootstudios.com answered

Hi, we recently got Linux servers working in Thunderhead. Here's PlayFab's instructions (and here's what worked for us):

1. Ensure the GSDK works in your server build

2. Build and compile in your engine for Linux

3. Ideally, test in Ubuntu and make sure your Linux instance works

4. If it works, you need to create a Docker container with a Linux image (we use Ubuntu, as does PlayFab) and your server executable.

4a. Set up Docker, create a Dockerfile

4b. It'll look something like this (we needed to install cURL on our containers due to Unity requirements):

FROM ubuntu:latest
COPY /path/to/server
COPY /path/to/shellFileToRunServerIfApplicable
RUN apt-get -y update
RUN apt-get -y install curl wget
WORKDIR /root/
ENTRYPOINT ["/bin/bash", "/shellFileToRunServerIfApplicable.sh"]

Next, run and build your docker. If the container runs and doesn't exit/error-out, use 'docker ps' instead of 'docker ps -a' in these next steps.

5. Obtain the container registry login information from PlayFab by calling GetContainerRegistryCredentials and it will return a URL, username, and password. Save these for the next steps.

6. Using docker, upload your running container to the PlayFab registry.

6a. These are the docker commands you should run, in order:

docker build -t [nameOfYourBuild] .
docker run -p [YourInboundServerPort]:[YourOutboundServerPort] [nameOfYourBuild] 
docker ps
***this will show running containers, get your container ID from here***

docker commit [container id] [tagOfYourContainer] 
docker login -u [user] -p [pass] [repo] 
***use the username/password and repo URL you got from PF earlier***

docker tag [tagOfYourContainer] [repo]/[tagOfYourContainer] 
docker push [repo]/[tagOfYourContainer] 
docker stop [container id]

7. Next, once the container is uploaded successfully, you need to actually create the server build.

7a. Use the ListContainerImages call to ensure the container was successfully uploaded to the registry.

7b. Then use ListContainerImageTags to get the tags for the selected container. When you have the most recent tag (probably "latest"), you're almost done!

8. You need to actually create the server build.

8a. Call the CreateBuildWithCustomContainer API and pass in your desired build parameters

For "BuildName", give it whatever name you want.

"ContainerFlavor" needs to be 'CustomLinux'

For "ContainerImageReference", pass in the name and tag that was uploaded earlier (and the ones you confirmed in the "ListContainerImages" and "ListContainerImageTags" calls)

For "MultiplayerServerCountPerVm", assign however many server containers you want per-virtual machine.

For "Ports", add any internal port your game server uses

For "RegionConfigurations", add any of the regions you want to push this build to.

The docs don't say VmSize is required, but I think it is, so ensure you select a VM size.

We went the route of creating an app to do most of this for us when we create new builds. Also, I'm not 100% positive, but I think you need to be authenticated for some or all of these calls. If so, use the Authentication API to call GetEntityToken with your secret key.

If all went well, you should get a valid response, and can now manage your Server builds in the GameManager like you can with Windows containers. I think in the (near?) future, adding Linux builds will be easier and supported by the PlayFab web GUI, although I'm not sure when this will be available.

6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Cedric Neukirchen avatar image Cedric Neukirchen commented ·

Holy cow, thanks for your answer.

I'll have to dig through that later/tomorrow (just updated the project to 4.22, gotta clean that mess up first). I haven't actually touched anything but the CloudScript of PlayFab yet, so I will have to look into how to use the commands/calls you provided.

I assume they are just simple HTTP requests?

0 Likes 0 ·
brandon@uprootstudios.com avatar image brandon@uprootstudios.com Cedric Neukirchen commented ·

If it makes you feel any better, we've only been using PlayFab for about a month (and getting a Unity-based server working with Thunderhead took about 5 days to figure out), but the APIs and usage become really easy to use and understand after a few days of trying them out.

The APIs you need to call can be called by HTTP, or you can use the PlayFab Unreal plugin to call the Admin/Multiplayer/Auth APIs. In the app that we have for controlling server builds, we built it in Unity and just use the PlayFab Unity SDK to make the calls, like so.

0 Likes 0 ·
Cedric Neukirchen avatar image Cedric Neukirchen brandon@uprootstudios.com commented ·

Alright, I will probably just write a quick and ugly c# app that allows me to do the same.

Thanks again!

0 Likes 0 ·
Show more comments
rahul-1 avatar image
rahul-1 answered

Hi @Brandon Phillips, Can you share the GSDK build files for linux, cause I tried to build the downloaded cpp solution for linux, but shows lots of error.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brandon@uprootstudios.com avatar image
brandon@uprootstudios.com answered
@Cedric Neukirchen

I agree, it is confusing at first. I created a tool for easily creating Linux-based containers and pushing your server to Thunderhead with just a few clicks. However, as of right now, it only works with Unity-based servers. I'm going to be implemented Unreal and other types of servers later, but I haven't had time to do that just yet. The general gist of the commands that need to be run can be found in the PowerShell script that the application runs here. The docker container runs in Thunderhead like any web-based server, although instead of Windows Server Core, the virtual OS is Ubuntu.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jean-Baptiste Lai avatar image Jean-Baptiste Lai commented ·

Thanks a million @Brandon Phillips! You might have saved me quite some pain. Is there a channel on discord if ever i need any help or help others with this?

0 Likes 0 ·
brandon@uprootstudios.com avatar image brandon@uprootstudios.com Jean-Baptiste Lai commented ·

@Jean-Baptiste Lai You can reach me on Discord bphillips09#3605

There's also a BaaS / Game Services Discord server (PlayFab has a channel there too)

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.