Auto start/stop server if players > N

Discussion in 'Server & Community Management' started by Superzeka, Feb 17, 2020.

  1. Hello.
    Today I would like to talk about such a thing as the automatic launch of servers with a certain number of players on the server.

    I have a Kernel that is connected to each server and Bungeecord using the netty channel. And also on each VDS, a program is launched that copies the standard game server and launches it using a command. I ran into the following issues.

    1) To run on the VDS server you need to find a free port.
    2) Servers start after 15 seconds, and this is a very long time, and the kernel at this time does not see the new server and tries to start even more servers.
    3) During these 15 seconds before the server starts. Its port may be occupied by another server.

    In general, the question is: how can I start, for example, stop the SkyWars game servers in automatic mode, if the number of players is less than a certain number or more?

    I want to do both on Hypixel.

    Who does not know there if the number of players in the mode is too large, it automatically starts several more servers.
  2. Sounds like you're trying to achieve something pretty advanced in a pretty hacky way. There are orchastration platforms like Kubernetes which simplify this (given you have to learn Kubernetes first).

    You may need some central storage like Redis which can temporarily keep track of active and queued servers.

    Also, I'm not sure if I get the Hypixel reference.
  3. "I have a Kernel that is connected to each server and Bungeecord using the netty channel. "

    You're overcomplicating this.
    • Agree Agree x 1
  4. Using the wrong tools for the job*
  5. This is actually not the case. This is all done in order to update the status of game servers (wait, start, game is on, end, reboot), as well as to transfer information from one server to another. Therefore, I decided that the best and fastest way to transmit information is netty.
  6. Thanks a lot for recommending starting learning Kubernetes. In fact, I did without Kubernetes. My main problem is that I do not know how to track the server’s launch (before it binds to the port).

    Please tell me, is it possible to launch a java application while tying to it a Thread that would die if the server would finish its work?
  7. Not sure if that's possible. Thats why I suggested Kubernetes; pods are scheduled and created on request, not when they finish startup. Ports are also rocker internally so it doesn't matter what you bind them to. They can all run on the same port. Networking within the Kubernetes cluster is extremely simple. It may be difficult to use or get used to it, but its definitely a better tool for the job. You'd still have to program a few things yourself for intagration. I actually plan to soon do this myself for my own project.