From 693f7340ce5bbffef88f4b4ae141855cecc412cb Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 26 Oct 2023 21:32:03 +0100 Subject: [PATCH 01/10] Basic SourceTV/GOTV support --- README.md | 9 +++++++++ bullseye/Dockerfile | 4 ++++ bullseye/etc/server.cfg | 29 +++++++++++++++++++++++++++++ examples/docker-compose.yml | 1 + 4 files changed, 43 insertions(+) diff --git a/README.md b/README.md index 4041126..0afd77a 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,15 @@ CS2_BOT_QUOTA="" (Number of bots) CS2_BOT_QUOTA_MODE="" (fill, competitive) ``` +### GOTV/SourceTV + +```dockerfile +TV_ENABLE=1 (0 - disable, 1 - enable) +TV_PORT=27020 (SourceTV/GOTV port to bind to) +TV_AUTORECORD=0 (Automatically record all games as GOTV demos: 0=off, 1=on) +TV_RELAY_PW="changeme" (GOTV password for relay proxies) +``` + # Credits This container leans heavily on the work of [CM2Walki](https://github.com/CM2Walki/), especially his [SteamCMD](https://github.com/CM2Walki/steamcmd) container image. GG! diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 15e44f2..058e90a 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -52,6 +52,10 @@ ENV CS2_SERVERNAME="cs2 private server" \ CS2_GAMETYPE=0 \ CS2_GAMEMODE=1 \ CS2_LAN=0 \ + TV_AUTORECORD=0 \ + TV_ENABLE=1 \ + TV_PORT=27020 \ + TV_RELAY_PW="changeme" \ CS2_ADDITIONAL_ARGS="" # Set permissions on STEAMAPPDIR diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index 8aa41f3..027070b 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -7,3 +7,32 @@ sv_lan {{SERVER_LAN}} rcon_password "{{SERVER_RCON_PW}}" sv_password "{{SERVER_PW}}" + +// GOTV + +sv_hibernate_postgame_delay 180 + +sv_hibernate_postgame_delay 180 + +tv_allow_camera_man 1 // Auto director allows spectators to become camera man +tv_allow_static_shots 1 // Auto director uses fixed level cameras for shots +tv_autorecord {{TV_AUTORECORD}} // Automatically records all games as GOTV demos: 0=off, 1=on. +tv_chatgroupsize 0 // Set the default chat group size +tv_chattimelimit 8 // Limits spectators to chat only every n seconds +tv_debug 0 // GOTV debug info. +tv_delay 30 // GOTV broadcast delay in seconds +tv_delaymapchange 1 // Delays map change until broadcast is complete +tv_deltacache 2 // Enable delta entity bit stream cache +tv_dispatchmode 1 // Dispatch clients to relay proxies: 0=never, 1=if appropriate, 2=always +tv_enable {{TV_ENABLE}} // Activates GOTV on server: 0=off, 1=on. +tv_maxclients 10 // Maximum client number on GOTV server. +tv_maxrate 20000 // Max GOTV spectator bandwidth rate allowed, 0 == unlimited +tv_name "{{SERVER_HOSTNAME}}" // GOTV host name +tv_overridemaster 0 // Overrides the GOTV master root address. +tv_port {{TV_PORT}} // Host SourceTV port +tv_relaypassword {{TV_PW}} // GOTV password for relay proxies +tv_relayvoice 1 // Relay voice data: 0=off, 1=on +tv_snapshotrate 24 // Snapshots broadcasted per second +tv_timeout 60 // GOTV connection timeout in seconds. +tv_title "{{SERVER_HOSTNAME}}" // Set title for GOTV spectator UI +tv_transmitall 1 // Transmit all entities (not only director view) diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 894e81b..b55c621 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -33,5 +33,6 @@ services: ports: - "27015:27015/tcp" # TCP - "27015:27015/udp" # UDP + - "27020:27020/udp" # UDP volumes: cs2: From 3ce0d671d6f874d70c91c3ea41a56edd5963477e Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 26 Oct 2023 21:59:25 +0100 Subject: [PATCH 02/10] SourceTV fixes and documentation updates --- bullseye/etc/entry.sh | 13 ++++++--- bullseye/etc/server.cfg | 56 ++++++++++++++++++------------------- examples/docker-compose.yml | 5 ++++ 3 files changed, 41 insertions(+), 33 deletions(-) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 09dbbc9..688fae6 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -14,10 +14,15 @@ ln -sfT ${STEAMCMDDIR}/linux64/steamclient.so ~/.steam/sdk64/steamclient.so # Install server.cfg cp /etc/server.cfg "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg -sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/{{SERVER_PW}}/${CS2_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/{{SERVER_LAN}}/${CS2_LAN}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg +sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \ + -e "s/{{SERVER_PW}}/${CS2_PW}/g" \ + -e "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" \ + -e "s/{{SERVER_LAN}}/${CS2_LAN}/g" \ + -e "s/{{TV_ENABLE}}/${TV_ENABLE}/g" \ + -e "s/{{TV_PORT}}/${TV_PORT}/g" \ + -e "s/{{TV_AUTORECORD}}/${TV_AUTORECORD}/g" \ + -e "s/{{TV_RELAY_PW}}/${TV_RELAY_PW}/g" \ + "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg # Rewrite Config Files diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index 027070b..bef4f6e 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -1,38 +1,36 @@ // Server Defaults -hostname "{{SERVER_HOSTNAME}}" -sv_lan {{SERVER_LAN}} +hostname "{{SERVER_HOSTNAME}}" // Set server hostname +sv_lan {{SERVER_LAN}} // If a server is a LAN server there is no heartbeat, no Steam authentication, and no non-class C addresses // Passwords -rcon_password "{{SERVER_RCON_PW}}" -sv_password "{{SERVER_PW}}" +rcon_password "{{SERVER_RCON_PW}}" // Set rcon password +sv_password "{{SERVER_PW}}" // Set server password // GOTV -sv_hibernate_postgame_delay 180 +sv_hibernate_postgame_delay 180 // Delay server hibernation after all clients disconnect -sv_hibernate_postgame_delay 180 - -tv_allow_camera_man 1 // Auto director allows spectators to become camera man -tv_allow_static_shots 1 // Auto director uses fixed level cameras for shots -tv_autorecord {{TV_AUTORECORD}} // Automatically records all games as GOTV demos: 0=off, 1=on. -tv_chatgroupsize 0 // Set the default chat group size -tv_chattimelimit 8 // Limits spectators to chat only every n seconds -tv_debug 0 // GOTV debug info. -tv_delay 30 // GOTV broadcast delay in seconds -tv_delaymapchange 1 // Delays map change until broadcast is complete -tv_deltacache 2 // Enable delta entity bit stream cache -tv_dispatchmode 1 // Dispatch clients to relay proxies: 0=never, 1=if appropriate, 2=always -tv_enable {{TV_ENABLE}} // Activates GOTV on server: 0=off, 1=on. -tv_maxclients 10 // Maximum client number on GOTV server. -tv_maxrate 20000 // Max GOTV spectator bandwidth rate allowed, 0 == unlimited -tv_name "{{SERVER_HOSTNAME}}" // GOTV host name -tv_overridemaster 0 // Overrides the GOTV master root address. -tv_port {{TV_PORT}} // Host SourceTV port -tv_relaypassword {{TV_PW}} // GOTV password for relay proxies -tv_relayvoice 1 // Relay voice data: 0=off, 1=on -tv_snapshotrate 24 // Snapshots broadcasted per second -tv_timeout 60 // GOTV connection timeout in seconds. -tv_title "{{SERVER_HOSTNAME}}" // Set title for GOTV spectator UI -tv_transmitall 1 // Transmit all entities (not only director view) +tv_allow_camera_man 1 // Auto director allows spectators to become camera man +tv_allow_static_shots 1 // Auto director uses fixed level cameras for shots +tv_autorecord {{TV_AUTORECORD}} // Automatically records all games as GOTV demos: 0=off, 1=on. +tv_chatgroupsize 0 // Set the default chat group size +tv_chattimelimit 8 // Limits spectators to chat only every n seconds +tv_debug 0 // GOTV debug info. +tv_delay 30 // GOTV broadcast delay in seconds +tv_delaymapchange 1 // Delays map change until broadcast is complete +tv_deltacache 2 // Enable delta entity bit stream cache +tv_dispatchmode 1 // Dispatch clients to relay proxies: 0=never, 1=if appropriate, 2=always +tv_enable {{TV_ENABLE}} // Activates GOTV on server: 0=off, 1=on. +tv_maxclients 10 // Maximum client number on GOTV server. +tv_maxrate 20000 // Max GOTV spectator bandwidth rate allowed, 0 == unlimited +tv_name "{{SERVER_HOSTNAME}}" // GOTV host name +tv_overridemaster 0 // Overrides the GOTV master root address. +tv_port {{TV_PORT}} // Host SourceTV port +tv_relaypassword "{{TV_RELAY_PW}}" // GOTV password for relay proxies +tv_relayvoice 1 // Relay voice data: 0=off, 1=on +tv_snapshotrate 24 // Snapshots broadcasted per second +tv_timeout 60 // GOTV connection timeout in seconds. +tv_title "{{SERVER_HOSTNAME}}" // Set title for GOTV spectator UI +tv_transmitall 1 // Transmit all entities (not only director view) diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index b55c621..55d61ec 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -28,6 +28,11 @@ services: - CS2_BOT_DIFFICULTY # (0 - easy, 1 - normal, 2 - hard, 3 - expert) - CS2_BOT_QUOTA # (Number of bots) - CS2_BOT_QUOTA_MODE # (fill, competitive) + # TV + - TV_AUTORECORD=0 # Automatically records all games as GOTV demos: 0=off, 1=on. + - TV_ENABLE=1 # Activates GOTV on server: 0=off, 1=on. + - TV_PORT=27020 # Host SourceTV port + - TV_RELAY_PW=changeme # GOTV password for relay proxies volumes: - cs2:/home/steam/cs2-dedicated/ # (Change /mnt/cs2 according to your volume location) ports: From 5c4c0f79ac30b50b9f8c0a1740e83f068dc35f98 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 26 Oct 2023 22:05:27 +0100 Subject: [PATCH 03/10] Update references from GOTV to CSTV --- README.md | 8 ++++---- bullseye/etc/server.cfg | 24 ++++++++++++------------ examples/docker-compose.yml | 6 +++--- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 0afd77a..688076c 100644 --- a/README.md +++ b/README.md @@ -92,13 +92,13 @@ CS2_BOT_QUOTA="" (Number of bots) CS2_BOT_QUOTA_MODE="" (fill, competitive) ``` -### GOTV/SourceTV +### CSTV/SourceTV ```dockerfile TV_ENABLE=1 (0 - disable, 1 - enable) -TV_PORT=27020 (SourceTV/GOTV port to bind to) -TV_AUTORECORD=0 (Automatically record all games as GOTV demos: 0=off, 1=on) -TV_RELAY_PW="changeme" (GOTV password for relay proxies) +TV_PORT=27020 (SourceTV/CSTV port to bind to) +TV_AUTORECORD=0 (Automatically record all games as CSTV demos: 0=off, 1=on) +TV_RELAY_PW="changeme" (CSTV password for relay proxies) ``` # Credits diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index bef4f6e..0c85c8e 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -8,29 +8,29 @@ sv_lan {{SERVER_LAN}} // If a server is a LAN server there is no h rcon_password "{{SERVER_RCON_PW}}" // Set rcon password sv_password "{{SERVER_PW}}" // Set server password -// GOTV +// CSTV sv_hibernate_postgame_delay 180 // Delay server hibernation after all clients disconnect tv_allow_camera_man 1 // Auto director allows spectators to become camera man tv_allow_static_shots 1 // Auto director uses fixed level cameras for shots -tv_autorecord {{TV_AUTORECORD}} // Automatically records all games as GOTV demos: 0=off, 1=on. +tv_autorecord {{TV_AUTORECORD}} // Automatically records all games as CSTV demos: 0=off, 1=on. tv_chatgroupsize 0 // Set the default chat group size tv_chattimelimit 8 // Limits spectators to chat only every n seconds -tv_debug 0 // GOTV debug info. -tv_delay 30 // GOTV broadcast delay in seconds +tv_debug 0 // CSTV debug info. +tv_delay 30 // CSTV broadcast delay in seconds tv_delaymapchange 1 // Delays map change until broadcast is complete tv_deltacache 2 // Enable delta entity bit stream cache tv_dispatchmode 1 // Dispatch clients to relay proxies: 0=never, 1=if appropriate, 2=always -tv_enable {{TV_ENABLE}} // Activates GOTV on server: 0=off, 1=on. -tv_maxclients 10 // Maximum client number on GOTV server. -tv_maxrate 20000 // Max GOTV spectator bandwidth rate allowed, 0 == unlimited -tv_name "{{SERVER_HOSTNAME}}" // GOTV host name -tv_overridemaster 0 // Overrides the GOTV master root address. +tv_enable {{TV_ENABLE}} // Activates CSTV on server: 0=off, 1=on. +tv_maxclients 10 // Maximum client number on CSTV server. +tv_maxrate 20000 // Max CSTV spectator bandwidth rate allowed, 0 == unlimited +tv_name "{{SERVER_HOSTNAME}} CSTV" // CSTV host name +tv_overridemaster 0 // Overrides the CSTV master root address. tv_port {{TV_PORT}} // Host SourceTV port -tv_relaypassword "{{TV_RELAY_PW}}" // GOTV password for relay proxies +tv_relaypassword "{{TV_RELAY_PW}}" // CSTV password for relay proxies tv_relayvoice 1 // Relay voice data: 0=off, 1=on tv_snapshotrate 24 // Snapshots broadcasted per second -tv_timeout 60 // GOTV connection timeout in seconds. -tv_title "{{SERVER_HOSTNAME}}" // Set title for GOTV spectator UI +tv_timeout 60 // CSTV connection timeout in seconds. +tv_title "{{SERVER_HOSTNAME}} CSTV" // Set title for CSTV spectator UI tv_transmitall 1 // Transmit all entities (not only director view) diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 55d61ec..f0eab49 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -29,10 +29,10 @@ services: - CS2_BOT_QUOTA # (Number of bots) - CS2_BOT_QUOTA_MODE # (fill, competitive) # TV - - TV_AUTORECORD=0 # Automatically records all games as GOTV demos: 0=off, 1=on. - - TV_ENABLE=1 # Activates GOTV on server: 0=off, 1=on. + - TV_AUTORECORD=0 # Automatically records all games as CSTV demos: 0=off, 1=on. + - TV_ENABLE=1 # Activates CSTV on server: 0=off, 1=on. - TV_PORT=27020 # Host SourceTV port - - TV_RELAY_PW=changeme # GOTV password for relay proxies + - TV_RELAY_PW=changeme # CSTV password for relay proxies volumes: - cs2:/home/steam/cs2-dedicated/ # (Change /mnt/cs2 according to your volume location) ports: From 0048b8cdaa4d8c4b78517f6cc70521b6f1f58810 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 26 Oct 2023 22:22:00 +0100 Subject: [PATCH 04/10] Fixed hyperlink in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 688076c..684d675 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ or using docker-compose, see [examples](https://github.com/joedwards32/CS2/blob/ $ docker compose --file examples/docker-compose.yml up -d cs2-server ``` -You must have at least **40GB** of free disk space! See [System Requirements](#System Requirements). +You must have at least **40GB** of free disk space! See [System Requirements](./#System Requirements). `STEAMUSER` and `STEAMPASS` **are required as unlike CS:GO, CS2 can not be downloaded anonymously (at time of writing).** From f08a44285723ce8cca867a436deb6f67be996696 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 26 Oct 2023 22:22:53 +0100 Subject: [PATCH 05/10] Fixed hyperlink in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 684d675..4a1354b 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ or using docker-compose, see [examples](https://github.com/joedwards32/CS2/blob/ $ docker compose --file examples/docker-compose.yml up -d cs2-server ``` -You must have at least **40GB** of free disk space! See [System Requirements](./#System Requirements). +You must have at least **40GB** of free disk space! See [System Requirements](./#system-requirements). `STEAMUSER` and `STEAMPASS` **are required as unlike CS:GO, CS2 can not be downloaded anonymously (at time of writing).** From cc3d4ddce46be46ec8cc34fef67d5ff8ee9800cd Mon Sep 17 00:00:00 2001 From: John Edwards Date: Fri, 27 Oct 2023 09:26:43 +0100 Subject: [PATCH 06/10] Added support for TV client password --- README.md | 1 + bullseye/Dockerfile | 1 + bullseye/etc/entry.sh | 1 + bullseye/etc/server.cfg | 1 + examples/docker-compose.yml | 1 + 5 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 4a1354b..09cdab5 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ CS2_BOT_QUOTA_MODE="" (fill, competitive) TV_ENABLE=1 (0 - disable, 1 - enable) TV_PORT=27020 (SourceTV/CSTV port to bind to) TV_AUTORECORD=0 (Automatically record all games as CSTV demos: 0=off, 1=on) +TV_PW="changeme" (CSTV password for clients) TV_RELAY_PW="changeme" (CSTV password for relay proxies) ``` diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 058e90a..7ea93b3 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -55,6 +55,7 @@ ENV CS2_SERVERNAME="cs2 private server" \ TV_AUTORECORD=0 \ TV_ENABLE=1 \ TV_PORT=27020 \ + TV_PW="changeme" \ TV_RELAY_PW="changeme" \ CS2_ADDITIONAL_ARGS="" diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 688fae6..9c2a737 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -21,6 +21,7 @@ sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \ -e "s/{{TV_ENABLE}}/${TV_ENABLE}/g" \ -e "s/{{TV_PORT}}/${TV_PORT}/g" \ -e "s/{{TV_AUTORECORD}}/${TV_AUTORECORD}/g" \ + -e "s/{{TV_PW}}/${TV_PW}/g" \ -e "s/{{TV_RELAY_PW}}/${TV_RELAY_PW}/g" \ "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index 0c85c8e..cf1a849 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -28,6 +28,7 @@ tv_maxrate 20000 // Max CSTV spectator bandwidth rate allowed tv_name "{{SERVER_HOSTNAME}} CSTV" // CSTV host name tv_overridemaster 0 // Overrides the CSTV master root address. tv_port {{TV_PORT}} // Host SourceTV port +tv_password "{{TV_PW}}" // CSTV password for clients tv_relaypassword "{{TV_RELAY_PW}}" // CSTV password for relay proxies tv_relayvoice 1 // Relay voice data: 0=off, 1=on tv_snapshotrate 24 // Snapshots broadcasted per second diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index f0eab49..f536aee 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -32,6 +32,7 @@ services: - TV_AUTORECORD=0 # Automatically records all games as CSTV demos: 0=off, 1=on. - TV_ENABLE=1 # Activates CSTV on server: 0=off, 1=on. - TV_PORT=27020 # Host SourceTV port + - TV_PW=changeme # CSTV password for clients - TV_RELAY_PW=changeme # CSTV password for relay proxies volumes: - cs2:/home/steam/cs2-dedicated/ # (Change /mnt/cs2 according to your volume location) From 187d12ac85e9474c62c69bed800991b5b0050efd Mon Sep 17 00:00:00 2001 From: John Edwards Date: Fri, 27 Oct 2023 11:24:04 +0100 Subject: [PATCH 07/10] Expanded CSTV options to include snapshot rate and delay. --- README.md | 2 ++ bullseye/Dockerfile | 2 ++ bullseye/etc/entry.sh | 2 ++ bullseye/etc/server.cfg | 4 ++-- examples/docker-compose.yml | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 09cdab5..72cae96 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,8 @@ TV_PORT=27020 (SourceTV/CSTV port to bind to) TV_AUTORECORD=0 (Automatically record all games as CSTV demos: 0=off, 1=on) TV_PW="changeme" (CSTV password for clients) TV_RELAY_PW="changeme" (CSTV password for relay proxies) +TV_SNAPSHOTRATE=32 (World snapshots to broadcast per second. Affects camera tickrate.) +TV_DELAY=0 (CSTV broadcast delay in seconds) ``` # Credits diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 7ea93b3..05e2a8e 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -57,6 +57,8 @@ ENV CS2_SERVERNAME="cs2 private server" \ TV_PORT=27020 \ TV_PW="changeme" \ TV_RELAY_PW="changeme" \ + TV_SNAPSHOTRATE=32 \ + TV_DELAY=0 \ CS2_ADDITIONAL_ARGS="" # Set permissions on STEAMAPPDIR diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 9c2a737..b12e62f 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -23,6 +23,8 @@ sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \ -e "s/{{TV_AUTORECORD}}/${TV_AUTORECORD}/g" \ -e "s/{{TV_PW}}/${TV_PW}/g" \ -e "s/{{TV_RELAY_PW}}/${TV_RELAY_PW}/g" \ + -e "s/{{TV_SNAPSHOTRATE}}/${TV_SNAPSHOTRATE}/g" \ + -e "s/{{TV_DELAY}}/${TV_DELAY}/g" \ "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg # Rewrite Config Files diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index cf1a849..5bf7bfe 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -18,7 +18,7 @@ tv_autorecord {{TV_AUTORECORD}} // Automatically records all games as CSTV d tv_chatgroupsize 0 // Set the default chat group size tv_chattimelimit 8 // Limits spectators to chat only every n seconds tv_debug 0 // CSTV debug info. -tv_delay 30 // CSTV broadcast delay in seconds +tv_delay {{TV_DELAY}} // CSTV broadcast delay in seconds tv_delaymapchange 1 // Delays map change until broadcast is complete tv_deltacache 2 // Enable delta entity bit stream cache tv_dispatchmode 1 // Dispatch clients to relay proxies: 0=never, 1=if appropriate, 2=always @@ -31,7 +31,7 @@ tv_port {{TV_PORT}} // Host SourceTV port tv_password "{{TV_PW}}" // CSTV password for clients tv_relaypassword "{{TV_RELAY_PW}}" // CSTV password for relay proxies tv_relayvoice 1 // Relay voice data: 0=off, 1=on -tv_snapshotrate 24 // Snapshots broadcasted per second +tv_snapshotrate {{TV_SNAPSHOTRATE}} // Snapshots broadcasted per second tv_timeout 60 // CSTV connection timeout in seconds. tv_title "{{SERVER_HOSTNAME}} CSTV" // Set title for CSTV spectator UI tv_transmitall 1 // Transmit all entities (not only director view) diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index f536aee..b8bbbfc 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -34,6 +34,8 @@ services: - TV_PORT=27020 # Host SourceTV port - TV_PW=changeme # CSTV password for clients - TV_RELAY_PW=changeme # CSTV password for relay proxies + - TV_SNAPSHOTRATE=32 # World snapshots to broadcast per second. Affects camera tickrate. + - TV_DELAY=0 # CSTV broadcast delay in seconds volumes: - cs2:/home/steam/cs2-dedicated/ # (Change /mnt/cs2 according to your volume location) ports: From 8c44c66df97c4aaa85738fd12f98691086230334 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Fri, 27 Oct 2023 15:06:02 +0100 Subject: [PATCH 08/10] Disable TV by default and adjust TV defaults for best streaming performance --- README.md | 4 ++-- bullseye/Dockerfile | 4 ++-- bullseye/etc/entry.sh | 2 +- bullseye/etc/server.cfg | 3 +-- examples/docker-compose.yml | 6 +++--- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 72cae96..2d5d2cb 100644 --- a/README.md +++ b/README.md @@ -95,12 +95,12 @@ CS2_BOT_QUOTA_MODE="" (fill, competitive) ### CSTV/SourceTV ```dockerfile -TV_ENABLE=1 (0 - disable, 1 - enable) +TV_ENABLE=0 (0 - disable, 1 - enable) TV_PORT=27020 (SourceTV/CSTV port to bind to) TV_AUTORECORD=0 (Automatically record all games as CSTV demos: 0=off, 1=on) TV_PW="changeme" (CSTV password for clients) TV_RELAY_PW="changeme" (CSTV password for relay proxies) -TV_SNAPSHOTRATE=32 (World snapshots to broadcast per second. Affects camera tickrate.) +TV_MAXRATE=0 (Max CSTV spectator bandwidth rate allowed, 0 == unlimited) TV_DELAY=0 (CSTV broadcast delay in seconds) ``` diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 05e2a8e..5716aab 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -53,11 +53,11 @@ ENV CS2_SERVERNAME="cs2 private server" \ CS2_GAMEMODE=1 \ CS2_LAN=0 \ TV_AUTORECORD=0 \ - TV_ENABLE=1 \ + TV_ENABLE=0 \ TV_PORT=27020 \ TV_PW="changeme" \ TV_RELAY_PW="changeme" \ - TV_SNAPSHOTRATE=32 \ + TV_MAXRATE=0 \ TV_DELAY=0 \ CS2_ADDITIONAL_ARGS="" diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index b12e62f..cd2c14f 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -23,7 +23,7 @@ sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \ -e "s/{{TV_AUTORECORD}}/${TV_AUTORECORD}/g" \ -e "s/{{TV_PW}}/${TV_PW}/g" \ -e "s/{{TV_RELAY_PW}}/${TV_RELAY_PW}/g" \ - -e "s/{{TV_SNAPSHOTRATE}}/${TV_SNAPSHOTRATE}/g" \ + -e "s/{{TV_MAXRATE}}/${TV_MAXRATE}/g" \ -e "s/{{TV_DELAY}}/${TV_DELAY}/g" \ "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index 5bf7bfe..eea3fd4 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -24,14 +24,13 @@ tv_deltacache 2 // Enable delta entity bit stream cache tv_dispatchmode 1 // Dispatch clients to relay proxies: 0=never, 1=if appropriate, 2=always tv_enable {{TV_ENABLE}} // Activates CSTV on server: 0=off, 1=on. tv_maxclients 10 // Maximum client number on CSTV server. -tv_maxrate 20000 // Max CSTV spectator bandwidth rate allowed, 0 == unlimited +tv_maxrate {{TV_MAXRATE}} // Max CSTV spectator bandwidth rate allowed, 0 == unlimited tv_name "{{SERVER_HOSTNAME}} CSTV" // CSTV host name tv_overridemaster 0 // Overrides the CSTV master root address. tv_port {{TV_PORT}} // Host SourceTV port tv_password "{{TV_PW}}" // CSTV password for clients tv_relaypassword "{{TV_RELAY_PW}}" // CSTV password for relay proxies tv_relayvoice 1 // Relay voice data: 0=off, 1=on -tv_snapshotrate {{TV_SNAPSHOTRATE}} // Snapshots broadcasted per second tv_timeout 60 // CSTV connection timeout in seconds. tv_title "{{SERVER_HOSTNAME}} CSTV" // Set title for CSTV spectator UI tv_transmitall 1 // Transmit all entities (not only director view) diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index b8bbbfc..514d009 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -30,12 +30,12 @@ services: - CS2_BOT_QUOTA_MODE # (fill, competitive) # TV - TV_AUTORECORD=0 # Automatically records all games as CSTV demos: 0=off, 1=on. - - TV_ENABLE=1 # Activates CSTV on server: 0=off, 1=on. + - TV_ENABLE=0 # Activates CSTV on server: 0=off, 1=on. - TV_PORT=27020 # Host SourceTV port - TV_PW=changeme # CSTV password for clients - TV_RELAY_PW=changeme # CSTV password for relay proxies - - TV_SNAPSHOTRATE=32 # World snapshots to broadcast per second. Affects camera tickrate. - - TV_DELAY=0 # CSTV broadcast delay in seconds + - TV_MAXRATE=0 # World snapshots to broadcast per second. Affects camera tickrate. + - TV_DELAY=0 # Max CSTV spectator bandwidth rate allowed, 0 == unlimited volumes: - cs2:/home/steam/cs2-dedicated/ # (Change /mnt/cs2 according to your volume location) ports: From b8d6fe4533c57228b9630f4cd5d3b38b1c976b82 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 5 Nov 2023 14:28:31 +0000 Subject: [PATCH 09/10] Added basic support for pre/post hooks --- README.md | 11 +++++++++++ bullseye/Dockerfile | 2 ++ bullseye/etc/entry.sh | 16 ++++++++++++++++ bullseye/etc/post.sh | 5 +++++ bullseye/etc/pre.sh | 5 +++++ 5 files changed, 39 insertions(+) create mode 100755 bullseye/etc/post.sh create mode 100755 bullseye/etc/pre.sh diff --git a/README.md b/README.md index 2d5d2cb..a4dfe1d 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,17 @@ TV_MAXRATE=0 (Max CSTV spectator bandwidth rate allowed, 0 == unl TV_DELAY=0 (CSTV broadcast delay in seconds) ``` +# Customizing this Container + +## Pre and Post Hooks + +The container includes two scripts for executing custom actions: + +* `/home/steam/cs2-dedicated/pre.sh` is executed before the CS2 server starts +* `/home/steam/cs2-dedicated/post.sh` is executed after the CS2 server stops + +When using a persient volume mounted at `/home/steam/cs2-dedicated/` you may edit these scripts to perform custom actions, such as enabling metamod. + # Credits This container leans heavily on the work of [CM2Walki](https://github.com/CM2Walki/), especially his [SteamCMD](https://github.com/CM2Walki/steamcmd) container image. GG! diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 5716aab..759d4f8 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -18,6 +18,8 @@ ENV CFG_URL https://raw.githubusercontent.com/joedwards32/CS2/settings.tgz COPY etc/entry.sh "${HOMEDIR}/entry.sh" COPY etc/server.cfg "/etc/server.cfg" +COPY etc/pre.sh "/etc/pre.sh" +COPY etc/post.sh "/etc/post.sh" RUN set -x \ # Install, update & upgrade packages diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index cd2c14f..235c216 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -1,4 +1,6 @@ #!/bin/bash + +# Create App Dir mkdir -p "${STEAMAPPDIR}" || true # Download Updates @@ -27,6 +29,14 @@ sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \ -e "s/{{TV_DELAY}}/${TV_DELAY}/g" \ "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg +# Install hooks +if [[ ! -f "${STEAMAPPDIR}/pre.sh" ]] ; then + cp /etc/pre.sh "${STEAMAPPDIR}/pre.sh" +fi +if [[ ! -f "${STEAMAPPDIR}/post.sh" ]] ; then + cp /etc/post.sh "${STEAMAPPDIR}/post.sh" +fi + # Rewrite Config Files if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then @@ -42,6 +52,9 @@ fi # Switch to server directory cd "${STEAMAPPDIR}/game/bin/linuxsteamrt64" +# Pre Hook +bash "${STEAMAPPDIR}/pre.sh" + # Construct server arguments if [[ -z $CS2_GAMEALIAS ]]; then @@ -70,3 +83,6 @@ eval "./cs2" -dedicated \ +rcon_password "${CS2_RCONPW}" \ +sv_password "${CS2_PW}" \ "${CS2_ADDITIONAL_ARGS}" + +# Post Hook +bash "${STEAMAPPDIR}/post.sh" diff --git a/bullseye/etc/post.sh b/bullseye/etc/post.sh new file mode 100755 index 0000000..9256adf --- /dev/null +++ b/bullseye/etc/post.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# POST HOOK +# Make your customisation here +echo "post-hook: noop" diff --git a/bullseye/etc/pre.sh b/bullseye/etc/pre.sh new file mode 100755 index 0000000..eb0fb9a --- /dev/null +++ b/bullseye/etc/pre.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# PRE HOOK +# Make your customisation here +echo "pre-hook: noop" From 2830f2132f4fdd3ea788b5b6e152ab3305989c66 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 5 Nov 2023 21:09:57 +0000 Subject: [PATCH 10/10] sv_lan induced segfault and CS2_IP fixes --- README.md | 2 +- bullseye/etc/entry.sh | 10 ++++++++-- bullseye/etc/server.cfg | 1 - 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a4dfe1d..a03727c 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ STEAMGUARD="" (Optional, Steam Guard key if enabled. Use your most ```dockerfile CS2_SERVERNAME="changeme" (Set the visible name for your private server) -CS2_IP=0.0.0.0 (CS2 server listening IP address, 0.0.0.0 - all IP addresses on the local machine, empty - IP identified automatically) +CS2_IP="" (CS2 server listening IP address, 0.0.0.0 - all IP addresses on the local machine, empty - IP identified automatically) CS2_PORT=27015 (CS2 server listen port tcp_udp) CS2_RCON_PORT="" (Optional, use a simple TCP proxy to have RCON listen on an alternative port. Useful for services like AWS Fargate which do not support mixed protocol ports.) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 235c216..cae0ca0 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -19,7 +19,6 @@ cp /etc/server.cfg "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \ -e "s/{{SERVER_PW}}/${CS2_PW}/g" \ -e "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" \ - -e "s/{{SERVER_LAN}}/${CS2_LAN}/g" \ -e "s/{{TV_ENABLE}}/${TV_ENABLE}/g" \ -e "s/{{TV_PORT}}/${TV_PORT}/g" \ -e "s/{{TV_AUTORECORD}}/${TV_AUTORECORD}/g" \ @@ -65,6 +64,12 @@ else CS2_GAME_MODE_ARGS="+game_alias ${CS2_GAMEALIAS}" fi +if [[ -z $CS2_IP ]]; then + CS2_IP_ARGS="" +else + CS2_IP_ARGS="-ip ${CS2_IP}" +fi + # Start Server if [[ ! -z $CS2_RCON_PORT ]]; then @@ -73,7 +78,7 @@ if [[ ! -z $CS2_RCON_PORT ]]; then fi eval "./cs2" -dedicated \ - -ip "${CS2_IP}" -port "${CS2_PORT}" \ + "${CS2_IP_ARGS}" -port "${CS2_PORT}" \ -console \ -usercon \ -maxplayers "${CS2_MAXPLAYERS}" \ @@ -82,6 +87,7 @@ eval "./cs2" -dedicated \ +map "${CS2_STARTMAP}" \ +rcon_password "${CS2_RCONPW}" \ +sv_password "${CS2_PW}" \ + +sv_lan "${CS2_LAN}" \ "${CS2_ADDITIONAL_ARGS}" # Post Hook diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index eea3fd4..007e8a4 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -1,7 +1,6 @@ // Server Defaults hostname "{{SERVER_HOSTNAME}}" // Set server hostname -sv_lan {{SERVER_LAN}} // If a server is a LAN server there is no heartbeat, no Steam authentication, and no non-class C addresses // Passwords