Running a "proxy" process on gamelift

0

Hello !

I am trying to run a "proxy" process alongside my game servers. The idea is that all the game servers will communicate with this process over localhost and the proxy will forward this information to our backend services. This process is built using java and I have tried the following without much success

  1. Running the process as a part of the Fleet's RuntimeConfiguration however the process is restarted with a SERVER_PROCESS_SDK_INITIALIZATION_TIMEOUT every few minutes. Given its java and there is no Gamelift Server SDK for java, this option seems like a dead end with a lot of event spam.
  2. Running the process as part of install.sh. However when I try to nohup command & the process the fleet is stuck at FLEET_CREATION_RUNNING_INSTALLER for about 90 minutes before its moved to an ERROR state. I am unable to ssh into the instance entirely.

Why does the fleet installation get stuck despite the process running in the background ? Is there anything else I can do to run this process ?

Thanks !

已提问 3 年前287 查看次数
4 回答
0
已接受的回答

Thanks all for your suggestions. I managed to get it running as a systemd service. Here's the template in case anyone is looking for the same

echo 'Installing JDK 11'
sudo amazon-linux-extras install java-openjdk11 -y

echo 'Setting up proxy as a service'
sudo tee -a /etc/systemd/system/{{proxy_name}}.service > /dev/null <<EOT
[Unit]
Description=proxy for game servers
After=network.target

[Service]
User=root
WorkingDirectory={{gamelift_working_dir}}/
ExecStart=/usr/lib/jvm/jre-11/bin/java -Dlogging.file.name={{gamelift_working_dir}}/{{proxy_name}}.log -jar {{proxy_name}}-{{proxy_version}}-all.jar
SuccessExitStatus=143
Restart=always

[Install]
WantedBy=multi-user.target
EOT
sudo chmod 0644 /etc/systemd/system/{{proxy_name}}.service
sudo systemctl daemon-reload
sudo systemctl start {{proxy_name}}.service
sudo systemctl enable {{proxy_name}}.service
sudo systemctl status {{proxy_name}}.service
已回答 3 年前
profile picture
专家
已审核 1 个月前
0

Hi, did you tried to install the proxy as a linux service (assuming is linux OS)? This may be a good approach to ensure it's always running (depending on the init system): for systemd: https://singlebrook.com/2017/10/23/auto-restart-crashed-service-systemd/

Not sure this helps but for sure it will not hang the install script

已回答 3 年前
0

"FLEET_CREATION_RUNNING_INSTALLER – The game server build files were successfully extracted, and the Amazon GameLift is now running the build's install script (if one is included). Failure in this stage prevents a fleet from moving to ACTIVE status. Logs for this stage list the installation steps and whether or not the install completed successfully. Access the logs by using the URL in PreSignedLogUrl."

  • Indicates your install.sh is bad as the fleet never moved out of this stage (next step should be FLEET_CREATION_VALIDATING_RUNTIME_CONFIG I believe.

Things to bear in mind:

  1. The process that GameLift launches has to be the process that checks in with OnProcessReady etc. Otherwise you can't complete registration and GameLift recycles the process. So your proxy can't be the thing that is launched as part of the runtime config.

  2. GameLift runs on Amazon Linux 2 which is fairly barebones, so you can use docker and the AL2 image to test and tune your install.sh script

  3. Fleet events page should have the logs for running your install.sh script. You should be able to get the logs here from your script. It does sound like the script does not complete/hangs though.

  4. Not sure if you can access to the instance during the install part of fleet creation, but when debugging new fleets always open the debug ports as part of fleet creation (they can only be changed for fleets in ERROR or ACTIVE).

This may have some further useful information: https://forums.awsgametech.com/t/install-node-exporter-on-gamelift-instances/9857

If you are still having problems then if you provide a fleet id and region, I can get the GameLift service team to take a look and maybe they will have some advice for you.

已回答 3 年前
0

Good to know, I was expecting that would work.

已回答 3 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容