What happened to OC? - CLOSED Carnage?!
Enclusion

Automatically launch new server when full (Python Script)

Now that I have the halo server query python script working I have started working on some projects that ultilize it. This tool fulfills something I've wanted for a while: automatically create a new server, on a different port, when the server is full or has a certain player count. Over time, assuming I stay interested, I hope to expand this to a more full featured tool for managing many different servers at once in a variety of ways. THIS IS EXTREMELY EARLY IN DEVELOPMENT AND PROBABLY SHOULDN'T BE USED SERIOUSLY YET!!!

 

Repository: https://github.com/TagiaNetwork/halo-server-orchestration

Demonstration: 

 

 

Some notes:

  • This could all be done with shell scripting but I chose python because I hope to expand it quite a bit and also am more familiar with python for non tiny scripts
  • Currently everything is done through tmux sessions. This is a bit of a strange solution, though it works well and has the added benefit of being able to attach to sessions manually and perform server actions. In the future I might switch to using containers or some other system if they offer benefits but right now tmux was the easiest way to get everything going and still be able to perform actions like shutting down servers remotely
  • There are certainly bugs/issues, including (as of writing) not having a proper way to shut down the script (you need to manually kill the primary server tmux session). 
Takka, AntiMomentum and Solaris like this

Share this post


Link to post
Share on other sites

Tiddy-bits:

Yeah Docker would still require a script or two since it has no built in way to tell when Halo servers are full/empty. (Chalwk made a lua script that simply outputs the player count to a file, a separate script on the host such as Python or Bash would still have to watch that/those output files to start new containers/servers based on that. The same would be true for a query approach rather than watching a file).

As for shutdowns, maybe I'm a little confused but couldn't you have a tmux session for the script itself in order to kill it without killing the primary server? Or is that not even the issue for shutdowns?
 

Edited by AntiMomentum
Enclusion likes this

Share this post


Link to post
Share on other sites
15 hours ago, Enclusion said:

Now that I have the halo server query python script working I have started working on some projects that ultilize it. This tool fulfills something I've wanted for a while: automatically create a new server, on a different port, when the server is full or has a certain player count. Over time, assuming I stay interested, I hope to expand this to a more full featured tool for managing many different servers at once in a variety of ways. THIS IS EXTREMELY EARLY IN DEVELOPMENT AND PROBABLY SHOULDN'T BE USED SERIOUSLY YET!!!

 

Repository: https://github.com/TagiaNetwork/halo-server-orchestration

Demonstration: 

 

 

Some notes:

  • This could all be done with shell scripting but I chose python because I hope to expand it quite a bit and also am more familiar with python for non tiny scripts
  • Currently everything is done through tmux sessions. This is a bit of a strange solution, though it works well and has the added benefit of being able to attach to sessions manually and perform server actions. In the future I might switch to using containers or some other system if they offer benefits but right now tmux was the easiest way to get everything going and still be able to perform actions like shutting down servers remotely
  • There are certainly bugs/issues, including (as of writing) not having a proper way to shut down the script (you need to manually kill the primary server tmux session). 

I was thinking about doing something similar in AWS for several other game servers piping information into CloudWatch monitoring which would also kick off autoscaling as needed. I'm interested to see where you take this. :) 

Enclusion likes this

System Administrator (Well Rounded) | AWS | Azure | Microsoft 365

Share this post


Link to post
Share on other sites
15 minutes ago, Solaris said:

I was thinking about doing something similar in AWS for several other game servers piping information into CloudWatch monitoring which would also kick off autoscaling as needed. I'm interested to see where you take this. :) 

I'm hoping to expand it quite a bit and appreciate suggestions. If you have any specific features that you'd want please let me know here or as a github issue. 

2 hours ago, AntiMomentum said:

Yeah Docker would still require a script or two since it has no built in way to tell when Halo servers are full/empty. (Chalwk made a lua script that simply outputs the player count to a file, a separate script on the host such as Python or Bash would still have to watch that/those output files to start new containers/servers based on that. The same would be true for a query approach rather than watching a file).

As for shutdowns, maybe I'm a little confused but couldn't you have a tmux session for the script itself in order to kill it without killing the primary server? Or is that not even the issue for shutdowns?
 

I actually don't need any script on the server to detect player count since I wrote a python script, used in this project, that can query any server and access the player count. I'd just need the ip and port of the server running in docker. 

 

In terms of shutting down its a really easy fix, I just need to add a CTRL+C exception handler to shut everything down just haven't done that yet (since I'm not sure how tied in to tmux I want the application to be since in the future I'll want multiple vps to work together) 

Edited by Enclusion
AntiMomentum likes this

Share this post


Link to post
Share on other sites
5 hours ago, Enclusion said:

I actually don't need any script on the server to detect player count since I wrote a python script, used in this project, that can query any server and access the player count. I'd just need the ip and port of the server running in docker. 


Oh yeah I already understood that, np though, I was just making the point that that the alternatives would still require something extra such as your Python script anyways. So like in terms of multiple halos on a single vps that's just totally up to preference. Docker in itself is going to be any more useful for halo than writing your own scripts. About literally the only benefit in this case would be that Docker can "pause" containers, but even then only useful if you want to preserve the state of the game while it's empty without using as much resources to keep the container open. And even then I'm not sure how long it can stay paused before something goes wrong with halo.

 

 

6 hours ago, Enclusion said:

(since I'm not sure how tied in to tmux I want the application to be since in the future I'll want multiple vps to work together) 



But anyways you're probably already aware of this but regardless of the method for multiple vps:
I'd be sure to have a unique identifier for your vps query responses. Like if you did this all via python, a unique key/string personal to your own servers. Or sent through ssh. That way the master controller (especially if it has the ability to spin up a vps and not just halo) isn't simply requiring the source ip  to assume the query response is legit.

Enclusion likes this

Share this post


Link to post
Share on other sites
  • Recently Browsing   0 members

    No registered users viewing this page.