Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Docker/Kubernetes API #186

Open
PhlexPlexico opened this issue Apr 18, 2022 · 4 comments
Open

[Request] Docker/Kubernetes API #186

PhlexPlexico opened this issue Apr 18, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@PhlexPlexico
Copy link
Owner

Is your feature request related to a problem? Please describe.
Right now there is a hard requirement that a user should have their own servers set up in order to use the application. Instead, we should try and attempt to make the API as encompassing as possible, and one way of doing that is to create Game Servers on the fly. There's a few ways that this can be done (through options like DatHost), but I think having an app create local images may be better for tournament organizers, especially if we're running from a LAN.

Describe the solution you'd like
Either an implementation of Docker or Kubernets API calls that will allow us to create images/pods of CS:GO servers with Get5 and G5WS integrated. Once a user submits a match with its given values, it will check if the Docker/Kubernetes server will be available and spins up a server on the fly (maybe for public use have a docker flag on the user to see if they have permissions to create images), and once the match is complete it will check to see the database value (gameservers should have this flag as well) to see if it's a Docker server, and shut it down as necessary to avoid excess resource usage (barring if it's uploading demos or not).

Describe alternatives you've considered
A good stop-gap would be to implement DatHost API calls as well, since it's a service that's already up and running, and it would require the owner of a webpanel to have funding available.

@PhlexPlexico
Copy link
Owner Author

Just some notes while I continue investigating this, but I may bump this to 1.7.X or 1.8.0.

https://www.npmjs.com/package/node-docker-api

Include some config options, such as dockerSock or something similar in a config that would link to a docker instance. Could this possibly be remote? We would not like it to run within a docker container, but connect externally, that way the API is still decoupled from the API.

Do we need our own Docker image for CS? Maybe research to find one that has a simple CS:GO server with Sourcemod/MM, get5, SteamWorks, and G5WS installed.

Flow should maybe go something like this:

  • Include new POST body for choosing "docker", or just if server ID is empty, check to see if the Docker service is connected.
  • If it is, start spinning up the server, and wait for response. Generate random rcon_password and temporarily save in database? Does this mean game_servers table will require is_docker or something similar? Maybe not.
  • Update match to link back to temp game server.
  • Once match is complete, somehow check if server is docker container, wait until the demo is finished uploading (if enabled)
  • Delete game server from table, and call Docker calls to stop the container.
  • Need to report back the IP and port of the host machine then, if users wish to connect to the game server... Is this done with a config as well?

Just some comments for now while I work through this.

@kubo6472
Copy link
Contributor

maybe extending the watchdog of this project? https://github.com/kinsi55/docker_SRCDockS I used this with get5 and g5stack to run four servers taking the space of one.

@PhlexPlexico
Copy link
Owner Author

Hmmm that's interesting - but does it allow container orchestration/expose additional API calls to setup and tear down servers at will? The main thing I was looking for when writing this ticket was an external system (such as K8s, or docker swarm) that could listen to an end point and spin up a server and provide back an IP/port once it's been initialized.

Thanks!

@kubo6472
Copy link
Contributor

Hmmm that's interesting - but does it allow container orchestration/expose additional API calls to setup and tear down servers at will? The main thing I was looking for when writing this ticket was an external system (such as K8s, or docker swarm) that could listen to an end point and spin up a server and provide back an IP/port once it's been initialized.

Thanks!

I assume the watchdog script can be extended to provide info about the spun-up containers. Currently, it only provides the A2S_INFO endpoint for the server health check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants