CS2 icon indicating copy to clipboard operation
CS2 copied to clipboard

Extend the docs with some use cases and examples

Open borzaka opened this issue 2 years ago • 10 comments

I would like to see some solutions in the docs for the following topics:

  • How can I run multiple instances of the same server? With same/different settings (config files).
  • How can I access the server console? Not the Docker console, but the game console.
  • How can I configure CSTV?
  • How can I configure the container restarts? Every 3am for example.
  • Are there any recommended 3rd party softwares, to extend/make the CS2 server/Docker image configuration easy? Remote RCON, remote Docker, etc.
  • Minimum recommended hardware.
  • Minimum needed space.

borzaka avatar Oct 21 '23 10:10 borzaka

  1. How can I run multiple instances of the same server? With same/different settings (config files).
  • This would likely be done by just having multiple docker containers. Maybe a docker compose example could be given but I think this is becoming more of a guide to docker than this container.
  1. How can I access the server console? Not the Docker console, but the game console.
  • I too would like to know this or how to turn on cheats as i'm currently trying to figure this out. At the moment i'm modifying the steam/cs2/game/csgo/cfg/server.sfg but it resets every container restart
  1. How can I configure CSTV?
  • can't comment
  1. How can I configure the container restarts? Every 3am for example.
  • this would be around a cron job to docker stop, docker start and depends on your OS. This is a bit more of a generic, "how do I schedule docker containers for X" question
  1. Are there any recommended 3rd party softwares, to extend/make the CS2 server/Docker image configuration easy? Remote RCON, remote Docker, etc.
  • can't comment
  1. Minimum recommended hardware.
  • follow cs2 recommendations as it will be most up to date. A link could be added I guess
  1. Minimum needed space.
  • Same as above

magnushirst avatar Oct 22 '23 20:10 magnushirst

For multi instance, at least you have to change:

  • CS2_PORT
  • CS2_RCON_PORT
  • and probably other options as well: CS2_RCONPW, CS2_PW, +clientport, +tv_port, +servercfgfile
  • so almost every existing env variables, and non existings yet as well

Use case: I would like to run 3 dedicated servers in competitive game mode from the same server for a LAN tournament (matches are running simultaneously).

borzaka avatar Oct 23 '23 10:10 borzaka

Thanks for the comments. I run my CS2 servers under AWS Fargate, I can add some examples explaining that too.

Will put some effort into deployment examples this weekend if I find some time.

joedwards32 avatar Oct 23 '23 12:10 joedwards32

  1. For each server create an .env file with values specific to the server. In the compose file reference .env using:
version: '2'
services:
  cs2_server1:
    image: joedwards32/cs2
    env_file:
      - .env
 ...
  1. @joedwards32 If you use a volume for cs-data, then the server.sfg file should persist after rebooting container.

drogerschariot avatar Oct 26 '23 07:10 drogerschariot

If you use a volume for cs-data, then the server.sfg file should persist after rebooting container.

Currently this isn't the case because the container templates this file on launch: https://github.com/joedwards32/CS2/blob/main/bullseye/etc/entry.sh#L16

joedwards32 avatar Oct 26 '23 14:10 joedwards32

If you use a volume for cs-data, then the server.sfg file should persist after rebooting container.

Currently this isn't the case because the container templates this file on launch: https://github.com/joedwards32/CS2/blob/main/bullseye/etc/entry.sh#L16

What if you change the file permission to avoid the file to be re-writed?

yoyecros avatar Nov 02 '23 19:11 yoyecros

What if you change the file permission to avoid the file to be re-writed?

I think it would be better to create a new config file, e.g. my.cfg, and then use CS2_ADDITIONAL_ARGS to pass in +exec my.cfg.

joedwards32 avatar Nov 02 '23 20:11 joedwards32

I will test and document this properly in a PR if someone can save me some time by pointing me in the right direction. I'm using the env vars in the docker-compose.yml file to get this running, and it works. But do I need to modify and restart the server each time I want to change something like the map or number of bots? Is there an easier way to do that without having to restart the docker containers?

brandonaaskov avatar Nov 13 '23 14:11 brandonaaskov

I will test and document this properly in a PR if someone can save me some time by pointing me in the right direction. I'm using the env vars in the docker-compose.yml file to get this running, and it works. But do I need to modify and restart the server each time I want to change something like the map or number of bots? Is there an easier way to do that without having to restart the docker containers?

Most of the time it's enough if you just change to another map. I mean for the game server settings, not the container or other env variables.

borzaka avatar Nov 13 '23 21:11 borzaka

What if you change the file permission to avoid the file to be re-writed?

I think it would be better to create a new config file, e.g. my.cfg, and then use CS2_ADDITIONAL_ARGS to pass in +exec my.cfg.

@joedwards32 This is manual way of running a multi instance game server. Maybe it helps to implement this feature, or understand it better.

After the game is installed;

  • Starting the first game server instance: ./cs2-ds/game/bin/linuxsteamrt64/cs2 -dedicated -ip 0.0.0.0 -port 27015 +tv_port 27020 +servercfgfile server-1.cfg -maxplayers 12 +map de_dust2
  • Starting the second game server instance: ./cs2-ds/game/bin/linuxsteamrt64/cs2 -dedicated -ip 0.0.0.0 -port 27016 +tv_port 27021 +servercfgfile server-2.cfg -maxplayers 12 +map de_inferno

It won't execute the server.cfg because of the +servercfgfile.

In the server-[x].cfg file I configure settings which should be different (and the same as well) on the servers:

  • hostname
  • rcon_password
  • sv_password
  • other sv_ settings
  • logging
  • CSTV ports
  • etc.

Other way can be: use the server.cfg for the common settings, and create server-custom-1.cfg and exec it: +exec server-custom-1.cfg. But I haven't tested this method. I have tested the first method and it works nicely.

borzaka avatar Nov 13 '23 21:11 borzaka