install.sh enviroment needs to be documented.

There’s a severe lack of documentation about the environment in which install.sh runs. It would be nice if https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-build-packaging.html would be updated with information.

Things I’ve had to figure out on my own:

  • install.sh is run explicitly as sh install.sh, ie: any #!/bin/bash is ignored, so don’t expect bash features unless you explicitly create an additional bash script and just call it from install.sh.

  • Files extracted from your build are not writeable by the invoking user, so your script will probably need a lot of calls through sudo in it. This is also true of the executable you specify in the fleet config to run for each game server instance. eg: UE4’s wrapper script tries to chmod +x the actual executable, which will fail unless you modify the script to sudo chmod +x.

  • Files installed are owned by gl-user-server with gl-user as the group.
    Open questions of mine that remain:

  • What’s the actual user that runs the install.sh script and the game server executable specified by the fleet? This would be helpful in making permissions decisions such as: can I just g+w a directory that logs go into, or do I have to go full on a+w?

2 Likes

Thanks for thee feedback @Philippe23 – I’ve added this to our list for further action and let me get some assistance on your questions :slight_smile:

It would be nice to have some updates about this issue.
Thank you!

The documentation about the install script has been updated: https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-build-cli-uploading.html#gamelift-build-cli-uploading-install

Please let us know if anything is still unclear

Thank you

2 Likes

I solved my problem.
Thanks Dajun!

Hi, can you post a default example of the install.sh as required by the server? Basically, I just need a log.

In the link referenced, there is a sample install.sh file

#!/bin/bash
echo 'Hello World' > install.log

However, I have found more recently that Unreal Engine servers don’t need an install.sh script. That may have changed but if they do, I don’t believe the server needs anything to be installed in the Amazon Linux environment of the ec2 instances in the fleet in order to run successfully, so that may be why their sample script doesn’t include any install commands. However, this may not hold true for other kinds of game servers, for e.g. Unity, non-custom game servers, etc.

If your server does have some software dependencies that need to be installed before running, then you’ll have to include some yum install commands in your install.sh script.

Hi.

But if I do not provide an install.sh the GameLift Fleet fails with: “/local/game/install.sh is empty or does not exist.”

In this case, I would suggest creating an install.sh file, using Visual Studio Code to make it easier, add the sample code inside for now,

#!/bin/bash
echo 'Hello World' > install.log

and then add it to the root level of the game directory that you’re uploading to GameLift. If your server fails to run because of some missing software dependency issue, then you may have to modify the install.sh file with some yum install commands in your install.sh script.

Okay, it might have failed because at least under Windows I have to install the following (see 1st answer) https://answers.unrealengine.com/questions/248909/what-gets-installed-with-ue4prereqsetup-x64exe.html

Looking now for a file to install the same as with UE4PrereqSetup_x64.exe

Related Unreal Linux Dependencies

This simple install.sh works for me

#!/bin/bash

The error now is this

Server process exited without calling ProcessEnding(), exitCode(127)

The error means a command is missing.

Found this Linux Server (via How to correctly prepare Linux Executables - #14 by Zeliard), which appears to include the required files. GameLift/GameLiftLinuxServer at master · zeliard/GameLift · GitHub

However, does someone know how I can extract the required files for my build? Build it first?

I would suggest remote connecting into an instance in your fleet to check the server logs to see why the server is crashing.