From 151d11e7c83897a4ca7246c3f82e9e5a7684c2fa Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sat, 30 Sep 2023 16:52:25 +0100 Subject: [PATCH 001/113] Initial commit --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a581133 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 John Edwards + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 0ccf90faac5a0bb4ab7514eb23931691167c5e87 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sat, 30 Sep 2023 20:58:08 +0100 Subject: [PATCH 002/113] Initial commit --- README.md | 47 +++++++++++++++++++++++++++++++++++++ bullseye/.dockerignore | 1 + bullseye/Dockerfile | 53 ++++++++++++++++++++++++++++++++++++++++++ bullseye/etc/entry.sh | 20 ++++++++++++++++ bullseye/hooks/build | 5 ++++ bullseye/hooks/push | 2 ++ 6 files changed, 128 insertions(+) create mode 100644 README.md create mode 100644 bullseye/.dockerignore create mode 100644 bullseye/Dockerfile create mode 100644 bullseye/etc/entry.sh create mode 100644 bullseye/hooks/build create mode 100644 bullseye/hooks/push diff --git a/README.md b/README.md new file mode 100644 index 0000000..925bdbe --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# What is Counter-Strike 2 +For over two decades, Counter-Strike has offered an elite competitive experience, one shaped by millions of players from across the globe. And now the next chapter in the CS story is about to begin. This is Counter-Strike 2. +This Docker image contains the dedicated server of the game. + +> [CS2](https://store.steampowered.com/app/730/CounterStrike_2/) + +logo + +# How to use this image +## Hosting a simple game server + +Running on the *host* interface (recommended):
+```console +$ docker run -d --net=host --name=cs2 -e STEAMUSER={YOUR_STEAM_USER} -e STEAMPASS={YOUR_STEAM_PASSWD} joedwards32/cs2 +``` + +Running using a bind mount for data persistence on container recreation: +```console +$ mkdir -p $(pwd)/cs2-data +$ chmod 777 $(pwd)/cs2-data # Makes sure the directory is writeable by the unprivileged container user +$ docker run -d --net=host -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ --name=cs2-dedicated -e STEAMUSER={YOUR_STEAM_USER} -e STEAMPASS={YOUR_STEAM_PASSWD} joedwards32/cs2 +``` + +`STEAMUSER` and `STEAMPASS` **are required as unlike CS:GO, CS2 can not be downloaded anonymously (at time of writing).** + +**Steam Guard must be disabled on the Steam Account** + +**For security reasons, it is strongly recommended that you create a new Steam Account separate to your personal Steam Account.** + +**The container will automatically update the game on startup, so if there is a game update just restart the container.** + +# Configuration +## Environment Variables +Feel free to overwrite these environment variables, using -e (--env): +```dockerfile +STEAMUSER="changeme" (Steam User for SteamCMD. Steam Guard must be disabled.) +STEAMPASS="changeme" (Password for Steam User.) +CS2_PORT=27015 (CS2 server listen port tcp_udp) +CS2_RCONPW="changeme" (RCON password) +CS2_PW="changeme" (CS2 server password) +CS2_MAXPLAYERS=10 (Max players) +CS2_GAMETYPE=0 (Game type, see) +CS2_GAMEMODE=0 (Game mode, see) +CS2_MAPGROUP="mg_active" (Map pool) +CS2_STARTMAP="de_inferno" (Start map) +CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) +``` diff --git a/bullseye/.dockerignore b/bullseye/.dockerignore new file mode 100644 index 0000000..c0362b8 --- /dev/null +++ b/bullseye/.dockerignore @@ -0,0 +1 @@ +hooks/ diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile new file mode 100644 index 0000000..7a2b9ef --- /dev/null +++ b/bullseye/Dockerfile @@ -0,0 +1,53 @@ +########################################################### +# Dockerfile that builds a CS2 Gameserver +########################################################### +FROM cm2network/steamcmd:root as build_stage + +LABEL maintainer="joedwards32@gmail.com" + +ENV STEAMUSER "changeme" +ENV STEAMPASS "changeme" +ENV STEAMAPPID 730 +ENV STEAMAPP cs2 +ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated" +ENV CFG_URL https://raw.githubusercontent.com/joedwards32/CS2/settings.tgz + +COPY etc/entry.sh "${HOMEDIR}/entry.sh" + +RUN set -x \ + # Install, update & upgrade packages + && apt-get update \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + wget \ + ca-certificates \ + lib32z1 \ + && mkdir -p "${STEAMAPPDIR}" \ + # Add entry script + && chmod +x "${HOMEDIR}/entry.sh" \ + && chown -R "${USER}:${USER}" "${HOMEDIR}/entry.sh" "${STEAMAPPDIR}" \ + # Clean up + && rm -rf /var/lib/apt/lists/* + +FROM build_stage AS bullseye-base + +ENV CS2_PORT=27015 \ + CS2_MAXPLAYERS=10 \ + CS2_RCONPW="changeme" \ + CS2_PW="changeme" \ + CS2_MAPGROUP="mg_active" \ + CS2_STARTMAP="de_inferno" \ + CS2_GAMETYPE=0 \ + CS2_GAMEMODE=0 \ + CS2_ADDITIONAL_ARGS="" + +# Switch to user +USER ${USER} + +WORKDIR ${HOMEDIR} + +CMD ["bash", "entry.sh"] + +# Expose ports +EXPOSE 27015/tcp \ + 27015/udp \ + 27020/udp diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh new file mode 100644 index 0000000..f988562 --- /dev/null +++ b/bullseye/etc/entry.sh @@ -0,0 +1,20 @@ +#!/bin/bash +mkdir -p "${STEAMAPPDIR}" || true + +bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ + +login "${STEAMUSER}" "${STEAMPASS}" \ + +app_update "${STEAMAPPID}" \ + +quit + + +"${STEAMAPPDIR}/game/bin/linuxsteamrt64/cs2" -dedicated \ + -usercon \ + +game_type "${CS2_GAMETYPE}" \ + +game_mode "${CS2_GAMEMODE}" \ + +mapgroup "${CS2_MAPGROUP}" \ + +map "${CS2_STARTMAP}" \ + +sv_setsteamaccount \ + -maxplayers_override "${CS2_MAXPLAYERS}" \ + +rcon_password "${CS2_RCONPW}" \ + +sv_password "${CS2_PW}" \ + "${CS2_ADDITIONAL_ARGS}" diff --git a/bullseye/hooks/build b/bullseye/hooks/build new file mode 100644 index 0000000..cfffa83 --- /dev/null +++ b/bullseye/hooks/build @@ -0,0 +1,5 @@ +#!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +docker build --target=bullseye-base -t $DOCKER_REPO:latest -t $DOCKER_REPO:base ${SCRIPT_DIR}/.. diff --git a/bullseye/hooks/push b/bullseye/hooks/push new file mode 100644 index 0000000..93a8d0d --- /dev/null +++ b/bullseye/hooks/push @@ -0,0 +1,2 @@ +#!/bin/bash +docker push --all-tags ${DOCKER_REPO} From a8f5135f946a3dcc4734ea472c3df929345bad35 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sat, 30 Sep 2023 21:09:50 +0100 Subject: [PATCH 003/113] Updated readme to credit CMWalki --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 925bdbe..52b98d3 100644 --- a/README.md +++ b/README.md @@ -45,3 +45,6 @@ CS2_MAPGROUP="mg_active" (Map pool) CS2_STARTMAP="de_inferno" (Start map) CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) ``` +# 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! From 7e38874c3959db05f63e943bbe6e2679df6510c4 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 1 Oct 2023 10:48:00 +0100 Subject: [PATCH 004/113] Updated README to reference https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers --- README.md | 4 ++-- bullseye/Dockerfile | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 52b98d3..b4c4f3d 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,8 @@ CS2_PORT=27015 (CS2 server listen port tcp_udp) CS2_RCONPW="changeme" (RCON password) CS2_PW="changeme" (CS2 server password) CS2_MAXPLAYERS=10 (Max players) -CS2_GAMETYPE=0 (Game type, see) -CS2_GAMEMODE=0 (Game mode, see) +CS2_GAMETYPE=0 (Game type, see https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) +CS2_GAMEMODE=0 (Game mode, see https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) CS2_MAPGROUP="mg_active" (Map pool) CS2_STARTMAP="de_inferno" (Start map) CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 7a2b9ef..c11b44d 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -40,6 +40,12 @@ ENV CS2_PORT=27015 \ CS2_GAMEMODE=0 \ CS2_ADDITIONAL_ARGS="" +# Set permissions on STEAMAPPDIR +# Permissions may need to be reset if persistent volume mounted +RUN set -x \ + && chown -R "${USER}:${USER}" "${STEAMAPPDIR}" \ + && chmod 0777 "${STEAMAPPDIR}" + # Switch to user USER ${USER} From 33ef689fc0f0f714165a9d828e289e157f336dc3 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 1 Oct 2023 10:52:52 +0100 Subject: [PATCH 005/113] Create docker-image.yml --- .github/workflows/docker-image.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..f0c8011 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag joedwards32/cs2:latest From 020dcf42c00ed8b6ac5e307498cbb81f1f7e4691 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 1 Oct 2023 10:54:38 +0100 Subject: [PATCH 006/113] Update docker-image.yml Correctly reference dockerfile --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index f0c8011..da80f55 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,4 +15,4 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build the Docker image - run: docker build . --file Dockerfile --tag joedwards32/cs2:latest + run: docker build . --file bullseye/Dockerfile --tag joedwards32/cs2:latest From 42cac27b71d082fea381f337f59da506adcf6718 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 1 Oct 2023 10:58:08 +0100 Subject: [PATCH 007/113] Update docker-image.yml Set current working directory so that relative paths in Dockerfile are correct --- .github/workflows/docker-image.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index da80f55..7c5af2c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,4 +15,5 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build the Docker image - run: docker build . --file bullseye/Dockerfile --tag joedwards32/cs2:latest + working-directory: ./bullseye + run: docker build . --file Dockerfile --tag joedwards32/cs2:latest From 9ca9832d89a7d7638c8eb9c2cc69e389ce46b330 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 1 Oct 2023 11:01:14 +0100 Subject: [PATCH 008/113] Added Docker Image CI build status to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b4c4f3d..b26732b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Docker Image CI](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml/badge.svg?branch=main)](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml) + # What is Counter-Strike 2 For over two decades, Counter-Strike has offered an elite competitive experience, one shaped by millions of players from across the globe. And now the next chapter in the CS story is about to begin. This is Counter-Strike 2. This Docker image contains the dedicated server of the game. From 99b24290bb89b6edf96b5dc1b6a01b5688120ebd Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 1 Oct 2023 14:57:11 +0100 Subject: [PATCH 009/113] Added environment variables to control bot behaviour --- README.md | 6 +++++- bullseye/etc/entry.sh | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b26732b..7bd6365 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Docker Image CI](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml/badge.svg?branch=main)](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml) -# What is Counter-Strike 2 +# What is Counter-Strike 2? For over two decades, Counter-Strike has offered an elite competitive experience, one shaped by millions of players from across the globe. And now the next chapter in the CS story is about to begin. This is Counter-Strike 2. This Docker image contains the dedicated server of the game. @@ -46,7 +46,11 @@ CS2_GAMEMODE=0 (Game mode, see https://developer.valvesoftware.com/ CS2_MAPGROUP="mg_active" (Map pool) CS2_STARTMAP="de_inferno" (Start map) CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) +CS2_BOT_DIFFICULTY="" (0 - easy, 1 - normal, 2 - hard, 3 - expert) +CS2_BOT_QUOTA="" (Number of bots) +CS2_BOT_QUOTA_MODE="" (fill, competitive) ``` + # 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/etc/entry.sh b/bullseye/etc/entry.sh index f988562..511cf97 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -1,11 +1,25 @@ #!/bin/bash mkdir -p "${STEAMAPPDIR}" || true +# Download Updates + bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ +login "${STEAMUSER}" "${STEAMPASS}" \ +app_update "${STEAMAPPID}" \ +quit +# Rewrite Config Files +if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then + sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" /home/steam/cs2-dedicated/game/csgo/cfg/* +fi +if [[ ! -z $CS2_BOT_QUOTA ]] ; then + sed -i "s/bot_quota.*/bot_quota ${CS2_BOT_QUOTA}/" /home/steam/cs2-dedicated/game/csgo/cfg/* +fi +if [[ ! -z $CS2_BOT_QUOTA_MODE ]] ; then + sed -i "s/bot_quota_mode.*/bot_quota_mode ${CS2_BOT_QUOTA_MODE}/" /home/steam/cs2-dedicated/game/csgo/cfg/* +fi + +# Start Server "${STEAMAPPDIR}/game/bin/linuxsteamrt64/cs2" -dedicated \ -usercon \ From d51908fe3c2b595f1f53ce4e22601345e88c1dde Mon Sep 17 00:00:00 2001 From: John Edwards Date: Mon, 2 Oct 2023 08:28:05 +0100 Subject: [PATCH 010/113] Added support for Steam Guard key to be provided as environment variable --- README.md | 3 ++- bullseye/Dockerfile | 1 + bullseye/etc/entry.sh | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7bd6365..ec15986 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,9 @@ $ docker run -d --net=host -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ --name= ## Environment Variables Feel free to overwrite these environment variables, using -e (--env): ```dockerfile -STEAMUSER="changeme" (Steam User for SteamCMD. Steam Guard must be disabled.) +STEAMUSER="changeme" (Steam User for SteamCMD.) STEAMPASS="changeme" (Password for Steam User.) +STEAMGUARD="" (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.) CS2_PORT=27015 (CS2 server listen port tcp_udp) CS2_RCONPW="changeme" (RCON password) CS2_PW="changeme" (CS2 server password) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index c11b44d..03a75c8 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -7,6 +7,7 @@ LABEL maintainer="joedwards32@gmail.com" ENV STEAMUSER "changeme" ENV STEAMPASS "changeme" +ENV STEAMGUARD "" ENV STEAMAPPID 730 ENV STEAMAPP cs2 ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated" diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 511cf97..60001e7 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -4,11 +4,12 @@ mkdir -p "${STEAMAPPDIR}" || true # Download Updates bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ - +login "${STEAMUSER}" "${STEAMPASS}" \ + +login "${STEAMUSER}" "${STEAMPASS}" "${STEAMGUARD}" \ +app_update "${STEAMAPPID}" \ +quit # Rewrite Config Files + if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" /home/steam/cs2-dedicated/game/csgo/cfg/* fi From 2d93e45b28ebc9a01a074ead871cb8e03f0cd2ab Mon Sep 17 00:00:00 2001 From: John Edwards Date: Mon, 2 Oct 2023 08:32:34 +0100 Subject: [PATCH 011/113] Readme updated --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index ec15986..c6ae30a 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,7 @@ $ docker run -d --net=host -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ --name= `STEAMUSER` and `STEAMPASS` **are required as unlike CS:GO, CS2 can not be downloaded anonymously (at time of writing).** -**Steam Guard must be disabled on the Steam Account** - -**For security reasons, it is strongly recommended that you create a new Steam Account separate to your personal Steam Account.** +`STEAMGUARD` **must be used to provide your more recent Steam Guard key if Steam Guard is enabled on your account.** **The container will automatically update the game on startup, so if there is a game update just restart the container.** From 056fbb9a3a7c5e1464f400b8c729404d8c48612a Mon Sep 17 00:00:00 2001 From: John Edwards Date: Mon, 2 Oct 2023 14:44:32 +0100 Subject: [PATCH 012/113] Issue-3 Env var parsing bug fixes * Password now set on commandline and in server.cfg * Rcon password now set on commandline and in server.cfg * Server name now set in server.cfg --- README.md | 1 + bullseye/Dockerfile | 4 +++- bullseye/etc/entry.sh | 15 +++++++++++---- bullseye/etc/server.cfg | 9 +++++++++ 4 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 bullseye/etc/server.cfg diff --git a/README.md b/README.md index c6ae30a..bb65ebd 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Feel free to overwrite these environment variables, using -e (--env): STEAMUSER="changeme" (Steam User for SteamCMD.) STEAMPASS="changeme" (Password for Steam User.) STEAMGUARD="" (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.) +CS2_SERVERNAME="changeme" (Set the visible name for your private server) CS2_PORT=27015 (CS2 server listen port tcp_udp) CS2_RCONPW="changeme" (RCON password) CS2_PW="changeme" (CS2 server password) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 03a75c8..a62d68c 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -14,6 +14,7 @@ ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated" 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" RUN set -x \ # Install, update & upgrade packages @@ -31,7 +32,8 @@ RUN set -x \ FROM build_stage AS bullseye-base -ENV CS2_PORT=27015 \ +ENV CS2_SERVERNAME="cs2 private server" \ + CS2_PORT=27015 \ CS2_MAXPLAYERS=10 \ CS2_RCONPW="changeme" \ CS2_PW="changeme" \ diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 60001e7..09832e7 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -8,28 +8,35 @@ bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ +app_update "${STEAMAPPID}" \ +quit +# Install server.cfg +cp /etc/server.cfg "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg +sed -i "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg +sed -i "s/{{SERVER_PW}}/${CS2_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg +sed -i "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg + # Rewrite Config Files if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then - sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" /home/steam/cs2-dedicated/game/csgo/cfg/* + sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi if [[ ! -z $CS2_BOT_QUOTA ]] ; then - sed -i "s/bot_quota.*/bot_quota ${CS2_BOT_QUOTA}/" /home/steam/cs2-dedicated/game/csgo/cfg/* + sed -i "s/bot_quota.*/bot_quota ${CS2_BOT_QUOTA}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi if [[ ! -z $CS2_BOT_QUOTA_MODE ]] ; then - sed -i "s/bot_quota_mode.*/bot_quota_mode ${CS2_BOT_QUOTA_MODE}/" /home/steam/cs2-dedicated/game/csgo/cfg/* + sed -i "s/bot_quota_mode.*/bot_quota_mode ${CS2_BOT_QUOTA_MODE}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi # Start Server "${STEAMAPPDIR}/game/bin/linuxsteamrt64/cs2" -dedicated \ + -console \ -usercon \ + -maxplayers_override "${CS2_MAXPLAYERS}" \ +game_type "${CS2_GAMETYPE}" \ +game_mode "${CS2_GAMEMODE}" \ +mapgroup "${CS2_MAPGROUP}" \ +map "${CS2_STARTMAP}" \ +sv_setsteamaccount \ - -maxplayers_override "${CS2_MAXPLAYERS}" \ +rcon_password "${CS2_RCONPW}" \ +sv_password "${CS2_PW}" \ "${CS2_ADDITIONAL_ARGS}" diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg new file mode 100644 index 0000000..40ef404 --- /dev/null +++ b/bullseye/etc/server.cfg @@ -0,0 +1,9 @@ +// Server Defaults + +hostname "{{SERVER_HOSTNAME}}" +sv_lan "0" + +// Passwords + +rcon_password "{{SERVER_RCON_PW}}" +sv_password "{{SERVER_PW}}" From a66269bd895021e82b51c1f145c425080e59cb95 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Wed, 4 Oct 2023 15:55:28 +0100 Subject: [PATCH 013/113] Issue-6 allow users to define game server port number --- bullseye/etc/entry.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 09832e7..74a1fb0 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -29,6 +29,7 @@ fi # Start Server "${STEAMAPPDIR}/game/bin/linuxsteamrt64/cs2" -dedicated \ + -port "${CS2_PORT}" \ -console \ -usercon \ -maxplayers_override "${CS2_MAXPLAYERS}" \ From cfbab93d85847adbb000f44c6479d012e0796637 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Wed, 4 Oct 2023 20:52:29 +0100 Subject: [PATCH 014/113] Remove superfluous argument --- bullseye/etc/entry.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 74a1fb0..51971a8 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -37,7 +37,6 @@ fi +game_mode "${CS2_GAMEMODE}" \ +mapgroup "${CS2_MAPGROUP}" \ +map "${CS2_STARTMAP}" \ - +sv_setsteamaccount \ +rcon_password "${CS2_RCONPW}" \ +sv_password "${CS2_PW}" \ "${CS2_ADDITIONAL_ARGS}" From d53950d303cb45ec2530e3e3aa5da2cf81566d24 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Thu, 5 Oct 2023 13:09:57 +0200 Subject: [PATCH 015/113] option for sv_lan --- README.md | 1 + bullseye/Dockerfile | 1 + bullseye/etc/entry.sh | 1 + bullseye/etc/server.cfg | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bb65ebd..dfeb804 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ STEAMPASS="changeme" (Password for Steam User.) STEAMGUARD="" (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.) CS2_SERVERNAME="changeme" (Set the visible name for your private server) CS2_PORT=27015 (CS2 server listen port tcp_udp) +CS2_LAN="0" (0 - LAN mode disabled, 1 - LAN Mode enabled) CS2_RCONPW="changeme" (RCON password) CS2_PW="changeme" (CS2 server password) CS2_MAXPLAYERS=10 (Max players) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index a62d68c..b8d2626 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -41,6 +41,7 @@ ENV CS2_SERVERNAME="cs2 private server" \ CS2_STARTMAP="de_inferno" \ CS2_GAMETYPE=0 \ CS2_GAMEMODE=0 \ + CS2_LAN=0 \ CS2_ADDITIONAL_ARGS="" # Set permissions on STEAMAPPDIR diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 51971a8..534a5c3 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -13,6 +13,7 @@ cp /etc/server.cfg "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg sed -i "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg sed -i "s/{{SERVER_PW}}/${CS2_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg sed -i "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg +sed -i "s/{{SERVER_LAN}}/${CS2_LAN}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg # Rewrite Config Files diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index 40ef404..460cedb 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -1,7 +1,7 @@ // Server Defaults hostname "{{SERVER_HOSTNAME}}" -sv_lan "0" +sv_lan "{{SERVER_LAN}" // Passwords From 1e21f1cc4e85aff422fff766376fbbfd5b2b999b Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 14:22:52 +0100 Subject: [PATCH 016/113] Correct server.cfg templating and Dockerfile whitespace --- bullseye/Dockerfile | 2 +- bullseye/etc/server.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index b8d2626..cca7443 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -41,7 +41,7 @@ ENV CS2_SERVERNAME="cs2 private server" \ CS2_STARTMAP="de_inferno" \ CS2_GAMETYPE=0 \ CS2_GAMEMODE=0 \ - CS2_LAN=0 \ + CS2_LAN=0 \ CS2_ADDITIONAL_ARGS="" # Set permissions on STEAMAPPDIR diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index 460cedb..8aa41f3 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -1,7 +1,7 @@ // Server Defaults hostname "{{SERVER_HOSTNAME}}" -sv_lan "{{SERVER_LAN}" +sv_lan {{SERVER_LAN}} // Passwords From 4ebfb7a4004f6fb650572f03f60978413573f006 Mon Sep 17 00:00:00 2001 From: Attila <1230402+borzaka@users.noreply.github.com> Date: Thu, 5 Oct 2023 19:52:52 +0200 Subject: [PATCH 017/113] Make competitive the default game mode As stated in the official docs: Default gamemode when starting the server is competitive. --- bullseye/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index cca7443..2354372 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -40,7 +40,7 @@ ENV CS2_SERVERNAME="cs2 private server" \ CS2_MAPGROUP="mg_active" \ CS2_STARTMAP="de_inferno" \ CS2_GAMETYPE=0 \ - CS2_GAMEMODE=0 \ + CS2_GAMEMODE=1 \ CS2_LAN=0 \ CS2_ADDITIONAL_ARGS="" From 2d800d2d647c558ac2b7c50ebd4862afc1db86f1 Mon Sep 17 00:00:00 2001 From: Attila <1230402+borzaka@users.noreply.github.com> Date: Thu, 5 Oct 2023 19:56:05 +0200 Subject: [PATCH 018/113] Make competitive the default game mode As stated in the official docs: Default gamemode when starting the server is competitive. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dfeb804..56e1230 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ CS2_RCONPW="changeme" (RCON password) CS2_PW="changeme" (CS2 server password) CS2_MAXPLAYERS=10 (Max players) CS2_GAMETYPE=0 (Game type, see https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) -CS2_GAMEMODE=0 (Game mode, see https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) +CS2_GAMEMODE=1 (Game mode, see https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) CS2_MAPGROUP="mg_active" (Map pool) CS2_STARTMAP="de_inferno" (Start map) CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) From f1af59c8e724107898e89638a6f4b34dc4515fd4 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 20:23:51 +0100 Subject: [PATCH 019/113] Create docker-publish.yml --- .github/workflows/docker-publish.yml | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..eb14eb3 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,66 @@ +name: Docker + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + schedule: + - cron: '21 5 * * 0' + push: + branches: [ "main" ] + # Publish semver tags as releases. + tags: [ 'v*.*.*' ] + pull_request: + branches: [ "main" ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: docker.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log in to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + file: .bullseye/Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From fd40c1756b82f7aa5e445d176283ad124847417e Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 20:24:29 +0100 Subject: [PATCH 020/113] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index eb14eb3..0f20db0 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,4 +1,4 @@ -name: Docker +name: Docker Publish # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by From 8bd96ee8c6b91680ea901e1aff3ae03cdfe47e6e Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 20:30:18 +0100 Subject: [PATCH 021/113] Update docker-publish.yml Fixed path to docker file in build job --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 0f20db0..4643689 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -60,7 +60,7 @@ jobs: uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 with: context: . - file: .bullseye/Dockerfile + file: ./bullseye/Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 933a575e5fef0e8e3b138aa146a61808311b269e Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 20:38:17 +0100 Subject: [PATCH 022/113] Update docker-publish.yml Updated docker build push context --- .github/workflows/docker-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 4643689..59a248f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -59,8 +59,8 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 with: - context: . - file: ./bullseye/Dockerfile + context: ./bullseye + file: ./Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From ec8d348f02f721b7e8f5049455c16852a49ba2a2 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 20:39:21 +0100 Subject: [PATCH 023/113] Update docker-publish.yml Updated path do docker file --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 59a248f..f34a5b3 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -60,7 +60,7 @@ jobs: uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 with: context: ./bullseye - file: ./Dockerfile + file: ./bullseye/Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From abb667b4db68225cb63e8bfc3490972fa76dc85a Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 20:42:37 +0100 Subject: [PATCH 024/113] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index f34a5b3..81f585a 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,4 +1,4 @@ -name: Docker Publish +name: Docker Build and Publish # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by From 02461cc7979ce7cfca03a611143f826291588f32 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 20:43:25 +0100 Subject: [PATCH 025/113] Added Docker Build and Publish badge to README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 56e1230..3264654 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Docker Image CI](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml/badge.svg?branch=main)](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml) +[![Docker Image CI](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml/badge.svg?branch=main)](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml) [![Docker Build and Publish](https://github.com/joedwards32/CS2/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/joedwards32/CS2/actions/workflows/docker-publish.yml) # What is Counter-Strike 2? For over two decades, Counter-Strike has offered an elite competitive experience, one shaped by millions of players from across the globe. And now the next chapter in the CS story is about to begin. This is Counter-Strike 2. From e4470d84181237d07f7c008bb69555070e8e8e9e Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 20:52:05 +0100 Subject: [PATCH 026/113] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 81f585a..2eb4b5c 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -51,6 +51,11 @@ jobs: - name: Extract Docker metadata id: meta uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 + tags: | + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} + # set version tag + type=semver,pattern={{version}} with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} From bf91b08f27d2ae470b23dc0a7944a7ee0ad4de28 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 20:53:05 +0100 Subject: [PATCH 027/113] Update docker-publish.yml Fix indentation --- .github/workflows/docker-publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 2eb4b5c..6e1dadf 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -52,10 +52,10 @@ jobs: id: meta uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 tags: | - # set latest tag for default branch - type=raw,value=latest,enable={{is_default_branch}} - # set version tag - type=semver,pattern={{version}} + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} + # set version tag + type=semver,pattern={{version}} with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} From 23762c2b1a0a22bd19a51c30aab3b0b400e82b40 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 20:56:55 +0100 Subject: [PATCH 028/113] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 6e1dadf..d6dac1a 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -51,11 +51,6 @@ jobs: - name: Extract Docker metadata id: meta uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 - tags: | - # set latest tag for default branch - type=raw,value=latest,enable={{is_default_branch}} - # set version tag - type=semver,pattern={{version}} with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} @@ -67,5 +62,9 @@ jobs: context: ./bullseye file: ./bullseye/Dockerfile push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} + tags: | + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} + # set version tag + type=semver,pattern={{version}} labels: ${{ steps.meta.outputs.labels }} From d26e4e8ede17c4e309ccaf9f6cb690cbb05e604d Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 20:57:44 +0100 Subject: [PATCH 029/113] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index d6dac1a..b2f3bfe 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -63,8 +63,6 @@ jobs: file: ./bullseye/Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: | - # set latest tag for default branch type=raw,value=latest,enable={{is_default_branch}} - # set version tag type=semver,pattern={{version}} labels: ${{ steps.meta.outputs.labels }} From 3c483ec15f3d94a97d3ec619fa65a87840080695 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 5 Oct 2023 21:01:53 +0100 Subject: [PATCH 030/113] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index b2f3bfe..0b4b673 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -53,6 +53,9 @@ jobs: uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern={{version}} # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action @@ -62,7 +65,5 @@ jobs: context: ./bullseye file: ./bullseye/Dockerfile push: ${{ github.event_name != 'pull_request' }} - tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=semver,pattern={{version}} + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 1508d10f647d749a3f2d913c911e9653ae379a5c Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 8 Oct 2023 17:40:33 +0100 Subject: [PATCH 031/113] Make use of sed DRY and tidy up cs2 execution for readability --- bullseye/etc/entry.sh | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 534a5c3..3cf8d0d 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -10,10 +10,10 @@ bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ # Install server.cfg cp /etc/server.cfg "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg -sed -i "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg -sed -i "s/{{SERVER_PW}}/${CS2_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg -sed -i "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg -sed -i "s/{{SERVER_LAN}}/${CS2_LAN}/g" "${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 # Rewrite Config Files @@ -27,17 +27,20 @@ if [[ ! -z $CS2_BOT_QUOTA_MODE ]] ; then sed -i "s/bot_quota_mode.*/bot_quota_mode ${CS2_BOT_QUOTA_MODE}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi +# Switch to server directory +cd "${STEAMAPPDIR}/game/bin/linuxsteamrt64" + # Start Server -"${STEAMAPPDIR}/game/bin/linuxsteamrt64/cs2" -dedicated \ - -port "${CS2_PORT}" \ - -console \ - -usercon \ - -maxplayers_override "${CS2_MAXPLAYERS}" \ - +game_type "${CS2_GAMETYPE}" \ - +game_mode "${CS2_GAMEMODE}" \ - +mapgroup "${CS2_MAPGROUP}" \ - +map "${CS2_STARTMAP}" \ - +rcon_password "${CS2_RCONPW}" \ - +sv_password "${CS2_PW}" \ - "${CS2_ADDITIONAL_ARGS}" +"./cs2" -dedicated \ + -port "${CS2_PORT}" \ + -console \ + -usercon \ + -maxplayers_override "${CS2_MAXPLAYERS}" \ + +game_type "${CS2_GAMETYPE}" \ + +game_mode "${CS2_GAMEMODE}" \ + +mapgroup "${CS2_MAPGROUP}" \ + +map "${CS2_STARTMAP}" \ + +rcon_password "${CS2_RCONPW}" \ + +sv_password "${CS2_PW}" \ + "${CS2_ADDITIONAL_ARGS}" From 26e45981a3ddf7f10e263e7521dfdcf3cc51ab98 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 8 Oct 2023 18:03:57 +0100 Subject: [PATCH 032/113] symlink steamclient.so to correct location --- bullseye/etc/entry.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 3cf8d0d..b17dc8e 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -8,6 +8,10 @@ bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ +app_update "${STEAMAPPID}" \ +quit +# steamclient.so fix +mkdir -p ~/.steam/sdk64 +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 \ From fc2c4be6594a343838b72289c8699d6f516fd1c1 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Wed, 11 Oct 2023 22:16:00 +0100 Subject: [PATCH 033/113] Add support for +game_alias, use this as the preferred game mode declaration when defined. Updated readme. --- README.md | 26 +++++++++++++++++++++++--- bullseye/Dockerfile | 1 + bullseye/etc/entry.sh | 15 ++++++++++++--- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3264654..8e3aff4 100644 --- a/README.md +++ b/README.md @@ -32,21 +32,41 @@ $ docker run -d --net=host -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ --name= # Configuration ## Environment Variables Feel free to overwrite these environment variables, using -e (--env): + +### SteamCMD + ```dockerfile STEAMUSER="changeme" (Steam User for SteamCMD.) STEAMPASS="changeme" (Password for Steam User.) STEAMGUARD="" (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.) +``` + +### Server Configuration + +```dockerfile CS2_SERVERNAME="changeme" (Set the visible name for your private server) CS2_PORT=27015 (CS2 server listen port tcp_udp) CS2_LAN="0" (0 - LAN mode disabled, 1 - LAN Mode enabled) CS2_RCONPW="changeme" (RCON password) CS2_PW="changeme" (CS2 server password) CS2_MAXPLAYERS=10 (Max players) -CS2_GAMETYPE=0 (Game type, see https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) -CS2_GAMEMODE=1 (Game mode, see https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) +CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) +``` + +### Game Modes + +```dockerfile +CS2_GAMEALIAS="" (Game type, e.g. casual, competitive, deathmatch. + See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) +CS2_GAMETYPE=0 (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) +CS2_GAMEMODE=1 (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) CS2_MAPGROUP="mg_active" (Map pool) CS2_STARTMAP="de_inferno" (Start map) -CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) +``` + +### Bots + +```dockerfile CS2_BOT_DIFFICULTY="" (0 - easy, 1 - normal, 2 - hard, 3 - expert) CS2_BOT_QUOTA="" (Number of bots) CS2_BOT_QUOTA_MODE="" (fill, competitive) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 2354372..470ca3b 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -39,6 +39,7 @@ ENV CS2_SERVERNAME="cs2 private server" \ CS2_PW="changeme" \ CS2_MAPGROUP="mg_active" \ CS2_STARTMAP="de_inferno" \ + CS2_GAMEALIAS="" \ CS2_GAMETYPE=0 \ CS2_GAMEMODE=1 \ CS2_LAN=0 \ diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index b17dc8e..f4c26b6 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -34,15 +34,24 @@ fi # Switch to server directory cd "${STEAMAPPDIR}/game/bin/linuxsteamrt64" +# Construct server arguments + +if [[ -z $CS2_GAMEALIAS ]]; then + # If CS2_GAMEALIAS is undefined then default to CS2_GAMETYPE and CS2_GAMEMODE + CS2_GAME_MODE_ARGS="+game_type ${CS2_GAMETYPE} +game_mode ${CS2_GAMEMODE}" +else + # Else, use alias to determine game mode + CS2_GAME_MODE_ARGS="+game_alias ${CS2_GAMEALIAS}" +fi + # Start Server -"./cs2" -dedicated \ +eval "./cs2" -dedicated \ -port "${CS2_PORT}" \ -console \ -usercon \ -maxplayers_override "${CS2_MAXPLAYERS}" \ - +game_type "${CS2_GAMETYPE}" \ - +game_mode "${CS2_GAMEMODE}" \ + "${CS2_GAME_MODE_ARGS}" \ +mapgroup "${CS2_MAPGROUP}" \ +map "${CS2_STARTMAP}" \ +rcon_password "${CS2_RCONPW}" \ From a5dab84d7319a0e40b0b6897b7d424a031d78935 Mon Sep 17 00:00:00 2001 From: galinette-34 <62066654+galinette-34@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:58:09 +0200 Subject: [PATCH 034/113] Update Dockerfile to set variable CS2_IP The variable CS2_IP will be used in entry.sh for cs2 parameter "-ip" to set the tcp listener to a specific ip address. default: 0.0.0.0 (listen to all IPs on the local machine) is probably the best. left blank: cs2 try to identify the current ip automatically --- bullseye/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 470ca3b..7de34a6 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -33,6 +33,7 @@ RUN set -x \ FROM build_stage AS bullseye-base ENV CS2_SERVERNAME="cs2 private server" \ + CS2_IP=0.0.0.0 \ CS2_PORT=27015 \ CS2_MAXPLAYERS=10 \ CS2_RCONPW="changeme" \ From 018d09ae971800408463f5b710b7a8f3254e5bac Mon Sep 17 00:00:00 2001 From: galinette-34 <62066654+galinette-34@users.noreply.github.com> Date: Thu, 12 Oct 2023 14:04:20 +0200 Subject: [PATCH 035/113] Update entry.sh use environment variable CS2_IP for cs2 parameter "-ip", to set tcp listener to a specific ip address. --- bullseye/etc/entry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index f4c26b6..837b234 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -47,7 +47,7 @@ fi # Start Server eval "./cs2" -dedicated \ - -port "${CS2_PORT}" \ + -ip "${CS2_IP}" -port "${CS2_PORT}" \ -console \ -usercon \ -maxplayers_override "${CS2_MAXPLAYERS}" \ From 1705aa342cb7d965714677ad397e068cc489fe57 Mon Sep 17 00:00:00 2001 From: galinette-34 <62066654+galinette-34@users.noreply.github.com> Date: Thu, 12 Oct 2023 14:11:20 +0200 Subject: [PATCH 036/113] Update README.md description for environment variable CS2_IP --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8e3aff4..93c9c96 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,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_PORT=27015 (CS2 server listen port tcp_udp) CS2_LAN="0" (0 - LAN mode disabled, 1 - LAN Mode enabled) CS2_RCONPW="changeme" (RCON password) From 3724d7ba24b7b49bd3bbf68a0c70bcacb325af7c Mon Sep 17 00:00:00 2001 From: bageshwar <2353296+bageshwar@users.noreply.github.com> Date: Sat, 14 Oct 2023 09:00:48 +0530 Subject: [PATCH 037/113] Update README.md Adding memory system requirements --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 93c9c96..7fab7a4 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,10 @@ $ docker run -d --net=host -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ --name= **The container will automatically update the game on startup, so if there is a game update just restart the container.** # Configuration + +## System Requirements +Please note that you need approximately 1.5g of free RAM. If this is not available, container will crash with err 137. + ## Environment Variables Feel free to overwrite these environment variables, using -e (--env): From fc59ea513a605fda9220c6de0119689b0160459d Mon Sep 17 00:00:00 2001 From: schadom <33547308+schadom@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:40:31 +0200 Subject: [PATCH 038/113] maxplayers_override is deprecated. Use the launch option -maxplayers instead. --- bullseye/etc/entry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 837b234..c347928 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -50,7 +50,7 @@ eval "./cs2" -dedicated \ -ip "${CS2_IP}" -port "${CS2_PORT}" \ -console \ -usercon \ - -maxplayers_override "${CS2_MAXPLAYERS}" \ + -maxplayers "${CS2_MAXPLAYERS}" \ "${CS2_GAME_MODE_ARGS}" \ +mapgroup "${CS2_MAPGROUP}" \ +map "${CS2_STARTMAP}" \ From b4aa0caaca5009991d29d401da90c9c92feff6d4 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Wed, 18 Oct 2023 13:36:44 +0100 Subject: [PATCH 039/113] Add support for RCON TCP proxy using simpleproxy. Useful for AWS Fargate in awsvpc networking mode. --- README.md | 2 ++ bullseye/Dockerfile | 10 +++++++++- bullseye/etc/entry.sh | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7fab7a4..d04be4b 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ STEAMGUARD="" (Optional, Steam Guard key if enabled. Use your most 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_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.) CS2_LAN="0" (0 - LAN mode disabled, 1 - LAN Mode enabled) CS2_RCONPW="changeme" (RCON password) CS2_PW="changeme" (CS2 server password) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 7de34a6..15e44f2 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -1,6 +1,9 @@ ########################################################### # Dockerfile that builds a CS2 Gameserver ########################################################### + +# BUILD STAGE + FROM cm2network/steamcmd:root as build_stage LABEL maintainer="joedwards32@gmail.com" @@ -23,18 +26,23 @@ RUN set -x \ wget \ ca-certificates \ lib32z1 \ + simpleproxy \ && mkdir -p "${STEAMAPPDIR}" \ # Add entry script && chmod +x "${HOMEDIR}/entry.sh" \ && chown -R "${USER}:${USER}" "${HOMEDIR}/entry.sh" "${STEAMAPPDIR}" \ # Clean up - && rm -rf /var/lib/apt/lists/* + && apt-get clean \ + && find /var/lib/apt/lists/ -type f -delete + +# BASE FROM build_stage AS bullseye-base ENV CS2_SERVERNAME="cs2 private server" \ CS2_IP=0.0.0.0 \ CS2_PORT=27015 \ + CS2_RCON_PORT="" \ CS2_MAXPLAYERS=10 \ CS2_RCONPW="changeme" \ CS2_PW="changeme" \ diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index c347928..09dbbc9 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -46,6 +46,11 @@ fi # Start Server +if [[ ! -z $CS2_RCON_PORT ]]; then + echo "Establishing Simpleproxy for ${CS2_RCON_PORT} to 127.0.0.1:${CS2_PORT}" + simpleproxy -L "${CS2_RCON_PORT}" -R 127.0.0.1:"${CS2_PORT}" & +fi + eval "./cs2" -dedicated \ -ip "${CS2_IP}" -port "${CS2_PORT}" \ -console \ From 309385913db4900b69113e1593e19a26e9274b99 Mon Sep 17 00:00:00 2001 From: loboda4450 Date: Sun, 22 Oct 2023 18:13:44 +0200 Subject: [PATCH 040/113] Added docker-compose.yml --- README.md | 9 ++++++++- bullseye/docker-compose.yml | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 bullseye/docker-compose.yml diff --git a/README.md b/README.md index d04be4b..3293646 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This Docker image contains the dedicated server of the game. # How to use this image ## Hosting a simple game server -Running on the *host* interface (recommended):
+Running on the *host* interface (recommended) using Docker:
```console $ docker run -d --net=host --name=cs2 -e STEAMUSER={YOUR_STEAM_USER} -e STEAMPASS={YOUR_STEAM_PASSWD} joedwards32/cs2 ``` @@ -23,6 +23,13 @@ $ chmod 777 $(pwd)/cs2-data # Makes sure the directory is writeable by the unpri $ docker run -d --net=host -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ --name=cs2-dedicated -e STEAMUSER={YOUR_STEAM_USER} -e STEAMPASS={YOUR_STEAM_PASSWD} joedwards32/cs2 ``` +or using docker-compose: +```console +$ docker-compose up -d +``` + +Remember about having at least **40GB** of free disk space! + `STEAMUSER` and `STEAMPASS` **are required as unlike CS:GO, CS2 can not be downloaded anonymously (at time of writing).** `STEAMGUARD` **must be used to provide your more recent Steam Guard key if Steam Guard is enabled on your account.** diff --git a/bullseye/docker-compose.yml b/bullseye/docker-compose.yml new file mode 100644 index 0000000..6054e78 --- /dev/null +++ b/bullseye/docker-compose.yml @@ -0,0 +1,37 @@ +version: '3.7' +services: + cs2-server: + image: joedwards32/cs2 + container_name: cs2-dedicated + environment: + # SteamCMD + - STEAMUSER="changeme" # (Steam User for SteamCMD.) + - STEAMPASS="changeme" # (Password for Steam User.) + - STEAMGUARD="" # (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.) + # Server configuration + - 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_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.) + - CS2_LAN="0" # (0 - LAN mode disabled, 1 - LAN Mode enabled) + - CS2_RCONPW="changeme" # (RCON password) + - CS2_PW="changeme" # (CS2 server password) + - CS2_MAXPLAYERS=10 # (Max players) + - CS2_ADDITIONAL_ARGS="" # (Optional additional arguments to pass into cs2) + # Game modes + - CS2_GAMEALIAS="" # (Game type, e.g. casual, competitive, deathmatch. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) + - CS2_GAMETYPE=0 # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) + - CS2_GAMEMODE=1 # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) + - CS2_MAPGROUP="mg_active" # (Map pool) + - CS2_STARTMAP="de_inferno" # (Start map) + # Bots + - CS2_BOT_DIFFICULTY="" # (0 - easy, 1 - normal, 2 - hard, 3 - expert) + - CS2_BOT_QUOTA="" # (Number of bots) + - CS2_BOT_QUOTA_MODE="" # (fill, competitive) + volumes: + - cs2:/home/steam/cs2-dedicated/ # (Change /mnt/cs2 according to your volume location) + ports: + - "27015:27015" # TCP + - "27015:27015/udp" # UDP +volumes: + cs2: From f4104eedab9fbeb1ebe85526b7f30591828c2be8 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Mon, 23 Oct 2023 13:25:58 +0100 Subject: [PATCH 041/113] Updated sample docker compose file and clarified readme --- README.md | 5 ++-- {bullseye => examples}/docker-compose.yml | 34 +++++++++++------------ 2 files changed, 20 insertions(+), 19 deletions(-) rename {bullseye => examples}/docker-compose.yml (56%) diff --git a/README.md b/README.md index 3293646..1abd23a 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,10 @@ $ chmod 777 $(pwd)/cs2-data # Makes sure the directory is writeable by the unpri $ docker run -d --net=host -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ --name=cs2-dedicated -e STEAMUSER={YOUR_STEAM_USER} -e STEAMPASS={YOUR_STEAM_PASSWD} joedwards32/cs2 ``` -or using docker-compose: +or using docker-compose, see [examples](https://github.com/joedwards32/CS2/blob/main/examples/docker-compose.yml): ```console -$ docker-compose up -d +# Remember to update passwords in your compose file +$ docker compose --file examples/docker-compose.yml up -d cs2-server ``` Remember about having at least **40GB** of free disk space! diff --git a/bullseye/docker-compose.yml b/examples/docker-compose.yml similarity index 56% rename from bullseye/docker-compose.yml rename to examples/docker-compose.yml index 6054e78..894e81b 100644 --- a/bullseye/docker-compose.yml +++ b/examples/docker-compose.yml @@ -5,33 +5,33 @@ services: container_name: cs2-dedicated environment: # SteamCMD - - STEAMUSER="changeme" # (Steam User for SteamCMD.) - - STEAMPASS="changeme" # (Password for Steam User.) - - STEAMGUARD="" # (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.) + - STEAMUSER=changeme # (Steam User for SteamCMD.) + - STEAMPASS=changeme # (Password for Steam User.) + - STEAMGUARD # (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.) # Server configuration - - CS2_SERVERNAME="changeme" # (Set the visible name for your private server) + - 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_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.) - - CS2_LAN="0" # (0 - LAN mode disabled, 1 - LAN Mode enabled) - - CS2_RCONPW="changeme" # (RCON password) - - CS2_PW="changeme" # (CS2 server password) + - 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.) + - CS2_LAN=0 # (0 - LAN mode disabled, 1 - LAN Mode enabled) + - CS2_RCONPW=changeme # (RCON password) + - CS2_PW=changeme # (CS2 server password) - CS2_MAXPLAYERS=10 # (Max players) - - CS2_ADDITIONAL_ARGS="" # (Optional additional arguments to pass into cs2) + - CS2_ADDITIONAL_ARGS # (Optional additional arguments to pass into cs2) # Game modes - - CS2_GAMEALIAS="" # (Game type, e.g. casual, competitive, deathmatch. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) + - CS2_GAMEALIAS # (Game type, e.g. casual, competitive, deathmatch. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) - CS2_GAMETYPE=0 # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) - CS2_GAMEMODE=1 # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) - - CS2_MAPGROUP="mg_active" # (Map pool) - - CS2_STARTMAP="de_inferno" # (Start map) + - CS2_MAPGROUP=mg_active # (Map pool) + - CS2_STARTMAP=de_inferno # (Start map) # Bots - - CS2_BOT_DIFFICULTY="" # (0 - easy, 1 - normal, 2 - hard, 3 - expert) - - CS2_BOT_QUOTA="" # (Number of bots) - - CS2_BOT_QUOTA_MODE="" # (fill, competitive) + - CS2_BOT_DIFFICULTY # (0 - easy, 1 - normal, 2 - hard, 3 - expert) + - CS2_BOT_QUOTA # (Number of bots) + - CS2_BOT_QUOTA_MODE # (fill, competitive) volumes: - cs2:/home/steam/cs2-dedicated/ # (Change /mnt/cs2 according to your volume location) ports: - - "27015:27015" # TCP - - "27015:27015/udp" # UDP + - "27015:27015/tcp" # TCP + - "27015:27015/udp" # UDP volumes: cs2: From 98ec3ea972cad52a49736d65f81e1d26f5fca263 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Mon, 23 Oct 2023 13:30:17 +0100 Subject: [PATCH 042/113] Updated readme to clarify system requirements --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1abd23a..4041126 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 ``` -Remember about having at least **40GB** of free disk space! +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).** @@ -40,7 +40,12 @@ Remember about having at least **40GB** of free disk space! # Configuration ## System Requirements -Please note that you need approximately 1.5g of free RAM. If this is not available, container will crash with err 137. + +Minimum system requirements are: + +* 2 CPUs +* 2GiB RAM +* 40GB of disk space for the container or mounted as a persistent volume on `/home/steam/cs2-dedicated/` ## Environment Variables Feel free to overwrite these environment variables, using -e (--env): From 6d67ed013bd2ef376f86ae1f7e3fb76edaee2348 Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Wed, 25 Oct 2023 16:19:30 +0200 Subject: [PATCH 043/113] add libicu-dev for CounterStrikeSharp --- bullseye/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 15e44f2..74464b5 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -27,6 +27,7 @@ RUN set -x \ ca-certificates \ lib32z1 \ simpleproxy \ + libicu-dev \ && mkdir -p "${STEAMAPPDIR}" \ # Add entry script && chmod +x "${HOMEDIR}/entry.sh" \ From 693f7340ce5bbffef88f4b4ae141855cecc412cb Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 26 Oct 2023 21:32:03 +0100 Subject: [PATCH 044/113] 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 045/113] 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 046/113] 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 047/113] 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 048/113] 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 049/113] 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 050/113] 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 051/113] 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 052/113] 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 053/113] 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 From a9f9ccbadbd8f05753b77714762c1b90a9cea81c Mon Sep 17 00:00:00 2001 From: John Edwards Date: Tue, 7 Nov 2023 11:59:58 +0000 Subject: [PATCH 054/113] Switch to anonymous logins --- README.md | 12 ------------ bullseye/Dockerfile | 3 --- bullseye/etc/entry.sh | 2 +- examples/docker-compose.yml | 4 ---- 4 files changed, 1 insertion(+), 20 deletions(-) diff --git a/README.md b/README.md index a03727c..b78e88d 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,6 @@ $ 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). -`STEAMUSER` and `STEAMPASS` **are required as unlike CS:GO, CS2 can not be downloaded anonymously (at time of writing).** - -`STEAMGUARD` **must be used to provide your more recent Steam Guard key if Steam Guard is enabled on your account.** - **The container will automatically update the game on startup, so if there is a game update just restart the container.** # Configuration @@ -50,14 +46,6 @@ Minimum system requirements are: ## Environment Variables Feel free to overwrite these environment variables, using -e (--env): -### SteamCMD - -```dockerfile -STEAMUSER="changeme" (Steam User for SteamCMD.) -STEAMPASS="changeme" (Password for Steam User.) -STEAMGUARD="" (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.) -``` - ### Server Configuration ```dockerfile diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 759d4f8..b2f9893 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -8,9 +8,6 @@ FROM cm2network/steamcmd:root as build_stage LABEL maintainer="joedwards32@gmail.com" -ENV STEAMUSER "changeme" -ENV STEAMPASS "changeme" -ENV STEAMGUARD "" ENV STEAMAPPID 730 ENV STEAMAPP cs2 ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated" diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index cae0ca0..047347e 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -6,7 +6,7 @@ mkdir -p "${STEAMAPPDIR}" || true # Download Updates bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ - +login "${STEAMUSER}" "${STEAMPASS}" "${STEAMGUARD}" \ + +login anonymous \ +app_update "${STEAMAPPID}" \ +quit diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 514d009..1e5cc0b 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -4,10 +4,6 @@ services: image: joedwards32/cs2 container_name: cs2-dedicated environment: - # SteamCMD - - STEAMUSER=changeme # (Steam User for SteamCMD.) - - STEAMPASS=changeme # (Password for Steam User.) - - STEAMGUARD # (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.) # Server configuration - 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) From 3a0dab324407880adc95ad83f312cf6855a080b7 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Tue, 7 Nov 2023 12:08:31 +0000 Subject: [PATCH 055/113] Updated documentation to recomment published ports and remove references to SteamCMD authentication --- README.md | 4 ++-- examples/docker-compose.yml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b78e88d..5335d01 100644 --- a/README.md +++ b/README.md @@ -13,14 +13,14 @@ This Docker image contains the dedicated server of the game. Running on the *host* interface (recommended) using Docker:
```console -$ docker run -d --net=host --name=cs2 -e STEAMUSER={YOUR_STEAM_USER} -e STEAMPASS={YOUR_STEAM_PASSWD} joedwards32/cs2 +$ docker run -d --name=cs2 -p 27015:27015 -p 27020:27020 joedwards32/cs2 ``` Running using a bind mount for data persistence on container recreation: ```console $ mkdir -p $(pwd)/cs2-data $ chmod 777 $(pwd)/cs2-data # Makes sure the directory is writeable by the unprivileged container user -$ docker run -d --net=host -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ --name=cs2-dedicated -e STEAMUSER={YOUR_STEAM_USER} -e STEAMPASS={YOUR_STEAM_PASSWD} joedwards32/cs2 +$ docker run -d --name=cs2 -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ -p 27015:27015 -p 27020:27020 joedwards32/cs2 ``` or using docker-compose, see [examples](https://github.com/joedwards32/CS2/blob/main/examples/docker-compose.yml): diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 1e5cc0b..ab177af 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -6,7 +6,6 @@ services: environment: # Server configuration - 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_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.) - CS2_LAN=0 # (0 - LAN mode disabled, 1 - LAN Mode enabled) From 01bbc5c0f705f2827573f919fe8875cc0645559b Mon Sep 17 00:00:00 2001 From: John Edwards Date: Tue, 7 Nov 2023 12:10:44 +0000 Subject: [PATCH 056/113] Remove reference to host interfaces --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5335d01..35251a8 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This Docker image contains the dedicated server of the game. # How to use this image ## Hosting a simple game server -Running on the *host* interface (recommended) using Docker:
+Running using Docker: ```console $ docker run -d --name=cs2 -p 27015:27015 -p 27020:27020 joedwards32/cs2 ``` From cd946660f85ea9c53c05c79fb9abe9434bb23d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Carlos=20Fraqueiro=20da=20Palma?= Date: Tue, 28 Nov 2023 11:18:48 +0000 Subject: [PATCH 057/113] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 35251a8..ea06869 100644 --- a/README.md +++ b/README.md @@ -13,14 +13,14 @@ This Docker image contains the dedicated server of the game. Running using Docker: ```console -$ docker run -d --name=cs2 -p 27015:27015 -p 27020:27020 joedwards32/cs2 +$ docker run -d --name=cs2 -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/tcp joedwards32/cs2 ``` Running using a bind mount for data persistence on container recreation: ```console $ mkdir -p $(pwd)/cs2-data $ chmod 777 $(pwd)/cs2-data # Makes sure the directory is writeable by the unprivileged container user -$ docker run -d --name=cs2 -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ -p 27015:27015 -p 27020:27020 joedwards32/cs2 +$ docker run -d --name=cs2 -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/tcp joedwards32/cs2 ``` or using docker-compose, see [examples](https://github.com/joedwards32/CS2/blob/main/examples/docker-compose.yml): @@ -61,6 +61,8 @@ CS2_MAXPLAYERS=10 (Max players) CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) ``` +**Note:** When using `CS2_RCON_PORT` don't forget to map the port chosen with TCP protocol (e.g., add `-p 27050:27050/tcp` on the `docker run` command or add the port to the `docker-compose.yml` file). + ### Game Modes ```dockerfile From da6155afc59327bd026f9b059e089763081fc73c Mon Sep 17 00:00:00 2001 From: John Edwards Date: Wed, 29 Nov 2023 22:16:49 +0000 Subject: [PATCH 058/113] Add support for Game Login Tokens from https://steamcommunity.com/dev/managegameservers --- README.md | 7 ++++--- bullseye/Dockerfile | 1 + bullseye/etc/entry.sh | 5 +++++ examples/docker-compose.yml | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ea06869..e6d2f57 100644 --- a/README.md +++ b/README.md @@ -13,19 +13,19 @@ This Docker image contains the dedicated server of the game. Running using Docker: ```console -$ docker run -d --name=cs2 -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/tcp joedwards32/cs2 +$ docker run -d --name=cs2 -e SRCDS_TOKEN={YOURTOKEN} -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/tcp joedwards32/cs2 ``` Running using a bind mount for data persistence on container recreation: ```console $ mkdir -p $(pwd)/cs2-data $ chmod 777 $(pwd)/cs2-data # Makes sure the directory is writeable by the unprivileged container user -$ docker run -d --name=cs2 -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/tcp joedwards32/cs2 +$ docker run -d --name=cs2 -e SRCDS_TOKEN={YOURTOKEN} -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/tcp joedwards32/cs2 ``` or using docker-compose, see [examples](https://github.com/joedwards32/CS2/blob/main/examples/docker-compose.yml): ```console -# Remember to update passwords in your compose file +# Remember to update passwords and SRCDS_TOKEN in your compose file $ docker compose --file examples/docker-compose.yml up -d cs2-server ``` @@ -49,6 +49,7 @@ Feel free to overwrite these environment variables, using -e (--env): ### Server Configuration ```dockerfile +SRCDS_TOKEN="" Game Server Token from https://steamcommunity.com/dev/managegameservers CS2_SERVERNAME="changeme" (Set the visible name for your private server) 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) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index f612cf3..fae045c 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -59,6 +59,7 @@ ENV CS2_SERVERNAME="cs2 private server" \ TV_RELAY_PW="changeme" \ TV_MAXRATE=0 \ TV_DELAY=0 \ + SRCDS_TOKEN="" \ CS2_ADDITIONAL_ARGS="" # Set permissions on STEAMAPPDIR diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 047347e..016ea52 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -70,6 +70,10 @@ else CS2_IP_ARGS="-ip ${CS2_IP}" fi +if [[ ! -z $SRCDS_TOKEN ]]; then + SV_SETSTEAMACCOUNT_ARGS="+sv_setsteamaccount ${SRCDS_TOKEN}" +fi + # Start Server if [[ ! -z $CS2_RCON_PORT ]]; then @@ -86,6 +90,7 @@ eval "./cs2" -dedicated \ +mapgroup "${CS2_MAPGROUP}" \ +map "${CS2_STARTMAP}" \ +rcon_password "${CS2_RCONPW}" \ + "${SV_SETSTEAMACCOUNT_ARGS}" \ +sv_password "${CS2_PW}" \ +sv_lan "${CS2_LAN}" \ "${CS2_ADDITIONAL_ARGS}" diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index ab177af..e875e6c 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -5,6 +5,7 @@ services: container_name: cs2-dedicated environment: # Server configuration + - SRCDS_TOKEN # Game Server Token from https://steamcommunity.com/dev/managegameservers - CS2_SERVERNAME=changeme # (Set the visible name for your private server) - 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.) From de9dc02dbd216cdde13dd4ac04e5faeed0694ad9 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sat, 11 Nov 2023 09:07:37 +0000 Subject: [PATCH 059/113] Experimental support for downloading configuration tgz --- bullseye/Dockerfile | 2 +- bullseye/etc/entry.sh | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index fae045c..35c4455 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -11,7 +11,6 @@ LABEL maintainer="joedwards32@gmail.com" ENV STEAMAPPID 730 ENV STEAMAPP cs2 ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated" -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" @@ -60,6 +59,7 @@ ENV CS2_SERVERNAME="cs2 private server" \ TV_MAXRATE=0 \ TV_DELAY=0 \ SRCDS_TOKEN="" \ + CS2_CFG_URL="" \ CS2_ADDITIONAL_ARGS="" # Set permissions on STEAMAPPDIR diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 016ea52..741dda1 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -16,6 +16,22 @@ ln -sfT ${STEAMCMDDIR}/linux64/steamclient.so ~/.steam/sdk64/steamclient.so # Install server.cfg cp /etc/server.cfg "${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 + +# Download and extract custom config bundle +if [[ ! -z $CS2_CFG_URL ]]; then + wget -qO- "${CS2_CFG_URL}" | tar xvzf - -C "${STEAMAPPDIR}" +fi + +# Rewrite Config Files + sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \ -e "s/{{SERVER_PW}}/${CS2_PW}/g" \ -e "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" \ @@ -28,16 +44,6 @@ 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 sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi From 7c4a4cf8348a0fbcaeecb367d91fbea1ee786f5e Mon Sep 17 00:00:00 2001 From: John Edwards Date: Wed, 6 Dec 2023 22:40:09 +0000 Subject: [PATCH 060/113] Add support for fetching a bundle of customisations from a URL --- README.md | 25 ++++++++++++++++++++++++- bullseye/etc/entry.sh | 4 +++- examples/cs2.cfg.tgz | Bin 0 -> 618 bytes 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 examples/cs2.cfg.tgz diff --git a/README.md b/README.md index e6d2f57..8b475b3 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Feel free to overwrite these environment variables, using -e (--env): ### Server Configuration ```dockerfile -SRCDS_TOKEN="" Game Server Token from https://steamcommunity.com/dev/managegameservers +SRCDS_TOKEN="" (Game Server Token from https://steamcommunity.com/dev/managegameservers) CS2_SERVERNAME="changeme" (Set the visible name for your private server) 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) @@ -106,6 +106,29 @@ The container includes two scripts for executing custom actions: When using a persient volume mounted at `/home/steam/cs2-dedicated/` you may edit these scripts to perform custom actions, such as enabling metamod. +## Overriding Game Mode Defaults + +The default configurations for each game mode are stored in `/home/steam/cs2-dedicated/csgo/cfg/`. For example, the Competitive mode defaults are set by `gamemode_competitive.cfg`. + +When using a persistent volume mounted at `/home/steam/cs2-dedicated/`, these defaults can be overridden by adding your own settings to `gamemode_competitive_server.cfg`. + +``` +// Game Mode Competitive Server Overrides + +mp_maxrounds 16 // Shorter games +``` + +## Customisation Bundle + +The container can be instructed to download a extract a Tar Gzip of configuration files and other customisations from a given URL. + +```dockerfile +CS2_CFG_URL="" (HTTP/HTTPS URL to fetch a Tar Gzip bundle of configuration files/mods) +``` + +See [examples](https://github.com/joedwards32/CS2/blob/main/examples/cs2.cfg.tgz) for a correctly formatted Tar Gzip customisation bundle. + + # 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/etc/entry.sh b/bullseye/etc/entry.sh index 741dda1..d4c977a 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -17,7 +17,7 @@ ln -sfT ${STEAMCMDDIR}/linux64/steamclient.so ~/.steam/sdk64/steamclient.so # Install server.cfg cp /etc/server.cfg "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg -# Install hooks +# Install hooks if they don't already exist if [[ ! -f "${STEAMAPPDIR}/pre.sh" ]] ; then cp /etc/pre.sh "${STEAMAPPDIR}/pre.sh" fi @@ -27,6 +27,7 @@ fi # Download and extract custom config bundle if [[ ! -z $CS2_CFG_URL ]]; then + echo "Downloading config pack from ${CS2_CFG_URL}" wget -qO- "${CS2_CFG_URL}" | tar xvzf - -C "${STEAMAPPDIR}" fi @@ -87,6 +88,7 @@ if [[ ! -z $CS2_RCON_PORT ]]; then simpleproxy -L "${CS2_RCON_PORT}" -R 127.0.0.1:"${CS2_PORT}" & fi +echo "Starting CS2 Dedicated Server" eval "./cs2" -dedicated \ "${CS2_IP_ARGS}" -port "${CS2_PORT}" \ -console \ diff --git a/examples/cs2.cfg.tgz b/examples/cs2.cfg.tgz new file mode 100644 index 0000000000000000000000000000000000000000..7807d7f2c84a75ebd3521c40bd5cf7b41c10d875 GIT binary patch literal 618 zcmV-w0+szAiwFScsc&Tf1MQhxZ<{a}hI3n_{D*Jt^@0x=l1Y^|P17n(Rib705e;5o z6*w}a%68R1z55y3l!LS;sbW@!pNklCkWD_`_r=M~-(GP);L=|CF&}6FA>?@s23|qg zq8*L{*kOb)N+_d%F!cx-z*f(6>TJ@?muf0MM3_8x-oE1xcLGmsN5ErPMZqOTV?53$ zjxDukQ{VHi=V;JJu6kSZ7(4yntL^u{et+1tsHCZX;JD z_{U(vtn5aa)CP_O^2_G?fq0=`&^c+ImYi|+U$ zh0N56`JacVT`@&Kh=3$|0|<#^Y=f;{QuJqhphjI2XPj~{1Us9 z37t5IqLJ%*%A<|kyN*89m+V{rJ?4K!|5Wu}S^od0`oDN%-$aRhhP-iAWlzJo-F^|>*Gj#0^f$u$|l z3-VvB08IY3fyw`VqfhlEd-ET=&HN`WGWp*I&HVrR>8SXZ+@!z3U@&x&KUQ2OVE`@w E06x`G)Bpeg literal 0 HcmV?d00001 From 401520b57a045a5749ec5ab3c5bf2b94d85b67a1 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 7 Dec 2023 17:02:56 +0000 Subject: [PATCH 061/113] Updated example config pack --- examples/cs2.cfg.tgz | Bin 618 -> 649 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/cs2.cfg.tgz b/examples/cs2.cfg.tgz index 7807d7f2c84a75ebd3521c40bd5cf7b41c10d875..2f418d4603dde63f82597fdaf5a430e0bf21dd7c 100644 GIT binary patch literal 649 zcmV;40(Si$iwFRh`f+6d1MQhzZ`v>vhPhoN{=->&J@7{o!=y@^rfHR?3RHHFQsR=V z3Pw(-Sg-o0cRxFn2GGPug;OEUa}g)O!VV|z`^KRk&97w?OWhtvnQS%OWR|2o?i9kCrPU9;|I<#Xa zPCavGwtnWl=ZLt&s=n=bjHUjc&Hk6Czh9Rvso2y%@o57B$MY&VbN!d~@4tq?C?Bh% zk8!yF`(Y5E|JMQf|9MmD->TkW2)x1nh49h;>!7OtN(kJKk2=Pl{?E-*Kc~#rKkz9> z|E~k||MRBOzfrxT4A|5ESM+ZV82W!5tk=K4_BJR}u^f(6HkCzMq>pl#OZ_Ny>(G3# z^$)iBzd5ia_qi|+0U;2^g7hHI`qs&r?JeT={3D< zI?STERmZd->(0SQH1vS&&U6N>fx~b54&C7^$91fFch2xsM=GBtD)kpGO~``=o?{6BBpslH-o{?l+X j|5->d|Lb5g|8Kt^6#rUc`XdN}oFxAMFju3L04@Lkvs+zx literal 618 zcmV-w0+szAiwFScsc&Tf1MQhxZ<{a}hI3n_{D*Jt^@0x=l1Y^|P17n(Rib705e;5o z6*w}a%68R1z55y3l!LS;sbW@!pNklCkWD_`_r=M~-(GP);L=|CF&}6FA>?@s23|qg zq8*L{*kOb)N+_d%F!cx-z*f(6>TJ@?muf0MM3_8x-oE1xcLGmsN5ErPMZqOTV?53$ zjxDukQ{VHi=V;JJu6kSZ7(4yntL^u{et+1tsHCZX;JD z_{U(vtn5aa)CP_O^2_G?fq0=`&^c+ImYi|+U$ zh0N56`JacVT`@&Kh=3$|0|<#^Y=f;{QuJqhphjI2XPj~{1Us9 z37t5IqLJ%*%A<|kyN*89m+V{rJ?4K!|5Wu}S^od0`oDN%-$aRhhP-iAWlzJo-F^|>*Gj#0^f$u$|l z3-VvB08IY3fyw`VqfhlEd-ET=&HN`WGWp*I&HVrR>8SXZ+@!z3U@&x&KUQ2OVE`@w E06x`G)Bpeg From 7b6509614344a6aaed43102e25f295056338536f Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 17 Dec 2023 16:39:54 +0000 Subject: [PATCH 062/113] Disable server hibernation by default as this has been observed to cause server crashes --- README.md | 3 +++ bullseye/Dockerfile | 1 + bullseye/etc/entry.sh | 1 + bullseye/etc/server.cfg | 53 +++++++++++++++++++------------------ examples/docker-compose.yml | 1 + 5 files changed, 33 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 8b475b3..27015e2 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,9 @@ Feel free to overwrite these environment variables, using -e (--env): ```dockerfile SRCDS_TOKEN="" (Game Server Token from https://steamcommunity.com/dev/managegameservers) CS2_SERVERNAME="changeme" (Set the visible name for your private server) +CS2_SERVER_HIBERNATE=0 (Put server in a low CPU state when there are no players. + 0 - hibernation disabled, 1 - hibernation enabled + n.b. hibernation has been observed to trigger server crashes) 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. diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 35c4455..3ab56e6 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -40,6 +40,7 @@ FROM build_stage AS bullseye-base ENV CS2_SERVERNAME="cs2 private server" \ CS2_IP=0.0.0.0 \ + CS2_SERVER_HIBERNATE=0 \ CS2_PORT=27015 \ CS2_RCON_PORT="" \ CS2_MAXPLAYERS=10 \ diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index d4c977a..1e5637a 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -34,6 +34,7 @@ fi # Rewrite Config Files sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \ + -e "s/{{SERVER_HIBERNATE}}/${CS2_SERVER_HIBERNATE}/g" \ -e "s/{{SERVER_PW}}/${CS2_PW}/g" \ -e "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" \ -e "s/{{TV_ENABLE}}/${TV_ENABLE}/g" \ diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index 007e8a4..4be30ca 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -1,35 +1,36 @@ // Server Defaults -hostname "{{SERVER_HOSTNAME}}" // Set server hostname +hostname "{{SERVER_HOSTNAME}}" // Set server hostname +sv_hibernate_when_empty {{SERVER_HIBERNATE}} // Disable server hibernation // Passwords -rcon_password "{{SERVER_RCON_PW}}" // Set rcon password -sv_password "{{SERVER_PW}}" // Set server password +rcon_password "{{SERVER_RCON_PW}}" // Set rcon password +sv_password "{{SERVER_PW}}" // Set server password // CSTV -sv_hibernate_postgame_delay 180 // Delay server hibernation after all clients disconnect +sv_hibernate_postgame_delay 30 // 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 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 // CSTV debug info. -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 -tv_enable {{TV_ENABLE}} // Activates CSTV on server: 0=off, 1=on. -tv_maxclients 10 // Maximum client number on CSTV server. -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_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) +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 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 // CSTV debug info. +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 +tv_enable {{TV_ENABLE}} // Activates CSTV on server: 0=off, 1=on. +tv_maxclients 10 // Maximum client number on CSTV server. +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_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 e875e6c..77aa585 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -8,6 +8,7 @@ services: - SRCDS_TOKEN # Game Server Token from https://steamcommunity.com/dev/managegameservers - CS2_SERVERNAME=changeme # (Set the visible name for your private server) - CS2_PORT=27015 # (CS2 server listen port tcp_udp) + - CS2_SERVER_HIBERNATE=0 # (Put server in a low CPU state when there are no players. 0 - hibernation disabled, 1 - hibernation enabled) - 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.) - CS2_LAN=0 # (0 - LAN mode disabled, 1 - LAN Mode enabled) - CS2_RCONPW=changeme # (RCON password) From e5a69f276ad2f3725164b7a97c6d9966e7ca23f8 Mon Sep 17 00:00:00 2001 From: astra Date: Wed, 27 Dec 2023 19:24:58 +0000 Subject: [PATCH 063/113] add files --- LICENSE | 21 ++++++++++ README.md | 86 ++++++++++++++++++++++++++++++++++++++ bullseye/.dockerignore | 1 + bullseye/Dockerfile | 83 +++++++++++++++++++++++++++++++++++++ bullseye/etc/entry.sh | 92 +++++++++++++++++++++++++++++++++++++++++ bullseye/etc/post.sh | 5 +++ bullseye/etc/pre.sh | 5 +++ bullseye/etc/server.cfg | 36 ++++++++++++++++ bullseye/hooks/build | 5 +++ bullseye/hooks/push | 2 + 10 files changed, 336 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 bullseye/.dockerignore create mode 100644 bullseye/Dockerfile create mode 100755 bullseye/etc/entry.sh create mode 100644 bullseye/etc/post.sh create mode 100644 bullseye/etc/pre.sh create mode 100644 bullseye/etc/server.cfg create mode 100644 bullseye/hooks/build create mode 100644 bullseye/hooks/push diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a581133 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 John Edwards + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..2091e39 --- /dev/null +++ b/README.md @@ -0,0 +1,86 @@ +# What is Counter-Strike 2? +For over two decades, Counter-Strike has offered an elite competitive experience, one shaped by millions of players from across the globe. And now the next chapter in the CS story is about to begin. This is [Counter-Strike 2](https://store.steampowered.com/app/730/CounterStrike_2/). +This Docker image contains the dedicated server of the game. + +logo + +# How to use this image +## Hosting a simple game server + +Running on the *host* interface (recommended):
+```console +$ docker run -d --net=host --name=cs2 -e STEAMUSER={YOUR_STEAM_USER} -e STEAMPASS={YOUR_STEAM_PASSWD} git.zio.sh/astra/cs2:latest +``` + +Running using a bind mount for data persistence on container recreation: +```console +$ mkdir -p $(pwd)/cs2-data +$ chmod 777 $(pwd)/cs2-data # Makes sure the directory is writeable by the unprivileged container user +$ docker run -d \ + --net=host \ + -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ \ + --name=cs2-dedicated \ + -e STEAMUSER= \ + -e STEAMPASS= \ + git.zio.sh/astra/cs2:latest +``` + +`STEAMUSER` and `STEAMPASS` **are required as unlike CS:GO, CS2 can not be downloaded anonymously (at time of writing).** + +`STEAMGUARD` **must be used to provide your more recent Steam Guard key if Steam Guard is enabled on your account.** + +**The container will automatically update the game on startup, so if there is a game update just restart the container.** + +# Configuration + +## System Requirements +Please note that you need approximately 1.5g of free RAM. If this is not available, container will crash with err 137. + +## Environment Variables +Feel free to overwrite these environment variables, using -e (--env) or --env-file (recommended): + +### SteamCMD + +```dockerfile +STEAMUSER="changeme" (Steam User for SteamCMD.) +STEAMPASS="changeme" (Password for Steam User.) +STEAMGUARD="" (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.) +``` + +### Server Configuration + +```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_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.) +CS2_LAN="0" (0 - LAN mode disabled, 1 - LAN Mode enabled) +CS2_RCONPW="changeme" (RCON password) +CS2_PW="changeme" (CS2 server password) +CS2_MAXPLAYERS=10 (Max players) +CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) +``` + +### Game Modes + +```dockerfile +CS2_GAMEALIAS="" (Game type, e.g. casual, competitive, deathmatch. + See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) +CS2_GAMETYPE=0 (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) +CS2_GAMEMODE=1 (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) +CS2_MAPGROUP="mg_active" (Map pool) +CS2_STARTMAP="de_inferno" (Start map) +``` + +### Bots + +```dockerfile +CS2_BOT_DIFFICULTY="" (0 - easy, 1 - normal, 2 - hard, 3 - expert) +CS2_BOT_QUOTA="" (Number of bots) +CS2_BOT_QUOTA_MODE="" (fill, competitive) +``` + +# 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/.dockerignore b/bullseye/.dockerignore new file mode 100644 index 0000000..c0362b8 --- /dev/null +++ b/bullseye/.dockerignore @@ -0,0 +1 @@ +hooks/ diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile new file mode 100644 index 0000000..b541ae3 --- /dev/null +++ b/bullseye/Dockerfile @@ -0,0 +1,83 @@ +########################################################### +# Dockerfile that builds a CS2 Gameserver +########################################################### + +# BUILD STAGE + +FROM cm2network/steamcmd:root as build_stage + +LABEL maintainer="astra@zio.sh" + +ENV STEAMAPPID 730 +ENV STEAMAPP cs2 +ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated" + +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 + && dpkg --add-architecture i386 \ + && apt-get update \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + libcurl4:i386 \ + wget \ + ca-certificates \ + lib32z1 \ + simpleproxy \ + libicu-dev \ + && mkdir -p "${STEAMAPPDIR}" \ + # Add entry script + && chmod +x "${HOMEDIR}/entry.sh" \ + && chown -R "${USER}:${USER}" "${HOMEDIR}/entry.sh" "${STEAMAPPDIR}" \ + # Clean up + && apt-get clean \ + && find /var/lib/apt/lists/ -type f -delete + +# BASE + +FROM build_stage AS bullseye-base + +ENV CS2_SERVERNAME="cs2 private server" \ + CS2_IP=0.0.0.0 \ + CS2_PORT=27015 \ + CS2_SERVER_HIBERNATE=0 \ + CS2_RCON_PORT="" \ + CS2_MAXPLAYERS=10 \ + CS2_RCONPW="changeme" \ + CS2_PW="changeme" \ + CS2_MAPGROUP="mg_active" \ + CS2_STARTMAP="de_inferno" \ + CS2_GAMEALIAS="" \ + CS2_GAMETYPE=0 \ + CS2_GAMEMODE=1 \ + CS2_LAN=0 \ + TV_AUTORECORD=0 \ + TV_ENABLE=0 \ + TV_PW="changeme" \ + TV_PORT=27020 \ + TV_RELAY_PW="changeme" \ + TV_MAXRATE=0 \ + TV_DELAY=0 \ + SRCDS_TOKEN="" \ + CS2_ADDITIONAL_ARGS="" + +# Set permissions on STEAMAPPDIR +# Permissions may need to be reset if persistent volume mounted +RUN set -x \ + && chown -R "${USER}:${USER}" "${STEAMAPPDIR}" \ + && chmod 0777 "${STEAMAPPDIR}" + +# Switch to user +USER ${USER} + +WORKDIR ${HOMEDIR} + +CMD ["bash", "entry.sh"] + +# Expose ports +EXPOSE 27015/tcp \ + 27015/udp \ + 27020/udp diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh new file mode 100755 index 0000000..9f00e2a --- /dev/null +++ b/bullseye/etc/entry.sh @@ -0,0 +1,92 @@ +#!/bin/bash +mkdir -p "${STEAMAPPDIR}" || true + +# Download Updates +bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ + +login anonymous \ + +app_update "${STEAMAPPID}" \ + +quit + +# steamclient.so fix +mkdir -p ~/.steam/sdk64 +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/hostname.*/hostname ${CS2_SERVERNAME}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/sv_password.*/sv_password ${CS2_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/rcon_password.*/rcon_password ${CS2_RCONPW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_enable./tv_enable.*/tv_enable ${TV_ENABLE}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_enable./tv_port.*/tv_port ${TV_PORT}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_enable./tv_autorecord.*/tv_autorecord ${TV_AUTORECORD}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_enable./tv_enable.*/tv_enable ${TV_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_enable./tv_relay_pw.*/tv_relay_pw ${TV_RELAY_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_enable./tv_maxrate.*/tv_maxrate ${TV_MAXRATE}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_enable./tv_delay.*/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 + sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/* +fi +if [[ ! -z $CS2_BOT_QUOTA ]] ; then + sed -i "s/bot_quota.*/bot_quota ${CS2_BOT_QUOTA}/" "${STEAMAPPDIR}"/game/csgo/cfg/* +fi +if [[ ! -z $CS2_BOT_QUOTA_MODE ]] ; then + sed -i "s/bot_quota_mode.*/bot_quota_mode ${CS2_BOT_QUOTA_MODE}/" "${STEAMAPPDIR}"/game/csgo/cfg/* +fi + +# Switch to server directory +cd "${STEAMAPPDIR}/game/bin/linuxsteamrt64" + +# Pre Hook +bash "${STEAMAPPDIR}/pre.sh" + +# Construct server arguments +if [[ -z $CS2_GAMEALIAS ]]; then + # If CS2_GAMEALIAS is undefined then default to CS2_GAMETYPE and CS2_GAMEMODE + CS2_GAME_MODE_ARGS="+game_type ${CS2_GAMETYPE} +game_mode ${CS2_GAMEMODE}" +else + # Else, use alias to determine game mode + 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 + +if [[ ! -z $SRCDS_TOKEN ]]; then + SV_SETSTEAMACCOUNT_ARGS="+sv_setsteamaccount ${SRCDS_TOKEN}" +fi + +# Start Server +if [[ ! -z $CS2_RCON_PORT ]]; then + echo "Establishing Simpleproxy for ${CS2_RCON_PORT} to 127.0.0.1:${CS2_PORT}" + simpleproxy -L "${CS2_RCON_PORT}" -R 127.0.0.1:"${CS2_PORT}" & +fi + +eval "./cs2" -dedicated \ + "${CS2_IP_ARGS}" -port "${CS2_PORT}" \ + -console \ + -usercon \ + -maxplayers "${CS2_MAXPLAYERS}" \ + "${CS2_GAME_MODE_ARGS}" \ + +mapgroup "${CS2_MAPGROUP}" \ + +map "${CS2_STARTMAP}" \ + +rcon_password "${CS2_RCONPW}" \ + "${SV_SETSTEAMACCOUNT_ARGS}" \ + +sv_password "${CS2_PW}" \ + +sv_lan "${CS2_LAN}" \ + "${CS2_ADDITIONAL_ARGS}" + +# Post Hook +bash "${STEAMAPPDIR}/post.sh" \ No newline at end of file diff --git a/bullseye/etc/post.sh b/bullseye/etc/post.sh new file mode 100644 index 0000000..8001ece --- /dev/null +++ b/bullseye/etc/post.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# POST HOOK +# Make your customisation here +echo "post-hook: noop" \ No newline at end of file diff --git a/bullseye/etc/pre.sh b/bullseye/etc/pre.sh new file mode 100644 index 0000000..6312b07 --- /dev/null +++ b/bullseye/etc/pre.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# PRE HOOK +# Make your customisation here +echo "pre-hook: noop" \ No newline at end of file diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg new file mode 100644 index 0000000..24e1ece --- /dev/null +++ b/bullseye/etc/server.cfg @@ -0,0 +1,36 @@ +// Server Defaults + +hostname "changeme" // Set server hostname +sv_hibernate_when_empty 0 // Disable server hibernation + +// Passwords + +rcon_password "changeme" // Set rcon password +sv_password "changeme" // Set server password + +// CSTV + +sv_hibernate_postgame_delay 30 // 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 0 // 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 // 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 0 // 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 "changeme" // CSTV host name +tv_overridemaster 0 // Overrides the CSTV master root address. +tv_port 0 // Host SourceTV port +tv_password "changeme" // CSTV password for clients +tv_relaypassword "changeme" // CSTV password for relay proxies +tv_relayvoice 1 // Relay voice data: 0=off, 1=on +tv_timeout 60 // CSTV connection timeout in seconds. +tv_title "changeme" // Set title for CSTV spectator UI +tv_transmitall 1 // Transmit all entities (not only director view) \ No newline at end of file diff --git a/bullseye/hooks/build b/bullseye/hooks/build new file mode 100644 index 0000000..cfffa83 --- /dev/null +++ b/bullseye/hooks/build @@ -0,0 +1,5 @@ +#!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +docker build --target=bullseye-base -t $DOCKER_REPO:latest -t $DOCKER_REPO:base ${SCRIPT_DIR}/.. diff --git a/bullseye/hooks/push b/bullseye/hooks/push new file mode 100644 index 0000000..93a8d0d --- /dev/null +++ b/bullseye/hooks/push @@ -0,0 +1,2 @@ +#!/bin/bash +docker push --all-tags ${DOCKER_REPO} From e328b3f6a6e3bb618a48d14380835d01c18e2091 Mon Sep 17 00:00:00 2001 From: astra Date: Wed, 27 Dec 2023 19:34:30 +0000 Subject: [PATCH 064/113] Update files --- .gitignore | 1 + bullseye/Dockerfile | 1 + bullseye/etc/entry.sh | 1 + 3 files changed, 3 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..80cf615 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.cs2.env diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index b541ae3..b2dc9d7 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -32,6 +32,7 @@ RUN set -x \ # Add entry script && chmod +x "${HOMEDIR}/entry.sh" \ && chown -R "${USER}:${USER}" "${HOMEDIR}/entry.sh" "${STEAMAPPDIR}" \ + && chmod -R +x /etc/post /etc/pre \ # Clean up && apt-get clean \ && find /var/lib/apt/lists/ -type f -delete diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 9f00e2a..7032349 100755 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -28,6 +28,7 @@ sed -i -e "s/hostname.*/hostname ${CS2_SERVERNAME}/g" "${STEAMAPPDIR}"/game/csgo 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 From 36e3415dde1a666e7f6bad3b2b0719e63dde697f Mon Sep 17 00:00:00 2001 From: astra Date: Wed, 27 Dec 2023 19:37:53 +0000 Subject: [PATCH 065/113] Fix --- bullseye/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index b2dc9d7..3c011be 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -32,7 +32,7 @@ RUN set -x \ # Add entry script && chmod +x "${HOMEDIR}/entry.sh" \ && chown -R "${USER}:${USER}" "${HOMEDIR}/entry.sh" "${STEAMAPPDIR}" \ - && chmod -R +x /etc/post /etc/pre \ + && chmod +x /etc/post.sh /etc/pre.sh \ # Clean up && apt-get clean \ && find /var/lib/apt/lists/ -type f -delete From b96f26f30a0cbb58bc7a121104fb30d9e035a49a Mon Sep 17 00:00:00 2001 From: astra Date: Wed, 27 Dec 2023 20:01:59 +0000 Subject: [PATCH 066/113] Fix sed --- bullseye/etc/entry.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 7032349..85b7b40 100755 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -16,13 +16,13 @@ cp /etc/server.cfg "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg sed -i -e "s/hostname.*/hostname ${CS2_SERVERNAME}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ -e "s/sv_password.*/sv_password ${CS2_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ -e "s/rcon_password.*/rcon_password ${CS2_RCONPW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_enable./tv_enable.*/tv_enable ${TV_ENABLE}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_enable./tv_port.*/tv_port ${TV_PORT}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_enable./tv_autorecord.*/tv_autorecord ${TV_AUTORECORD}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_enable./tv_enable.*/tv_enable ${TV_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_enable./tv_relay_pw.*/tv_relay_pw ${TV_RELAY_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_enable./tv_maxrate.*/tv_maxrate ${TV_MAXRATE}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_enable./tv_delay.*/tv_delay ${TV_DELAY}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg + -e "s/tv_enable./tv_enable ${TV_ENABLE}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_port.*/tv_port ${TV_PORT}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_autorecord.*/tv_autorecord ${TV_AUTORECORD}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_enable.*/tv_enable ${TV_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_relay_pw.*/tv_relay_pw ${TV_RELAY_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_maxrate.*/tv_maxrate ${TV_MAXRATE}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ + -e "s/tv_delay.*/tv_delay ${TV_DELAY}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg # Install hooks if [[ ! -f "${STEAMAPPDIR}/pre.sh" ]] ; then From 376c6454235dcab9eb4bfac010aa015bc5d12327 Mon Sep 17 00:00:00 2001 From: astra Date: Wed, 27 Dec 2023 21:05:20 +0000 Subject: [PATCH 067/113] Add unzip for plugins --- bullseye/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 3c011be..1ff715d 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -28,6 +28,7 @@ RUN set -x \ lib32z1 \ simpleproxy \ libicu-dev \ + unzip \ && mkdir -p "${STEAMAPPDIR}" \ # Add entry script && chmod +x "${HOMEDIR}/entry.sh" \ From af5c45a01e72856252f0453f0cb58a6092383798 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 31 Dec 2023 16:43:39 +0000 Subject: [PATCH 068/113] Add support for enabling/disabling cheats --- 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 8b475b3..765e286 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ Feel free to overwrite these environment variables, using -e (--env): ```dockerfile SRCDS_TOKEN="" (Game Server Token from https://steamcommunity.com/dev/managegameservers) CS2_SERVERNAME="changeme" (Set the visible name for your private server) +CS2_CHEATS=0 (0 - disable cheats, 1 - enable cheats) 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. diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 35c4455..056566c 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -39,6 +39,7 @@ RUN set -x \ FROM build_stage AS bullseye-base ENV CS2_SERVERNAME="cs2 private server" \ + CS2_CHEATS=0 \ CS2_IP=0.0.0.0 \ CS2_PORT=27015 \ CS2_RCON_PORT="" \ diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index d4c977a..2aa09b0 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -34,6 +34,7 @@ fi # Rewrite Config Files sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \ + -e "s/{{SERVER_CHEATS}}/${CS2_CHEATS}/g" \ -e "s/{{SERVER_PW}}/${CS2_PW}/g" \ -e "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" \ -e "s/{{TV_ENABLE}}/${TV_ENABLE}/g" \ diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index 007e8a4..0636e75 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -1,6 +1,7 @@ // Server Defaults hostname "{{SERVER_HOSTNAME}}" // Set server hostname +sv_cheats {{SERVER_CHEATS}} // Enable or disable cheats // Passwords diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index e875e6c..1952dce 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -7,6 +7,7 @@ services: # Server configuration - SRCDS_TOKEN # Game Server Token from https://steamcommunity.com/dev/managegameservers - CS2_SERVERNAME=changeme # (Set the visible name for your private server) + - CS2_CHEATS=0 # (0 - disable cheats, 1 - enable cheats) - 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.) - CS2_LAN=0 # (0 - LAN mode disabled, 1 - LAN Mode enabled) From bab03fcca480d5aef1c862144a31b25549da1722 Mon Sep 17 00:00:00 2001 From: astra Date: Mon, 8 Jan 2024 23:05:33 +0000 Subject: [PATCH 069/113] Add support for sv_cheats, fix sed --- bullseye/Dockerfile | 1 + bullseye/etc/entry.sh | 22 ++++++++++++---------- bullseye/etc/server.cfg | 1 + 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 1ff715d..3887d51 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -48,6 +48,7 @@ ENV CS2_SERVERNAME="cs2 private server" \ CS2_SERVER_HIBERNATE=0 \ CS2_RCON_PORT="" \ CS2_MAXPLAYERS=10 \ + CS2_CHEATS=0 \ CS2_RCONPW="changeme" \ CS2_PW="changeme" \ CS2_MAPGROUP="mg_active" \ diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 85b7b40..9504421 100755 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -13,16 +13,18 @@ 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/hostname.*/hostname ${CS2_SERVERNAME}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/sv_password.*/sv_password ${CS2_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/rcon_password.*/rcon_password ${CS2_RCONPW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_enable./tv_enable ${TV_ENABLE}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_port.*/tv_port ${TV_PORT}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_autorecord.*/tv_autorecord ${TV_AUTORECORD}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_enable.*/tv_enable ${TV_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_relay_pw.*/tv_relay_pw ${TV_RELAY_PW}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_maxrate.*/tv_maxrate ${TV_MAXRATE}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg \ - -e "s/tv_delay.*/tv_delay ${TV_DELAY}/g" "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg +sed -i -e "s/hostname.*/hostname ${CS2_SERVERNAME}/g" \ + -e "s/sv_cheats.*/sv_cheats ${CS2_CHEATS}/g" \ + -e "s/sv_password.*/sv_password ${CS2_PW}/g" \ + -e "s/rcon_password.*/rcon_password ${CS2_RCONPW}/g" \ + -e "s/tv_enable./tv_enable ${TV_ENABLE}/g" \ + -e "s/tv_port.*/tv_port ${TV_PORT}/g" \ + -e "s/tv_autorecord.*/tv_autorecord ${TV_AUTORECORD}/g" \ + -e "s/tv_enable.*/tv_enable ${TV_PW}/g" \ + -e "s/tv_relay_pw.*/tv_relay_pw ${TV_RELAY_PW}/g" \ + -e "s/tv_maxrate.*/tv_maxrate ${TV_MAXRATE}/g" \ + -e "s/tv_delay.*/tv_delay ${TV_DELAY}/g" \ + "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg # Install hooks if [[ ! -f "${STEAMAPPDIR}/pre.sh" ]] ; then diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index 24e1ece..f3468d3 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -1,6 +1,7 @@ // Server Defaults hostname "changeme" // Set server hostname +sv_cheats 0 // Enable or disable cheats sv_hibernate_when_empty 0 // Disable server hibernation // Passwords From 02217e54d81906b3839cee9f02e0aa1fb5f727d8 Mon Sep 17 00:00:00 2001 From: astra Date: Mon, 8 Jan 2024 23:33:04 +0000 Subject: [PATCH 070/113] Newline --- bullseye/etc/server.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index f3468d3..a52cf05 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -34,4 +34,4 @@ tv_relaypassword "changeme" // CSTV password for relay proxies tv_relayvoice 1 // Relay voice data: 0=off, 1=on tv_timeout 60 // CSTV connection timeout in seconds. tv_title "changeme" // Set title for CSTV spectator UI -tv_transmitall 1 // Transmit all entities (not only director view) \ No newline at end of file +tv_transmitall 1 // Transmit all entities (not only director view) From 23a8b46500acbfd73209f40efd934fa57a4128b4 Mon Sep 17 00:00:00 2001 From: astra Date: Mon, 8 Jan 2024 23:33:11 +0000 Subject: [PATCH 071/113] Fix sed --- bullseye/etc/entry.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 9504421..0524989 100755 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -13,17 +13,20 @@ 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/hostname.*/hostname ${CS2_SERVERNAME}/g" \ - -e "s/sv_cheats.*/sv_cheats ${CS2_CHEATS}/g" \ - -e "s/sv_password.*/sv_password ${CS2_PW}/g" \ - -e "s/rcon_password.*/rcon_password ${CS2_RCONPW}/g" \ - -e "s/tv_enable./tv_enable ${TV_ENABLE}/g" \ - -e "s/tv_port.*/tv_port ${TV_PORT}/g" \ - -e "s/tv_autorecord.*/tv_autorecord ${TV_AUTORECORD}/g" \ - -e "s/tv_enable.*/tv_enable ${TV_PW}/g" \ - -e "s/tv_relay_pw.*/tv_relay_pw ${TV_RELAY_PW}/g" \ - -e "s/tv_maxrate.*/tv_maxrate ${TV_MAXRATE}/g" \ - -e "s/tv_delay.*/tv_delay ${TV_DELAY}/g" \ +sed -r -i -e "s/^(hostname) .*/\1 ${CS2_SERVERNAME}/g" \ + -e "s/^(sv_cheats) .*/\1 ${CS2_CHEATS}/g" \ + -e "s/^(sv_hibernate_when_empty) .*/\1 ${CS2_SERVER_HIBERNATE}/g" \ + -e "s/^(sv_password) .*/\1 ${CS2_PW}/g" \ + -e "s/^(rcon_password) .*/\1 ${CS2_RCONPW}/g" \ + -e "s/^(tv_enable) .*/\1 ${TV_ENABLE}/g" \ + -e "s/^(tv_port) .*/\1 ${TV_PORT}/g" \ + -e "s/^(tv_autorecord) .*/\1 ${TV_AUTORECORD}/g" \ + -e "s/^(tv_password) .*/\1 ${TV_PW}/g" \ + -e "s/^(tv_relaypassword) .*/\1 ${TV_RELAY_PW}/g" \ + -e "s/^(tv_maxrate) .*/\1 ${TV_MAXRATE}/g" \ + -e "s/^(tv_delay) .*/\1 ${TV_DELAY}/g" \ + -e "s/^(tv_name) .*/\1 ${CS2_SERVERNAME} CSTV/g" \ + -e "s/^(tv_title) .*/\1${CS2_SERVERNAME} CSTV/g" \ "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg # Install hooks From 070b5d3f867ed4a5a11fd05e9fbd8b1785550f2f Mon Sep 17 00:00:00 2001 From: John Edwards Date: Fri, 9 Feb 2024 10:49:21 +0000 Subject: [PATCH 072/113] Example for a shorter competitive config bundle --- examples/cs2.cfg.tgz | Bin 649 -> 481 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/cs2.cfg.tgz b/examples/cs2.cfg.tgz index 2f418d4603dde63f82597fdaf5a430e0bf21dd7c..98b93f169e2ee9f6122ea72534113cd99c344ba8 100644 GIT binary patch literal 481 zcmV<70UrJziwFP!000001MQYgPuoBchJCH2{D&!=8++GYr|PLyg{Xw0Ai_N|_7J;h zz1FUSfK&f;?~E6P08&Y*>J-#@4(qQO&)V<2UN3WvQ7|kqF`1~~2kn2p`T1qNjW+}$ zRZ^-%CMpSHA(RvWsDbC@S-CE^0Ks=tHP6LuyZ%O5_WBoYX$EY9m+LQ6m9qZ3V55I= zz8t6repCNUq~!cGCjAo`C#?T2c&vYaq)my7!sr&ex~ng7;m}^99nvhPhoN{=->&J@7{o!=y@^rfHR?3RHHFQsR=V z3Pw(-Sg-o0cRxFn2GGPug;OEUa}g)O!VV|z`^KRk&97w?OWhtvnQS%OWR|2o?i9kCrPU9;|I<#Xa zPCavGwtnWl=ZLt&s=n=bjHUjc&Hk6Czh9Rvso2y%@o57B$MY&VbN!d~@4tq?C?Bh% zk8!yF`(Y5E|JMQf|9MmD->TkW2)x1nh49h;>!7OtN(kJKk2=Pl{?E-*Kc~#rKkz9> z|E~k||MRBOzfrxT4A|5ESM+ZV82W!5tk=K4_BJR}u^f(6HkCzMq>pl#OZ_Ny>(G3# z^$)iBzd5ia_qi|+0U;2^g7hHI`qs&r?JeT={3D< zI?STERmZd->(0SQH1vS&&U6N>fx~b54&C7^$91fFch2xsM=GBtD)kpGO~``=o?{6BBpslH-o{?l+X j|5->d|Lb5g|8Kt^6#rUc`XdN}oFxAMFju3L04@Lkvs+zx From 1f65440cb487285a0aa4763e30e0a9d3a262f1cd Mon Sep 17 00:00:00 2001 From: John Edwards Date: Fri, 9 Feb 2024 10:56:54 +0000 Subject: [PATCH 073/113] Example for a shorter competitive config bundle, with long warmup --- examples/cs2.cfg.tgz | Bin 481 -> 520 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/cs2.cfg.tgz b/examples/cs2.cfg.tgz index 98b93f169e2ee9f6122ea72534113cd99c344ba8..5ecc3678bcb647a1419ec8861cf7c57f3ffd8719 100644 GIT binary patch literal 520 zcmV+j0{8tNiwFP!000001MQYgZ__{!hJD3S{=?8-A>Q?8#R-HENGJ+wxJRx%iA}X$ zYu7HcC;l{d#*PxxN;GX%hmX#4SbxpzZ2Zpa%{o=+IpZRTB#E5wbpHD4$D8d@3^+23 zd_M~OAPO8IW#mf-qLJ6t)7mCA0L~X(RJXT94QS_t)PKqmcDK1cUzB zYCTd9+)@8nhQbd*LHY;2h*|$ba9#iIO6eSznN~G6Wm8_@(xSOQGo|MbtkLTq{a*ht z2?zay#1TGSB@T#3`<1uw#P#<)cu%6kj8uoWgX*y8RfjnZrp(d8#GSaRUaIt)(QTDm z*dkA!(MS_53T+z7>AJ}F!7GD!MKe-?ZLok%@G0hPhB<6Ppo{5KIyoApE4PH6rvJ`i1k1-*hz)C(xB zZ4q{9ORREeG|*w<{%P$VgIe2WYKu{8?EC&pf4BeBcOvfgf7$`q|A*lCxp!7p-dSo3 z*FA<$^TlWQFrR;Iw=p=weoAIO^KxWuf)?E2y-tkNyi! zJSA#_W7~hf|7Co`|1zP!f$aYSaMS;%@9t%PgY15WVHk#C7=~dOhG7_nVHk$_>-Y(= K6)j%?C;$LWISmT{ literal 481 zcmV<70UrJziwFP!000001MQYgPuoBchJCH2{D&!=8++GYr|PLyg{Xw0Ai_N|_7J;h zz1FUSfK&f;?~E6P08&Y*>J-#@4(qQO&)V<2UN3WvQ7|kqF`1~~2kn2p`T1qNjW+}$ zRZ^-%CMpSHA(RvWsDbC@S-CE^0Ks=tHP6LuyZ%O5_WBoYX$EY9m+LQ6m9qZ3V55I= zz8t6repCNUq~!cGCjAo`C#?T2c&vYaq)my7!sr&ex~ng7;m}^99n Date: Fri, 9 Feb 2024 10:59:51 +0000 Subject: [PATCH 074/113] Add unip package to support CounterStrikeSharp --- bullseye/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 22efd4e..e0e3e81 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -26,6 +26,7 @@ RUN set -x \ lib32z1 \ simpleproxy \ libicu-dev \ + unzip \ && mkdir -p "${STEAMAPPDIR}" \ # Add entry script && chmod +x "${HOMEDIR}/entry.sh" \ From a79c311953d414e90a5cf524fd4521db789af0a9 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 15 Feb 2024 11:44:36 +0000 Subject: [PATCH 075/113] Revised MR9 example config --- examples/cs2.cfg.tgz | Bin 520 -> 979 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/cs2.cfg.tgz b/examples/cs2.cfg.tgz index 5ecc3678bcb647a1419ec8861cf7c57f3ffd8719..5d969da7e523aabf8ccca36d372f81780a09b79d 100644 GIT binary patch literal 979 zcmV;^11$U>iwFP&`ORej1MOK&Z`(!?)wKfrAErrqtHkBE9Uwr9B4~oZv0(@3k)X+u z$cp3&yGz^3DSx{6&Qc$gWY@L~Q-z^@2a)3L%noPvy&jQ;NfZT;7pz-auUYdlf^ z1KVSc>oKao@3GM6|2|;!|FF^WpIF~f4|t;fukoLnL16TMAK0w_`Npq7B~LL*csWIt ztNa=xiQ*c?aM%8z>+e6L|6$P7-*rRJW7Pj0H*^D||NFpG^xp}fRC$RX?2v^gCsZVN z=s2F|o6hj+vC03JWPOVz|9|xE)qgwm?(m;6;y-(_yLztH+N#54 zQ*}6_50R%R;i!Mqr`eYo7m5b-R*^^javGKKt>AT)N?5`^{t33RZ3?FsCyn_?Abv-! zFDr9)$6A|TU|J`b!rTC~MdP4ZeBB=Gq3hk_z=krfz+oUU;S}$tb(C@13S)exb&8`} z;tp#!+59UOWj$?N-882gc_970$Cb;pFA01EbDLiwm$F7!If<}JL2;nNmg^`kifCHI zGZd0YUR9VVN@>8>Q@n7iJp`+Ofmbv#*8*A(Ms-mvZsH?N;N=WPTx@R-8qJiN%J-Ia z#ogg}Y{f$5NrBSJ_{|{YCFExrlKmU8S zXP*D|0rUQU*yxV+EgpOSw;i^{f0w?Q=f8d6?a$U#URhVvxcdFKaDI0A4L+TneW7zW zjVA~*Y9o+PmUx-VSmnHe3q*K6wun=hHVvD_$Aa`oF-Agy0$d-?7dA zzk7k{|A&q4Sl{B&{%;4{{oe_g>Hqt{cK^TlxKsNVXu7|Ffq}uR#J_Q?8#R-HENGJ+wxJRx%iA}X$ zYu7HcC;l{d#*PxxN;GX%hmX#4SbxpzZ2Zpa%{o=+IpZRTB#E5wbpHD4$D8d@3^+23 zd_M~OAPO8IW#mf-qLJ6t)7mCA0L~X(RJXT94QS_t)PKqmcDK1cUzB zYCTd9+)@8nhQbd*LHY;2h*|$ba9#iIO6eSznN~G6Wm8_@(xSOQGo|MbtkLTq{a*ht z2?zay#1TGSB@T#3`<1uw#P#<)cu%6kj8uoWgX*y8RfjnZrp(d8#GSaRUaIt)(QTDm z*dkA!(MS_53T+z7>AJ}F!7GD!MKe-?ZLok%@G0hPhB<6Ppo{5KIyoApE4PH6rvJ`i1k1-*hz)C(xB zZ4q{9ORREeG|*w<{%P$VgIe2WYKu{8?EC&pf4BeBcOvfgf7$`q|A*lCxp!7p-dSo3 z*FA<$^TlWQFrR;Iw=p=weoAIO^KxWuf)?E2y-tkNyi! zJSA#_W7~hf|7Co`|1zP!f$aYSaMS;%@9t%PgY15WVHk#C7=~dOhG7_nVHk$_>-Y(= K6)j%?C;$LWISmT{ From cde46e3e838cc5830c5ee612a6d45336375f3fe3 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Fri, 16 Feb 2024 12:53:09 +0000 Subject: [PATCH 076/113] Revert to normal competitive round time --- examples/cs2.cfg.tgz | Bin 979 -> 984 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/cs2.cfg.tgz b/examples/cs2.cfg.tgz index 5d969da7e523aabf8ccca36d372f81780a09b79d..786f6aee1035c123c2242f88eef2f83799c96da2 100644 GIT binary patch literal 984 zcmV;}11J0+iwFRsTF+$w1MOK&Z`(!?)wKfrAErrrtHkBE93Vi7AV`Y9wP6S7k)X+u z$cW?$+@)>hlt0~jXQ>ZLv|w9?slw2{gGiA(v%{HvZ3U%e5`rwSk$oZ&^LK>n5CSR6>R&h4P&z#Y5vByT5o6SRY>r%n?k| z_`S(S=12u@_UTHsedYg-QKLI3)*BtqvEu(vI{)zF-#=GJ)}YOQ=9oQjJC3Wyk@LT< z|HZlqL}J2Ue2)F~-|<{m>;EC3_5Zk0^Ix&P!zS;ECp)PJK1j3+NT#}oD6 zGaY8x4x{?J4)eAC9|Btcj~fmDiS-@zfG6tz2LGuUcv}Atf$jQVZ2cOP^B9AO=QEV4 zOm8p{Sl(bc+_yid`nwP5KYda4w`tdJIVR95@YVaD*8lGD6#ch+$Yq-2d(&qlHu6us z(;+iG&$V=Gc%7&Mr@D^Kpsz z1C_q4&DlL`Wqyfq6=4hu15g$!B63krzv%(Yq3!H&VM3l3U@;IFaf-NYA0(WX!vvpg zALF)WF2`nr^2~?G^%4Fkyn_)-u6=6;X*H6?5%RS->?fD*BvLCe$q& zGNsH9aj35S<}!BDk3x|w(;H0FEW?;ef%!ZbhmoZ0EEcHcs#z@ecfdPYhM-0+ye|{_ zjaOws2`ngZaieO+Z-W~ycLlA$mVy7xfkvr-X|2f(C%gFH?D%H1^oJtpKx6j!{g)br zr}qDj>FE96A)w#?j~m^wzQJSf|E9%S{I}_w-v1o}Z+|te)55r>meudSg^Tm6Z}8>( z{41TqSvWHdERwEO?%r@h*LiMso1XlQ7>O8f_w%8>p5 GFaQA2!u`Sk literal 979 zcmV;^11$U>iwFP&`ORej1MOK&Z`(!?)wKfrAErrqtHkBE9Uwr9B4~oZv0(@3k)X+u z$cp3&yGz^3DSx{6&Qc$gWY@L~Q-z^@2a)3L%noPvy&jQ;NfZT;7pz-auUYdlf^ z1KVSc>oKao@3GM6|2|;!|FF^WpIF~f4|t;fukoLnL16TMAK0w_`Npq7B~LL*csWIt ztNa=xiQ*c?aM%8z>+e6L|6$P7-*rRJW7Pj0H*^D||NFpG^xp}fRC$RX?2v^gCsZVN z=s2F|o6hj+vC03JWPOVz|9|xE)qgwm?(m;6;y-(_yLztH+N#54 zQ*}6_50R%R;i!Mqr`eYo7m5b-R*^^javGKKt>AT)N?5`^{t33RZ3?FsCyn_?Abv-! zFDr9)$6A|TU|J`b!rTC~MdP4ZeBB=Gq3hk_z=krfz+oUU;S}$tb(C@13S)exb&8`} z;tp#!+59UOWj$?N-882gc_970$Cb;pFA01EbDLiwm$F7!If<}JL2;nNmg^`kifCHI zGZd0YUR9VVN@>8>Q@n7iJp`+Ofmbv#*8*A(Ms-mvZsH?N;N=WPTx@R-8qJiN%J-Ia z#ogg}Y{f$5NrBSJ_{|{YCFExrlKmU8S zXP*D|0rUQU*yxV+EgpOSw;i^{f0w?Q=f8d6?a$U#URhVvxcdFKaDI0A4L+TneW7zW zjVA~*Y9o+PmUx-VSmnHe3q*K6wun=hHVvD_$Aa`oF-Agy0$d-?7dA zzk7k{|A&q4Sl{B&{%;4{{oe_g>Hqt{cK^TlxKsNVXu7|Ffq}uR#J_ Date: Wed, 21 Feb 2024 17:33:22 +0000 Subject: [PATCH 077/113] Add support for control over logging configuration --- README.md | 9 +++++++++ bullseye/Dockerfile | 4 ++++ bullseye/etc/entry.sh | 4 ++++ bullseye/etc/server.cfg | 7 +++++++ examples/docker-compose.yml | 8 +++++++- 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8db7350..a3571b5 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,15 @@ TV_MAXRATE=0 (Max CSTV spectator bandwidth rate allowed, 0 == unl TV_DELAY=0 (CSTV broadcast delay in seconds) ``` +### Logs + +```dockerfile +CS2_LOG="on" ('on'/'off') +CS2_LOG_MONEY=0 (Turns money logging on/off: 0=off, 1=on) +CS2_LOG_DETAIL=0 (Combat damage logging: 0=disabled, 1=enemy, 2=friendly, 3=all) +CS2_LOG_ITEMS=0 (Turns item logging on/off: 0=off, 1=on) +``` + # Customizing this Container ## Pre and Post Hooks diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 22efd4e..842017f 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -62,6 +62,10 @@ ENV CS2_SERVERNAME="cs2 private server" \ TV_DELAY=0 \ SRCDS_TOKEN="" \ CS2_CFG_URL="" \ + CS2_LOG="on" \ + CS2_LOG_MONEY=0 \ + CS2_LOG_DETAIL=0 \ + CS2_LOG_ITEMS=0 \ CS2_ADDITIONAL_ARGS="" # Set permissions on STEAMAPPDIR diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index f343196..fc1a21d 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -45,6 +45,10 @@ sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \ -e "s/{{TV_RELAY_PW}}/${TV_RELAY_PW}/g" \ -e "s/{{TV_MAXRATE}}/${TV_MAXRATE}/g" \ -e "s/{{TV_DELAY}}/${TV_DELAY}/g" \ + -e "s/{{SERVER_LOG}}/${CS2_LOG}/g" \ + -e "s/{{SERVER_LOG_MONEY}}/${CS2_LOG_MONEY}/g" \ + -e "s/{{SERVER_LOG_DETAIL}}/${CS2_LOG_DETAIL}/g" \ + -e "s/{{SERVER_LOG_ITEMS}}/${CS2_LOG_ITEMS}/g" \ "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then diff --git a/bullseye/etc/server.cfg b/bullseye/etc/server.cfg index 41ab3ec..dbc4d85 100644 --- a/bullseye/etc/server.cfg +++ b/bullseye/etc/server.cfg @@ -35,3 +35,10 @@ tv_relayvoice 1 // Relay voice data: 0=off, 1=on 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) + +// Logs + +log {{SERVER_LOG}} // Turns logging 'on' or 'off', defaults to 'on' +mp_logmoney {{SERVER_LOG_MONEY}} // Turns money logging on/off: 0=off, 1=on +mp_logdetail {{SERVER_LOG_DETAIL}} // Combat damage logging: 0=disabled, 1=enemy, 2=friendly, 3=all +mp_logdetail_items {{SERVER_LOG_ITEMS}} // Turns item logging on/off: 0=off, 1=on diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index d2496be..269f5a7 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -16,6 +16,7 @@ services: - CS2_PW=changeme # (CS2 server password) - CS2_MAXPLAYERS=10 # (Max players) - CS2_ADDITIONAL_ARGS # (Optional additional arguments to pass into cs2) + - CS2_CFG_URL # HTTP/HTTPS URL to fetch a Tar Gzip bundle of configuration files/mods # Game modes - CS2_GAMEALIAS # (Game type, e.g. casual, competitive, deathmatch. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) - CS2_GAMETYPE=0 # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) @@ -34,8 +35,13 @@ services: - TV_RELAY_PW=changeme # CSTV password for relay proxies - TV_MAXRATE=0 # World snapshots to broadcast per second. Affects camera tickrate. - TV_DELAY=0 # Max CSTV spectator bandwidth rate allowed, 0 == unlimited + # Logs + - CS2_LOG=on # 'on'/'off' + - CS2_LOG_MONEY=0 # Turns money logging on/off: (0=off, 1=on) + - CS2_LOG_DETAIL=0 # Combat damage logging: (0=disabled, 1=enemy, 2=friendly, 3=all) + - CS2_LOG_ITEMS=0 # Turns item logging on/off: (0=off, 1=on) volumes: - - cs2:/home/steam/cs2-dedicated/ # (Change /mnt/cs2 according to your volume location) + - cs2:/home/steam/cs2-dedicated/ # Persistent data volume mount point inside container ports: - "27015:27015/tcp" # TCP - "27015:27015/udp" # UDP From 95e67634911415f92a62dedc1e70820812529e50 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Wed, 21 Feb 2024 21:49:34 +0000 Subject: [PATCH 078/113] Updated config bundle with a gamemodes_server example --- examples/cs2.cfg.tgz | Bin 984 -> 1149 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/cs2.cfg.tgz b/examples/cs2.cfg.tgz index 786f6aee1035c123c2242f88eef2f83799c96da2..4c8dc0f7b050cfc4ded2b15ad69cbf5fd0105c66 100644 GIT binary patch literal 1149 zcmV-@1cLh?iwFRXZ`Nf11MOK$Z{s!)&b0#aAEw^+R@)@?@-DDIi(;``EYbwY0zC?f zG`7`Pq9IC2yhVWh)4g{nKV&Oz5~q=i!2AxDL=K1J8GbVqbr#-!!Z60XKMGSkY6Xlj z-*@52uTWpv5{?7hafNVgVY@akZu>$U!EHO{Y@$>}n3E}g%5nCP+++Roe*&xPD*+$C zD2d;5HsAwoIJc;!+-&*3Z8T^Pn)Usb=UDRp8{Pl>_3vMnS5~9Rf9CKba9g&k!h!R@ zivQWF2t;ZmUwn?;^S|S{uF3!VfXV-djf(%8^(_{GXXJn1cTE1@2kQ8*6@lUCMdx^8 z{`a`UgzYejzw0pHWnNH+UMlL?N~b{@-sZB*Vg*a^!FSL^b10mgzpaK3 zbHuNx^UG>DyEj@7KgYO?FoyX6&?B@(q@tRBT?6o*?QBuOAx$z63=~F^EN+eu#*&u9 z2%kMZ#$l;&hxsd?{t@PBIjy{LQ{8TOgR<}zRW{SQ6v!dW$NU6|QYFGlNq|`lg#@}Z zR0rW?5=Uh49m%6@h3izfJ|pFlzDTJ zQ17@Xrs`e4e<|(WXw(n$B8eub`eS+1jU}pXF~%;=RdjD;e$`E~ZlpwIxu$55$_!`s z7ePN?1;cS{L;O6R8xc`?|!!!M|lujv)nerB9E5OPQ7Q zJ0nl%E)uyS&-bvW+kS8vJGP=wjTi0>u9C?FV+sYPvtSrT1$k$_K!vMk5$=zGw?!U; zmYi!}IP{Aw^Nbvrk>ToE$4uS?*Rt4Vv<6!k{<{Q{(gxF7E7p{38|gpOW5-LaHc?;w+M+A+D}m0_*^ z=h#vrct-sf+hlt0~jXQ>ZLv|w9?slw2{gGiA(v%{HvZ3U%e5`rwSk$oZ&^LK>n5CSR6>R&h4P&z#Y5vByT5o6SRY>r%n?k| z_`S(S=12u@_UTHsedYg-QKLI3)*BtqvEu(vI{)zF-#=GJ)}YOQ=9oQjJC3Wyk@LT< z|HZlqL}J2Ue2)F~-|<{m>;EC3_5Zk0^Ix&P!zS;ECp)PJK1j3+NT#}oD6 zGaY8x4x{?J4)eAC9|Btcj~fmDiS-@zfG6tz2LGuUcv}Atf$jQVZ2cOP^B9AO=QEV4 zOm8p{Sl(bc+_yid`nwP5KYda4w`tdJIVR95@YVaD*8lGD6#ch+$Yq-2d(&qlHu6us z(;+iG&$V=Gc%7&Mr@D^Kpsz z1C_q4&DlL`Wqyfq6=4hu15g$!B63krzv%(Yq3!H&VM3l3U@;IFaf-NYA0(WX!vvpg zALF)WF2`nr^2~?G^%4Fkyn_)-u6=6;X*H6?5%RS->?fD*BvLCe$q& zGNsH9aj35S<}!BDk3x|w(;H0FEW?;ef%!ZbhmoZ0EEcHcs#z@ecfdPYhM-0+ye|{_ zjaOws2`ngZaieO+Z-W~ycLlA$mVy7xfkvr-X|2f(C%gFH?D%H1^oJtpKx6j!{g)br zr}qDj>FE96A)w#?j~m^wzQJSf|E9%S{I}_w-v1o}Z+|te)55r>meudSg^Tm6Z}8>( z{41TqSvWHdERwEO?%r@h*LiMso1XlQ7>O8f_w%8>p5 GFaQA2!u`Sk From d6cb89512018be123846f6be57acec7a8dc1b8b4 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 22 Feb 2024 12:11:30 +0000 Subject: [PATCH 079/113] Add support for steamcmd app validation --- README.md | 8 ++++++++ bullseye/Dockerfile | 1 + bullseye/etc/entry.sh | 8 +++++++- examples/docker-compose.yml | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a3571b5..300ceb7 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,14 @@ CS2_LOG_ITEMS=0 (Turns item logging on/off: 0=off, 1=on) # Customizing this Container +## Validating Game Files + +If you break the game through your customisations and want steamcmd to validate and redownload then set the `STEAMAPPVALIDATE` environment variable to `1`: + +```dockerfile +STEAMAPPVALIDATE=0 (0=skip validation, 1=validate game files) +``` + ## Pre and Post Hooks The container includes two scripts for executing custom actions: diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 0c2e518..d712b8f 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -11,6 +11,7 @@ LABEL maintainer="joedwards32@gmail.com" ENV STEAMAPPID 730 ENV STEAMAPP cs2 ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated" +ENV STEAMAPPVALIDATE 0 COPY etc/entry.sh "${HOMEDIR}/entry.sh" COPY etc/server.cfg "/etc/server.cfg" diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index fc1a21d..aaf8b83 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -5,9 +5,15 @@ mkdir -p "${STEAMAPPDIR}" || true # Download Updates +if [[ "$STEAMAPPVALIDATE" -eq 1 ]]; then + VALIDATE="validate" +else + VALIDATE="" +fi + bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ +login anonymous \ - +app_update "${STEAMAPPID}" \ + +app_update "${STEAMAPPID}" "${VALIDATE}"\ +quit # steamclient.so fix diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 269f5a7..8084973 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -6,6 +6,7 @@ services: environment: # Server configuration - SRCDS_TOKEN # Game Server Token from https://steamcommunity.com/dev/managegameservers + - STEAMAPPVALIDATE=0 # (0 - no validation, 1 - enable validation) - CS2_SERVERNAME=changeme # (Set the visible name for your private server) - CS2_CHEATS=0 # (0 - disable cheats, 1 - enable cheats) - CS2_PORT=27015 # (CS2 server listen port tcp_udp) From 913ea848ee2069a8e99766df64c79a0d2819eef8 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 22 Feb 2024 13:03:48 +0000 Subject: [PATCH 080/113] template steamcmd command properly --- bullseye/etc/entry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index aaf8b83..454c74f 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -11,7 +11,7 @@ else VALIDATE="" fi -bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ +eval bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ +login anonymous \ +app_update "${STEAMAPPID}" "${VALIDATE}"\ +quit From ca31d8cb4e158954f178251913e91fa56a156b65 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 22 Feb 2024 19:08:50 +0000 Subject: [PATCH 081/113] Updated short tournament example config to use a fixed order map rotation --- examples/cs2.cfg.tgz | Bin 1149 -> 1178 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/cs2.cfg.tgz b/examples/cs2.cfg.tgz index 4c8dc0f7b050cfc4ded2b15ad69cbf5fd0105c66..6ed222281238f5c147effaaa95897b723959fd6a 100644 GIT binary patch literal 1178 zcmV;L1ZDdliwFRpo7ZIk1MON%Z{s!)_O$}?AEw^+R@)Tyau!&iMX}f|7HNWHfgS}# zqAfL+D2P-NZxLYsbnhL?57~-0iPK0$YJLYxBIl(U&I}{wEV%v1f`}EPX^^sBDNszfu{V)avO#?^D?UDc5MveBMvVPREj#d7D#rvPX{Qb-7N@_IopV(#(oR;mXaNzl0 z#s6&G1VS<8FRo+%`ft0Aqw9Yc(DnbYQRTnN`WBnOGwQ$R*}DFBfja&hO<*#8Q5{dL z|E_5hYS{$i@7ToC^}h?~`hVD{^B=Rmr5^Ca`oEF?*bH1<|GU6;{Li+&2Bkb=e#q0D z$wVgC%onVa$@@BxDkCm413 zwT?PmR8fah{3()%2{gAU_$-S+a==SN zv>(i7em)E4tPq&$S;j(%j&;eVqnBcp1b1yP@C;`b6#@0Zq@2x`FYz7;cshp(FPe)4 zXJaXI@pd%2`1vB&p++$gx}??2nL_5QyL= z#$(@qOiCL0Z{d^P|962m-;XYnY;=iR7Q=W0XQvmR;p6G)C%lJ~;EKTF)okvFraoR;K`B_32;U%73Hd$>)Ez>p8XsgqpVZT_1y>I+w zsB?gR8syW0m$~Ry&x_H;%+#-s7W(V)nxdjo)BSG}uT+Tbp=}uzQN;WR14U65>F=CQ svI#3Pjs)gzf*>m|6M^$|d;ZSYzPmH-bXC*P&^QGA13Kvq$U!EHO{Y@$>}n3E}g%5nCP+++Roe*&xPD*+$C zD2d;5HsAwoIJc;!+-&*3Z8T^Pn)Usb=UDRp8{Pl>_3vMnS5~9Rf9CKba9g&k!h!R@ zivQWF2t;ZmUwn?;^S|S{uF3!VfXV-djf(%8^(_{GXXJn1cTE1@2kQ8*6@lUCMdx^8 z{`a`UgzYejzw0pHWnNH+UMlL?N~b{@-sZB*Vg*a^!FSL^b10mgzpaK3 zbHuNx^UG>DyEj@7KgYO?FoyX6&?B@(q@tRBT?6o*?QBuOAx$z63=~F^EN+eu#*&u9 z2%kMZ#$l;&hxsd?{t@PBIjy{LQ{8TOgR<}zRW{SQ6v!dW$NU6|QYFGlNq|`lg#@}Z zR0rW?5=Uh49m%6@h3izfJ|pFlzDTJ zQ17@Xrs`e4e<|(WXw(n$B8eub`eS+1jU}pXF~%;=RdjD;e$`E~ZlpwIxu$55$_!`s z7ePN?1;cS{L;O6R8xc`?|!!!M|lujv)nerB9E5OPQ7Q zJ0nl%E)uyS&-bvW+kS8vJGP=wjTi0>u9C?FV+sYPvtSrT1$k$_K!vMk5$=zGw?!U; zmYi!}IP{Aw^Nbvrk>ToE$4uS?*Rt4Vv<6!k{<{Q{(gxF7E7p{38|gpOW5-LaHc?;w+M+A+D}m0_*^ z=h#vrct-sf+ Date: Thu, 22 Feb 2024 19:28:20 +0000 Subject: [PATCH 082/113] =?UTF-8?q?Revert=20"Updated=20short=20tournament?= =?UTF-8?q?=20example=20config=20to=20use=20a=20fixed=20order=20map=20rota?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/cs2.cfg.tgz | Bin 1178 -> 1149 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/cs2.cfg.tgz b/examples/cs2.cfg.tgz index 6ed222281238f5c147effaaa95897b723959fd6a..4c8dc0f7b050cfc4ded2b15ad69cbf5fd0105c66 100644 GIT binary patch literal 1149 zcmV-@1cLh?iwFRXZ`Nf11MOK$Z{s!)&b0#aAEw^+R@)@?@-DDIi(;``EYbwY0zC?f zG`7`Pq9IC2yhVWh)4g{nKV&Oz5~q=i!2AxDL=K1J8GbVqbr#-!!Z60XKMGSkY6Xlj z-*@52uTWpv5{?7hafNVgVY@akZu>$U!EHO{Y@$>}n3E}g%5nCP+++Roe*&xPD*+$C zD2d;5HsAwoIJc;!+-&*3Z8T^Pn)Usb=UDRp8{Pl>_3vMnS5~9Rf9CKba9g&k!h!R@ zivQWF2t;ZmUwn?;^S|S{uF3!VfXV-djf(%8^(_{GXXJn1cTE1@2kQ8*6@lUCMdx^8 z{`a`UgzYejzw0pHWnNH+UMlL?N~b{@-sZB*Vg*a^!FSL^b10mgzpaK3 zbHuNx^UG>DyEj@7KgYO?FoyX6&?B@(q@tRBT?6o*?QBuOAx$z63=~F^EN+eu#*&u9 z2%kMZ#$l;&hxsd?{t@PBIjy{LQ{8TOgR<}zRW{SQ6v!dW$NU6|QYFGlNq|`lg#@}Z zR0rW?5=Uh49m%6@h3izfJ|pFlzDTJ zQ17@Xrs`e4e<|(WXw(n$B8eub`eS+1jU}pXF~%;=RdjD;e$`E~ZlpwIxu$55$_!`s z7ePN?1;cS{L;O6R8xc`?|!!!M|lujv)nerB9E5OPQ7Q zJ0nl%E)uyS&-bvW+kS8vJGP=wjTi0>u9C?FV+sYPvtSrT1$k$_K!vMk5$=zGw?!U; zmYi!}IP{Aw^Nbvrk>ToE$4uS?*Rt4Vv<6!k{<{Q{(gxF7E7p{38|gpOW5-LaHc?;w+M+A+D}m0_*^ z=h#vrct-sf+Nszfu{V)avO#?^D?UDc5MveBMvVPREj#d7D#rvPX{Qb-7N@_IopV(#(oR;mXaNzl0 z#s6&G1VS<8FRo+%`ft0Aqw9Yc(DnbYQRTnN`WBnOGwQ$R*}DFBfja&hO<*#8Q5{dL z|E_5hYS{$i@7ToC^}h?~`hVD{^B=Rmr5^Ca`oEF?*bH1<|GU6;{Li+&2Bkb=e#q0D z$wVgC%onVa$@@BxDkCm413 zwT?PmR8fah{3()%2{gAU_$-S+a==SN zv>(i7em)E4tPq&$S;j(%j&;eVqnBcp1b1yP@C;`b6#@0Zq@2x`FYz7;cshp(FPe)4 zXJaXI@pd%2`1vB&p++$gx}??2nL_5QyL= z#$(@qOiCL0Z{d^P|962m-;XYnY;=iR7Q=W0XQvmR;p6G)C%lJ~;EKTF)okvFraoR;K`B_32;U%73Hd$>)Ez>p8XsgqpVZT_1y>I+w zsB?gR8syW0m$~Ry&x_H;%+#-s7W(V)nxdjo)BSG}uT+Tbp=}uzQN;WR14U65>F=CQ svI#3Pjs)gzf*>m|6M^$|d;ZSYzPmH-bXC*P&^QGA13Kvq Date: Sun, 25 Feb 2024 21:58:18 +0100 Subject: [PATCH 083/113] Update cfg path --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 300ceb7..c1668d3 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ When using a persient volume mounted at `/home/steam/cs2-dedicated/` you may edi ## Overriding Game Mode Defaults -The default configurations for each game mode are stored in `/home/steam/cs2-dedicated/csgo/cfg/`. For example, the Competitive mode defaults are set by `gamemode_competitive.cfg`. +The default configurations for each game mode are stored in `/home/steam/cs2-dedicated/game/csgo/cfg/`. For example, the Competitive mode defaults are set by `gamemode_competitive.cfg`. When using a persistent volume mounted at `/home/steam/cs2-dedicated/`, these defaults can be overridden by adding your own settings to `gamemode_competitive_server.cfg`. From 23c2e0bc76f20bdd769594c45e42dc1b4d064429 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Mon, 26 Feb 2024 15:55:33 +0000 Subject: [PATCH 084/113] increase warmup to 6 hours, warmup ends automatically once server is full --- examples/cs2.cfg.tgz | Bin 1149 -> 1151 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/cs2.cfg.tgz b/examples/cs2.cfg.tgz index 4c8dc0f7b050cfc4ded2b15ad69cbf5fd0105c66..74822a38f9564f45540818a84119d484d9e033b9 100644 GIT binary patch literal 1151 zcmV-_1c3V=iwFQnvfO0=1MOK$Z{s!)_O$}?AEw^+R@)>cO5Oz)Xi+S7i$$6sS)fNj zk!VYeB^siX*johHKizwW@)*euj-*DD|HPpk;0N}r!jbd8 z%K!Pg3504aUwn@J>%Zf2Zt8y?>K%M`MCNLVm=p0Y1 z|1Nb1vmJu@=MM2q{ci)N{vS7L{v+!T)B~Pa|2O!L&A>JFzYT2X|9opVD3y`$LzzxR zkrc^|@Ri7KMBd-GKj{4Phw49G==^)srj&SqtH85uQ~%q*Q|dqSAT5$qyr&)+zI8D> zyid7n+qP*9uN~X`e@WKYSn>Z`XJ`GV9%l{yGpr9CATRcm58%l8KN!GAOgfxm*5TJW z>u_0R9nSD4Pa>h<#5%E1`ZAVzfdhJ}s1qxl`e`uBWtl|^R-nW0poyj`oL;=G)JM4x zUxltOYjtu@TdQA)s0>8}3kA>`+9NbkO}}XYXy0~rn4pj*888A$gc3b&>ie<8uL&oU7f7*>~ThIwgLTX5Izg3NGaQ4erF7?qRB@)16ufK2Bwl6iB9 z;AmVFQ}u2zxRQ2%JRSsjk%SYW2C=;DMN+6<5sRK!nCRWg{JNK9y-=~rb4}19m6@2| zUltXHIzBkdXCbCgNhjGD78*eTn3JHK6tyiJ^(Rs(q3+va%kch|g}DeYm1}!i1FmFN z;_n)*&?m(v<#>Guv4ud0QIct*f+CR_#3C1#2xAFdy?lDHl-KVdlXBWMwc?dw zqyOjPK!xBL{hv|u{kIjE{(sy!9P4X5+W)EB?ElOqrvJBrX8*tVuvh!fh3WpU8oR## zuXcgeYU{U{75`<9r+)w8j_Yy92Er(DO#g2Mdw>7ooDrM%9sQE#8p6MJ)ck*G*4KFC z`wwv#Z}6W`!cG5g1Kp47v|p~%-nIU+^mcML4W{E$U!EHO{Y@$>}n3E}g%5nCP+++Roe*&xPD*+$C zD2d;5HsAwoIJc;!+-&*3Z8T^Pn)Usb=UDRp8{Pl>_3vMnS5~9Rf9CKba9g&k!h!R@ zivQWF2t;ZmUwn?;^S|S{uF3!VfXV-djf(%8^(_{GXXJn1cTE1@2kQ8*6@lUCMdx^8 z{`a`UgzYejzw0pHWnNH+UMlL?N~b{@-sZB*Vg*a^!FSL^b10mgzpaK3 zbHuNx^UG>DyEj@7KgYO?FoyX6&?B@(q@tRBT?6o*?QBuOAx$z63=~F^EN+eu#*&u9 z2%kMZ#$l;&hxsd?{t@PBIjy{LQ{8TOgR<}zRW{SQ6v!dW$NU6|QYFGlNq|`lg#@}Z zR0rW?5=Uh49m%6@h3izfJ|pFlzDTJ zQ17@Xrs`e4e<|(WXw(n$B8eub`eS+1jU}pXF~%;=RdjD;e$`E~ZlpwIxu$55$_!`s z7ePN?1;cS{L;O6R8xc`?|!!!M|lujv)nerB9E5OPQ7Q zJ0nl%E)uyS&-bvW+kS8vJGP=wjTi0>u9C?FV+sYPvtSrT1$k$_K!vMk5$=zGw?!U; zmYi!}IP{Aw^Nbvrk>ToE$4uS?*Rt4Vv<6!k{<{Q{(gxF7E7p{38|gpOW5-LaHc?;w+M+A+D}m0_*^ z=h#vrct-sf+ Date: Tue, 27 Feb 2024 12:46:15 +0100 Subject: [PATCH 085/113] Update bullseye/Dockerfile --- bullseye/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 3887d51..1d81c32 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -29,6 +29,7 @@ RUN set -x \ simpleproxy \ libicu-dev \ unzip \ + git \ && mkdir -p "${STEAMAPPDIR}" \ # Add entry script && chmod +x "${HOMEDIR}/entry.sh" \ From 09b9cb00619daac070001fa95a7cf2865e091822 Mon Sep 17 00:00:00 2001 From: Astra Date: Tue, 27 Feb 2024 13:10:05 +0100 Subject: [PATCH 086/113] Update bullseye/Dockerfile --- bullseye/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 1d81c32..b736264 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -30,6 +30,7 @@ RUN set -x \ libicu-dev \ unzip \ git \ + patch \ && mkdir -p "${STEAMAPPDIR}" \ # Add entry script && chmod +x "${HOMEDIR}/entry.sh" \ From 9e6171b526eadcc7bb1b407a466848039c78524b Mon Sep 17 00:00:00 2001 From: Astra Date: Tue, 27 Feb 2024 13:10:26 +0100 Subject: [PATCH 087/113] Update bullseye/Dockerfile --- bullseye/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index b736264..d971613 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -29,7 +29,6 @@ RUN set -x \ simpleproxy \ libicu-dev \ unzip \ - git \ patch \ && mkdir -p "${STEAMAPPDIR}" \ # Add entry script From 2d76681eacad0c6962515418e2f12cd02da67738 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Wed, 28 Feb 2024 09:41:13 +0000 Subject: [PATCH 088/113] disable match warmup auto end in example config --- examples/cs2.cfg.tgz | Bin 1151 -> 1154 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/cs2.cfg.tgz b/examples/cs2.cfg.tgz index 74822a38f9564f45540818a84119d484d9e033b9..522573a1a5cc4badd87d5b8c49d6d3c6cbe4dcfe 100644 GIT binary patch literal 1154 zcmV-|1bzD-iwFRv|K4Q)1MOMeZ=*&K&ufwLKTLh?TW#+yEI22f)T%n&Ri`vja#9}= zfwiGAti?hSUlr;8>ArUse_#_giLZew^8Oyo$Ii?SGy9vt%Xx73Q3R35hm#-`N3DPm z;&~j7ybAS^tl&669nKiHnayn=)b%Zf2Zt8y*F!leiQSo21zQrc+4fWsi98>?hK%M`MCNQ47=p4_i z|1Nb1vmJu@=MM2q{qF*%{vS4K{v+#K>H*KJ{~P?rX5gCo-vzewf4;RFl*&l>p-g9@ zNQ&e}_)6qAA|LGAA9VitWAz^|bpAc=d9H)~pV=OFP5tiz&#C{+gS1Fe@s4`rgi@Pv zIyf2GC+>-94X+*B{C`Q-*I4oY>(S2oPd)B5`A-1psm#}L{x?%f`tNT4eb${sHWev0CZqGJ4{eWlMEOEB|?cFH}(Bk;&PaX zZ`O~*xKv_~`Ky@z5#(t(tDN~aOy@9` zd2^BAXj~LC^>#SClJ;OS83uWggj1o0vApd^QmB3ri@sQx=-9&PO=FsG=c&!D?vFeYFjw!Po+{qJ+#G^0sbuua}i)N*Y>mq zT*<7&-#JD?52464#(p3M`rZ$mkYg(hRJ;tYf1OOHBEn>dbncIXu)ydn7AWI-7RG-B zaaZI4Xvu~3Wk5g6GS4u889J_Rbk5|hewPM4_F8+x#;mlDVH|4y*)_n#5xjM#kO=$ACt5dO8J=Ko8x zzQz;Ze~80)ga3pQZu);0=zUnH{c@f5p7ocdH UO;s~6FgOJK17X);YXCR^09L_bFaQ7m literal 1151 zcmV-_1c3V=iwFQnvfO0=1MOK$Z{s!)_O$}?AEw^+R@)>cO5Oz)Xi+S7i$$6sS)fNj zk!VYeB^siX*johHKizwW@)*euj-*DD|HPpk;0N}r!jbd8 z%K!Pg3504aUwn@J>%Zf2Zt8y?>K%M`MCNLVm=p0Y1 z|1Nb1vmJu@=MM2q{ci)N{vS7L{v+!T)B~Pa|2O!L&A>JFzYT2X|9opVD3y`$LzzxR zkrc^|@Ri7KMBd-GKj{4Phw49G==^)srj&SqtH85uQ~%q*Q|dqSAT5$qyr&)+zI8D> zyid7n+qP*9uN~X`e@WKYSn>Z`XJ`GV9%l{yGpr9CATRcm58%l8KN!GAOgfxm*5TJW z>u_0R9nSD4Pa>h<#5%E1`ZAVzfdhJ}s1qxl`e`uBWtl|^R-nW0poyj`oL;=G)JM4x zUxltOYjtu@TdQA)s0>8}3kA>`+9NbkO}}XYXy0~rn4pj*888A$gc3b&>ie<8uL&oU7f7*>~ThIwgLTX5Izg3NGaQ4erF7?qRB@)16ufK2Bwl6iB9 z;AmVFQ}u2zxRQ2%JRSsjk%SYW2C=;DMN+6<5sRK!nCRWg{JNK9y-=~rb4}19m6@2| zUltXHIzBkdXCbCgNhjGD78*eTn3JHK6tyiJ^(Rs(q3+va%kch|g}DeYm1}!i1FmFN z;_n)*&?m(v<#>Guv4ud0QIct*f+CR_#3C1#2xAFdy?lDHl-KVdlXBWMwc?dw zqyOjPK!xBL{hv|u{kIjE{(sy!9P4X5+W)EB?ElOqrvJBrX8*tVuvh!fh3WpU8oR## zuXcgeYU{U{75`<9r+)w8j_Yy92Er(DO#g2Mdw>7ooDrM%9sQE#8p6MJ)ck*G*4KFC z`wwv#Z}6W`!cG5g1Kp47v|p~%-nIU+^mcML4W{E Date: Mon, 11 Mar 2024 12:40:53 +0000 Subject: [PATCH 089/113] Add support for steamcmd app validation --- bullseye/Dockerfile | 1 + bullseye/etc/entry.sh | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index 3887d51..f8b38da 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -11,6 +11,7 @@ LABEL maintainer="astra@zio.sh" ENV STEAMAPPID 730 ENV STEAMAPP cs2 ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated" +ENV STEAMAPPVALIDATE 0 COPY etc/entry.sh "${HOMEDIR}/entry.sh" COPY etc/server.cfg "/etc/server.cfg" diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 0524989..df62192 100755 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -1,10 +1,16 @@ #!/bin/bash mkdir -p "${STEAMAPPDIR}" || true +if [[ "$STEAMAPPVALIDATE" -eq 1 ]]; then + VALIDATE="validate" +else + VALIDATE="" +fi + # Download Updates bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ +login anonymous \ - +app_update "${STEAMAPPID}" \ + +app_update "${STEAMAPPID}" "${VALIDATE}" \ +quit # steamclient.so fix @@ -40,13 +46,13 @@ fi # Rewrite Config Files if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then - sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/* + sed -r -i "s/^(bot_difficulty) .*/\1 ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi if [[ ! -z $CS2_BOT_QUOTA ]] ; then - sed -i "s/bot_quota.*/bot_quota ${CS2_BOT_QUOTA}/" "${STEAMAPPDIR}"/game/csgo/cfg/* + sed -r -i "s/^(bot_quota) .*/\1 ${CS2_BOT_QUOTA}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi if [[ ! -z $CS2_BOT_QUOTA_MODE ]] ; then - sed -i "s/bot_quota_mode.*/bot_quota_mode ${CS2_BOT_QUOTA_MODE}/" "${STEAMAPPDIR}"/game/csgo/cfg/* + sed -r -i "s/^(bot_quota_mode) .*/\1 ${CS2_BOT_QUOTA_MODE}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi # Switch to server directory From 5517cb86939335f0ae63db23c5f635d3becccd0d Mon Sep 17 00:00:00 2001 From: TYGX <44126974+tydaytygx@users.noreply.github.com> Date: Tue, 2 Apr 2024 20:57:35 +0800 Subject: [PATCH 090/113] Add local console for docker attach docker attach --sig-proxy=false cs2-dedicated or docker attach --detach-keys="ctrl-x" cs2-dedicated --- examples/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 8084973..0662965 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -47,5 +47,7 @@ services: - "27015:27015/tcp" # TCP - "27015:27015/udp" # UDP - "27020:27020/udp" # UDP + stdin_open: true # Add local console for docker attach, docker attach --sig-proxy=false cs2-dedicated + tty: true # Add local console for docker attach, docker attach --sig-proxy=false cs2-dedicated volumes: cs2: From 9c3fb1d098838f8f56965c77d4d0d967980784c2 Mon Sep 17 00:00:00 2001 From: Viacheslav Vasilyev Date: Fri, 5 Apr 2024 17:48:58 +0100 Subject: [PATCH 091/113] Update README.md info about token, user id, source-tv port --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c1668d3..37c6560 100644 --- a/README.md +++ b/README.md @@ -13,14 +13,16 @@ This Docker image contains the dedicated server of the game. Running using Docker: ```console -$ docker run -d --name=cs2 -e SRCDS_TOKEN={YOURTOKEN} -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/tcp joedwards32/cs2 +$ SRCDS_TOKEN="..." # check https://steamcommunity.com/dev/managegameservers +$ docker run -d --name=cs2 -e SRCDS_TOKEN="$SRCDS_TOKEN" -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/udp joedwards32/cs2 ``` Running using a bind mount for data persistence on container recreation: ```console $ mkdir -p $(pwd)/cs2-data -$ chmod 777 $(pwd)/cs2-data # Makes sure the directory is writeable by the unprivileged container user -$ docker run -d --name=cs2 -e SRCDS_TOKEN={YOURTOKEN} -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/tcp joedwards32/cs2 +$ chown 1000:1000 $(pwd)/cs2-data # Makes sure the directory is writeable by the unprivileged container user with uid 1000, known as steam +$ SRCDS_TOKEN="..." # check https://steamcommunity.com/dev/managegameservers +$ docker run -d --name=cs2 -e SRCDS_TOKEN="$SRCDS_TOKEN" -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/udp joedwards32/cs2 ``` or using docker-compose, see [examples](https://github.com/joedwards32/CS2/blob/main/examples/docker-compose.yml): From 557f8efce75ce959bbd87afc3b653131f0df182e Mon Sep 17 00:00:00 2001 From: TYGX <44126974+tydaytygx@users.noreply.github.com> Date: Mon, 13 May 2024 15:48:41 +0800 Subject: [PATCH 092/113] added workshop params --- bullseye/etc/entry.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 454c74f..f61fcb1 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -12,9 +12,9 @@ else fi eval bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ - +login anonymous \ - +app_update "${STEAMAPPID}" "${VALIDATE}"\ - +quit + +login anonymous \ + +app_update "${STEAMAPPID}" "${VALIDATE}"\ + +quit # steamclient.so fix mkdir -p ~/.steam/sdk64 @@ -113,6 +113,11 @@ eval "./cs2" -dedicated \ "${SV_SETSTEAMACCOUNT_ARGS}" \ +sv_password "${CS2_PW}" \ +sv_lan "${CS2_LAN}" \ + +sv_downloadurl "${CS2_FASTDL_URL}" \ + +sv_allowdownload "${CS2_FASTDL_ALLOW_DOWNLOAD}" \ + +sv_allowupload "${CS2_FASTDL_ALLOW_UPLOAD}" \ + +host_workshop_map "${CS2_HOST_WORKSHOP_MAP}"\ + +host_workshop_collection "${CS2_HOST_WORKSHOP_COLLECTION}"\ "${CS2_ADDITIONAL_ARGS}" # Post Hook From 758bbfc0d17211afccb9f54fedf8e7ad44442657 Mon Sep 17 00:00:00 2001 From: TYGX <44126974+tydaytygx@users.noreply.github.com> Date: Mon, 13 May 2024 15:53:52 +0800 Subject: [PATCH 093/113] Added workshop map support --- examples/docker-compose.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 0662965..2a49e31 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -24,6 +24,8 @@ services: - CS2_GAMEMODE=1 # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) - CS2_MAPGROUP=mg_active # (Map pool) - CS2_STARTMAP=de_inferno # (Start map) + - CS2_HOST_WORKSHOP_MAP # Specify workshop map id + - CS2_HOST_WORKSHOP_COLLECTION # Specify workshop collection id # Bots - CS2_BOT_DIFFICULTY # (0 - easy, 1 - normal, 2 - hard, 3 - expert) - CS2_BOT_QUOTA # (Number of bots) @@ -47,7 +49,7 @@ services: - "27015:27015/tcp" # TCP - "27015:27015/udp" # UDP - "27020:27020/udp" # UDP - stdin_open: true # Add local console for docker attach, docker attach --sig-proxy=false cs2-dedicated - tty: true # Add local console for docker attach, docker attach --sig-proxy=false cs2-dedicated + stdin_open: true # Add local console for docker attach, docker attach --sig-proxy=false cs2-dedicated + tty: true # Add local console for docker attach, docker attach --sig-proxy=false cs2-dedicated volumes: cs2: From d77ddbe9b26b307f05cd85e92e01b77671f824fb Mon Sep 17 00:00:00 2001 From: TYGX <44126974+tydaytygx@users.noreply.github.com> Date: Mon, 13 May 2024 16:17:22 +0800 Subject: [PATCH 094/113] Update entry.sh --- bullseye/etc/entry.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index f61fcb1..3a416cb 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -113,9 +113,6 @@ eval "./cs2" -dedicated \ "${SV_SETSTEAMACCOUNT_ARGS}" \ +sv_password "${CS2_PW}" \ +sv_lan "${CS2_LAN}" \ - +sv_downloadurl "${CS2_FASTDL_URL}" \ - +sv_allowdownload "${CS2_FASTDL_ALLOW_DOWNLOAD}" \ - +sv_allowupload "${CS2_FASTDL_ALLOW_UPLOAD}" \ +host_workshop_map "${CS2_HOST_WORKSHOP_MAP}"\ +host_workshop_collection "${CS2_HOST_WORKSHOP_COLLECTION}"\ "${CS2_ADDITIONAL_ARGS}" From 22f0af7d49db7bb6a9eb4ab5f0524852d7bdcedc Mon Sep 17 00:00:00 2001 From: John Edwards Date: Thu, 16 May 2024 15:31:29 +0100 Subject: [PATCH 095/113] Revert "Add workshop support" --- bullseye/etc/entry.sh | 8 +++----- examples/docker-compose.yml | 6 ++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 3a416cb..454c74f 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -12,9 +12,9 @@ else fi eval bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ - +login anonymous \ - +app_update "${STEAMAPPID}" "${VALIDATE}"\ - +quit + +login anonymous \ + +app_update "${STEAMAPPID}" "${VALIDATE}"\ + +quit # steamclient.so fix mkdir -p ~/.steam/sdk64 @@ -113,8 +113,6 @@ eval "./cs2" -dedicated \ "${SV_SETSTEAMACCOUNT_ARGS}" \ +sv_password "${CS2_PW}" \ +sv_lan "${CS2_LAN}" \ - +host_workshop_map "${CS2_HOST_WORKSHOP_MAP}"\ - +host_workshop_collection "${CS2_HOST_WORKSHOP_COLLECTION}"\ "${CS2_ADDITIONAL_ARGS}" # Post Hook diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 2a49e31..0662965 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -24,8 +24,6 @@ services: - CS2_GAMEMODE=1 # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) - CS2_MAPGROUP=mg_active # (Map pool) - CS2_STARTMAP=de_inferno # (Start map) - - CS2_HOST_WORKSHOP_MAP # Specify workshop map id - - CS2_HOST_WORKSHOP_COLLECTION # Specify workshop collection id # Bots - CS2_BOT_DIFFICULTY # (0 - easy, 1 - normal, 2 - hard, 3 - expert) - CS2_BOT_QUOTA # (Number of bots) @@ -49,7 +47,7 @@ services: - "27015:27015/tcp" # TCP - "27015:27015/udp" # UDP - "27020:27020/udp" # UDP - stdin_open: true # Add local console for docker attach, docker attach --sig-proxy=false cs2-dedicated - tty: true # Add local console for docker attach, docker attach --sig-proxy=false cs2-dedicated + stdin_open: true # Add local console for docker attach, docker attach --sig-proxy=false cs2-dedicated + tty: true # Add local console for docker attach, docker attach --sig-proxy=false cs2-dedicated volumes: cs2: From 5eec7ffaa450be504ccfecf02756632b9b9b9a45 Mon Sep 17 00:00:00 2001 From: ALZ Date: Tue, 4 Jun 2024 10:29:19 +0200 Subject: [PATCH 096/113] change comment on TV_DELAY --- examples/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 0662965..fe3a40c 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -35,7 +35,7 @@ services: - TV_PW=changeme # CSTV password for clients - TV_RELAY_PW=changeme # CSTV password for relay proxies - TV_MAXRATE=0 # World snapshots to broadcast per second. Affects camera tickrate. - - TV_DELAY=0 # Max CSTV spectator bandwidth rate allowed, 0 == unlimited + - TV_DELAY=0 # CSTV broadcast delay in seconds # Logs - CS2_LOG=on # 'on'/'off' - CS2_LOG_MONEY=0 # Turns money logging on/off: (0=off, 1=on) From d3082cd6e04472149aaa436ee7b7a44c35d78840 Mon Sep 17 00:00:00 2001 From: Steve Fan <29133953+stevefan1999-personal@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:43:32 +0800 Subject: [PATCH 097/113] Add jq --- bullseye/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/bullseye/Dockerfile b/bullseye/Dockerfile index d712b8f..95cefa6 100644 --- a/bullseye/Dockerfile +++ b/bullseye/Dockerfile @@ -28,6 +28,7 @@ RUN set -x \ simpleproxy \ libicu-dev \ unzip \ + jq \ && mkdir -p "${STEAMAPPDIR}" \ # Add entry script && chmod +x "${HOMEDIR}/entry.sh" \ From 026c24f6e96bbe6d4d534f760d3a2010171896db Mon Sep 17 00:00:00 2001 From: Steve Fan <29133953+stevefan1999-personal@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:50:34 +0800 Subject: [PATCH 098/113] Update entry.sh --- bullseye/etc/entry.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index 454c74f..d82808b 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -71,7 +71,7 @@ fi cd "${STEAMAPPDIR}/game/bin/linuxsteamrt64" # Pre Hook -bash "${STEAMAPPDIR}/pre.sh" +source "${STEAMAPPDIR}/pre.sh" # Construct server arguments @@ -116,4 +116,4 @@ eval "./cs2" -dedicated \ "${CS2_ADDITIONAL_ARGS}" # Post Hook -bash "${STEAMAPPDIR}/post.sh" +source "${STEAMAPPDIR}/post.sh" From 5b761eea1eef4f8ecec9acacb645cdf78274aa15 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Wed, 28 Aug 2024 16:58:42 +0100 Subject: [PATCH 099/113] Example of overriding the pre-hook using Docker Volumes --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 37c6560..5251856 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,12 @@ The container includes two scripts for executing custom actions: When using a persient volume mounted at `/home/steam/cs2-dedicated/` you may edit these scripts to perform custom actions, such as enabling metamod. +Alternatively, you may have docker mount files from outside the container to override these files. E.g.: + +``` +-v /path/to/pre.sh:/home/steam/cs2-dedicated/pre.sh +``` + ## Overriding Game Mode Defaults The default configurations for each game mode are stored in `/home/steam/cs2-dedicated/game/csgo/cfg/`. For example, the Competitive mode defaults are set by `gamemode_competitive.cfg`. From 0ac69e9374f886053d8aedf6fe8d0a7875e62c26 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Fri, 30 Aug 2024 21:08:26 +0100 Subject: [PATCH 100/113] experimental support for workshop maps --- README.md | 16 ++++++++++++++++ bullseye/etc/entry.sh | 21 ++++++++++++++++++++- examples/docker-compose.yml | 1 - 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 37c6560..0355dbf 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,22 @@ CS2_LOG_DETAIL=0 (Combat damage logging: 0=disabled, 1=enemy, 2=frien CS2_LOG_ITEMS=0 (Turns item logging on/off: 0=off, 1=on) ``` +### Steam Workshop + +Support for Steam Workshop is experimental! + +```dockerfile +CS2_HOST_WORKSHOP_MAP="" (Steam Workshop Map ID to load on server start) +CS2_HOST_WORKSHOP_COLLECTION="" (Steam Workshop Collection ID to download) +``` + +If a Workshop Collection is set, maps can be selected via rcon. E.g: + +``` +ds_workshop_listmaps +ds_workshop_changelevel $map_name +``` + # Customizing this Container ## Validating Game Files diff --git a/bullseye/etc/entry.sh b/bullseye/etc/entry.sh index d82808b..ba602fb 100644 --- a/bullseye/etc/entry.sh +++ b/bullseye/etc/entry.sh @@ -93,6 +93,22 @@ if [[ ! -z $SRCDS_TOKEN ]]; then SV_SETSTEAMACCOUNT_ARGS="+sv_setsteamaccount ${SRCDS_TOKEN}" fi +if [[ ! -z $CS2_HOST_WORKSHOP_COLLECTION ]] || [[ ! -z $CS2_HOST_WORKSHOP_MAP ]]; then + CS2_MP_MATCH_END_CHANGELEVEL="+mp_match_end_changelevel true" # https://github.com/joedwards32/CS2/issues/57#issuecomment-2245595368 + CS2_STARTMAP="\" # https://github.com/joedwards32/CS2/issues/57#issuecomment-2245595368 + CS2_MAPGROUP_ARGS= +else + CS2_MAPGROUP_ARGS="+mapgroup ${CS2_MAPGROUP}" +fi + +if [[ ! -z $CS2_HOST_WORKSHOP_COLLECTION ]]; then + CS2_HOST_WORKSHOP_COLLECTION_ARGS="+host_workshop_collection ${CS2_HOST_WORKSHOP_COLLECTION}" +fi + +if [[ ! -z $CS2_HOST_WORKSHOP_MAP ]]; then + CS2_HOST_WORKSHOP_MAP_ARGS="+host_workshop_map ${CS2_HOST_WORKSHOP_MAP}" +fi + # Start Server if [[ ! -z $CS2_RCON_PORT ]]; then @@ -107,8 +123,11 @@ eval "./cs2" -dedicated \ -usercon \ -maxplayers "${CS2_MAXPLAYERS}" \ "${CS2_GAME_MODE_ARGS}" \ - +mapgroup "${CS2_MAPGROUP}" \ + "${CS2_MAPGROUP_ARGS}" \ +map "${CS2_STARTMAP}" \ + "${CS2_HOST_WORKSHOP_COLLECTION_ARGS}" \ + "${CS2_HOST_WORKSHOP_MAP_ARGS}" \ + "${CS2_MP_MATCH_END_CHANGELEVEL}" \ +rcon_password "${CS2_RCONPW}" \ "${SV_SETSTEAMACCOUNT_ARGS}" \ +sv_password "${CS2_PW}" \ diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index fe3a40c..8df7e28 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.7' services: cs2-server: image: joedwards32/cs2 From a15e7ce765eaaedb0ab4d3641a918f910aa43fa5 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Fri, 30 Aug 2024 21:15:16 +0100 Subject: [PATCH 101/113] Updated readme and examples for workshop support --- README.md | 4 ++-- examples/docker-compose.yml | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0355dbf..421d44d 100644 --- a/README.md +++ b/README.md @@ -77,8 +77,8 @@ CS2_GAMEALIAS="" (Game type, e.g. casual, competitive, deathmatch. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) CS2_GAMETYPE=0 (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) CS2_GAMEMODE=1 (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) -CS2_MAPGROUP="mg_active" (Map pool) -CS2_STARTMAP="de_inferno" (Start map) +CS2_MAPGROUP="mg_active" (Map pool. Ignored if workshop maps are defined.) +CS2_STARTMAP="de_inferno" (Start map. Ignored if workshop maps are defined.) ``` ### Bots diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 8df7e28..535f3b7 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -21,8 +21,11 @@ services: - CS2_GAMEALIAS # (Game type, e.g. casual, competitive, deathmatch. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) - CS2_GAMETYPE=0 # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) - CS2_GAMEMODE=1 # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) - - CS2_MAPGROUP=mg_active # (Map pool) - - CS2_STARTMAP=de_inferno # (Start map) + - CS2_MAPGROUP=mg_active # (Map pool. Ignored if Workshop maps are defined.) + - CS2_STARTMAP=de_inferno # (Start map. Ignored if Workshop maps are defined.) + # Workshop Maps + - CS2_HOST_WORKSHOP_COLLECTION # The workshop collection to use + - CS2_HOST_WORKSHOP_MAP # The workshop map to use. If collection is also defined, this is the starting map. # Bots - CS2_BOT_DIFFICULTY # (0 - easy, 1 - normal, 2 - hard, 3 - expert) - CS2_BOT_QUOTA # (Number of bots) From 573abc9a49209c10f6b2022ec64779a4fd4980d0 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Fri, 11 Oct 2024 17:12:32 +0100 Subject: [PATCH 102/113] Migrate from bullseye to bookworm * Pin bookworm explicitly in parent container image tags * Update references to bullseye --- .github/workflows/docker-image.yml | 2 +- .github/workflows/docker-publish.yml | 6 +++--- {bullseye => bookworm}/.dockerignore | 0 {bullseye => bookworm}/Dockerfile | 4 ++-- {bullseye => bookworm}/etc/entry.sh | 0 {bullseye => bookworm}/etc/post.sh | 0 {bullseye => bookworm}/etc/pre.sh | 0 {bullseye => bookworm}/etc/server.cfg | 0 {bullseye => bookworm}/hooks/build | 2 +- bookworm/hooks/push | 2 ++ bullseye/hooks/push | 2 -- 11 files changed, 9 insertions(+), 9 deletions(-) rename {bullseye => bookworm}/.dockerignore (100%) rename {bullseye => bookworm}/Dockerfile (95%) rename {bullseye => bookworm}/etc/entry.sh (100%) rename {bullseye => bookworm}/etc/post.sh (100%) rename {bullseye => bookworm}/etc/pre.sh (100%) rename {bullseye => bookworm}/etc/server.cfg (100%) rename {bullseye => bookworm}/hooks/build (66%) create mode 100644 bookworm/hooks/push delete mode 100644 bullseye/hooks/push diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 7c5af2c..3c0bd87 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,5 +15,5 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build the Docker image - working-directory: ./bullseye + working-directory: ./bookworm run: docker build . --file Dockerfile --tag joedwards32/cs2:latest diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 0b4b673..7be7013 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -17,7 +17,7 @@ on: env: # Use docker.io for Docker Hub if empty - REGISTRY: docker.io + REGISTRY: docker.io # github.repository as / IMAGE_NAME: ${{ github.repository }} @@ -62,8 +62,8 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 with: - context: ./bullseye - file: ./bullseye/Dockerfile + context: ./bookworm + file: ./bookworm/Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/bullseye/.dockerignore b/bookworm/.dockerignore similarity index 100% rename from bullseye/.dockerignore rename to bookworm/.dockerignore diff --git a/bullseye/Dockerfile b/bookworm/Dockerfile similarity index 95% rename from bullseye/Dockerfile rename to bookworm/Dockerfile index 95cefa6..98cb3f9 100644 --- a/bullseye/Dockerfile +++ b/bookworm/Dockerfile @@ -4,7 +4,7 @@ # BUILD STAGE -FROM cm2network/steamcmd:root as build_stage +FROM cm2network/steamcmd:root-bookworm as build_stage LABEL maintainer="joedwards32@gmail.com" @@ -39,7 +39,7 @@ RUN set -x \ # BASE -FROM build_stage AS bullseye-base +FROM build_stage AS bookworm-base ENV CS2_SERVERNAME="cs2 private server" \ CS2_CHEATS=0 \ diff --git a/bullseye/etc/entry.sh b/bookworm/etc/entry.sh similarity index 100% rename from bullseye/etc/entry.sh rename to bookworm/etc/entry.sh diff --git a/bullseye/etc/post.sh b/bookworm/etc/post.sh similarity index 100% rename from bullseye/etc/post.sh rename to bookworm/etc/post.sh diff --git a/bullseye/etc/pre.sh b/bookworm/etc/pre.sh similarity index 100% rename from bullseye/etc/pre.sh rename to bookworm/etc/pre.sh diff --git a/bullseye/etc/server.cfg b/bookworm/etc/server.cfg similarity index 100% rename from bullseye/etc/server.cfg rename to bookworm/etc/server.cfg diff --git a/bullseye/hooks/build b/bookworm/hooks/build similarity index 66% rename from bullseye/hooks/build rename to bookworm/hooks/build index cfffa83..16d5f3b 100644 --- a/bullseye/hooks/build +++ b/bookworm/hooks/build @@ -2,4 +2,4 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -docker build --target=bullseye-base -t $DOCKER_REPO:latest -t $DOCKER_REPO:base ${SCRIPT_DIR}/.. +docker build --target=bookworm-base -t $DOCKER_REPO:latest -t $DOCKER_REPO:base ${SCRIPT_DIR}/.. diff --git a/bookworm/hooks/push b/bookworm/hooks/push new file mode 100644 index 0000000..51252bc --- /dev/null +++ b/bookworm/hooks/push @@ -0,0 +1,2 @@ +#!/bin/bash +docker push --all-tags ${DOCKER_REPO} diff --git a/bullseye/hooks/push b/bullseye/hooks/push deleted file mode 100644 index 93a8d0d..0000000 --- a/bullseye/hooks/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push --all-tags ${DOCKER_REPO} From 13b55392a9760bbdb6b54bb82b9598b0ef5d4971 Mon Sep 17 00:00:00 2001 From: Pascal Paulis Date: Thu, 31 Oct 2024 09:11:02 +0100 Subject: [PATCH 103/113] added tv port Signed-off-by: Pascal Paulis --- .gitignore | 1 + bookworm/etc/entry.sh | 1 + 2 files changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/bookworm/etc/entry.sh b/bookworm/etc/entry.sh index ba602fb..2004448 100644 --- a/bookworm/etc/entry.sh +++ b/bookworm/etc/entry.sh @@ -132,6 +132,7 @@ eval "./cs2" -dedicated \ "${SV_SETSTEAMACCOUNT_ARGS}" \ +sv_password "${CS2_PW}" \ +sv_lan "${CS2_LAN}" \ + +tv_port "${TV_PORT}" \ "${CS2_ADDITIONAL_ARGS}" # Post Hook From aad42520e40eae02411858f25d021d147d8cce69 Mon Sep 17 00:00:00 2001 From: Alejo Morell <34201397+Yukics@users.noreply.github.com> Date: Sat, 16 Nov 2024 16:12:34 +0100 Subject: [PATCH 104/113] fix: not being able to copy conf --- bookworm/etc/entry.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bookworm/etc/entry.sh b/bookworm/etc/entry.sh index 2004448..f2ccc46 100644 --- a/bookworm/etc/entry.sh +++ b/bookworm/etc/entry.sh @@ -21,6 +21,7 @@ mkdir -p ~/.steam/sdk64 ln -sfT ${STEAMCMDDIR}/linux64/steamclient.so ~/.steam/sdk64/steamclient.so # Install server.cfg +mkdir -p $STEAMAPPDIR/game/csgo/cfg cp /etc/server.cfg "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg # Install hooks if they don't already exist From 31c67e7b39089daadff59ed89891f1032306b90f Mon Sep 17 00:00:00 2001 From: Bims Date: Sat, 21 Dec 2024 17:24:33 +0000 Subject: [PATCH 105/113] feat: add support for tar and zip archives --- bookworm/etc/entry.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/bookworm/etc/entry.sh b/bookworm/etc/entry.sh index f2ccc46..223e180 100644 --- a/bookworm/etc/entry.sh +++ b/bookworm/etc/entry.sh @@ -35,7 +35,32 @@ fi # Download and extract custom config bundle if [[ ! -z $CS2_CFG_URL ]]; then echo "Downloading config pack from ${CS2_CFG_URL}" - wget -qO- "${CS2_CFG_URL}" | tar xvzf - -C "${STEAMAPPDIR}" + + TEMP_DIR=$(mktemp -d) + TEMP_FILE="${TEMP_DIR}/$(basename ${CS2_CFG_URL})" + wget -qO "${TEMP_FILE}" "${CS2_CFG_URL}" + + case "${TEMP_FILE}" in + *.zip) + echo "Extracting ZIP file..." + unzip -q "${TEMP_FILE}" -d "${STEAMAPPDIR}" + ;; + *.tar.gz | *.tgz) + echo "Extracting TAR.GZ or TGZ file..." + tar xvzf "${TEMP_FILE}" -C "${STEAMAPPDIR}" + ;; + *.tar) + echo "Extracting TAR file..." + tar xvf "${TEMP_FILE}" -C "${STEAMAPPDIR}" + ;; + *) + echo "Unsupported file type" + rm -rf "${TEMP_DIR}" + exit 1 + ;; + esac + + rm -rf "${TEMP_DIR}" fi # Rewrite Config Files From 0f176681d86fe392ee146b5229ac42d40cca73b2 Mon Sep 17 00:00:00 2001 From: Bims Date: Sat, 21 Dec 2024 17:30:58 +0000 Subject: [PATCH 106/113] docs: add tar and zip archive mentions --- README.md | 6 +++--- examples/docker-compose.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3933b42..9f64c25 100644 --- a/README.md +++ b/README.md @@ -165,13 +165,13 @@ mp_maxrounds 16 // Shorter games ## Customisation Bundle -The container can be instructed to download a extract a Tar Gzip of configuration files and other customisations from a given URL. +The container can be instructed to download a extract a Tar Gzip bundle, Tar or Zip archive of configuration files and other customisations from a given URL. ```dockerfile -CS2_CFG_URL="" (HTTP/HTTPS URL to fetch a Tar Gzip bundle of configuration files/mods) +CS2_CFG_URL="" (HTTP/HTTPS URL to fetch a Tar Gzip bundle, Tar or Zip archive of configuration files/mods) ``` -See [examples](https://github.com/joedwards32/CS2/blob/main/examples/cs2.cfg.tgz) for a correctly formatted Tar Gzip customisation bundle. +See [examples](https://github.com/joedwards32/CS2/blob/main/examples/cs2.cfg.tgz) for a correctly formatted Tar Gzip customisation bundle, the same format applies to all archive types. # Credits diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 535f3b7..af3b257 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -16,7 +16,7 @@ services: - CS2_PW=changeme # (CS2 server password) - CS2_MAXPLAYERS=10 # (Max players) - CS2_ADDITIONAL_ARGS # (Optional additional arguments to pass into cs2) - - CS2_CFG_URL # HTTP/HTTPS URL to fetch a Tar Gzip bundle of configuration files/mods + - CS2_CFG_URL # HTTP/HTTPS URL to fetch a Tar Gzip bundle, Tar or Zip archive of configuration files/mods # Game modes - CS2_GAMEALIAS # (Game type, e.g. casual, competitive, deathmatch. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) - CS2_GAMETYPE=0 # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers) From 0728ecca294a0e32cbd4aaf8331646b28cc1f5ba Mon Sep 17 00:00:00 2001 From: Roman Kvitkov Date: Sat, 28 Dec 2024 01:03:21 +0500 Subject: [PATCH 107/113] fix bot_quota_mode shadowing. close #137 --- bookworm/etc/entry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookworm/etc/entry.sh b/bookworm/etc/entry.sh index f2ccc46..0a0b96f 100644 --- a/bookworm/etc/entry.sh +++ b/bookworm/etc/entry.sh @@ -62,7 +62,7 @@ if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi if [[ ! -z $CS2_BOT_QUOTA ]] ; then - sed -i "s/bot_quota.*/bot_quota ${CS2_BOT_QUOTA}/" "${STEAMAPPDIR}"/game/csgo/cfg/* + sed -ri "s/bot_quota[[:space:]]+.*/bot_quota ${CS2_BOT_QUOTA}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi if [[ ! -z $CS2_BOT_QUOTA_MODE ]] ; then sed -i "s/bot_quota_mode.*/bot_quota_mode ${CS2_BOT_QUOTA_MODE}/" "${STEAMAPPDIR}"/game/csgo/cfg/* From ff2cfc51d377a0c42a6d3b9bcf981e3302283087 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Tue, 14 Jan 2025 14:35:34 +0000 Subject: [PATCH 108/113] Default to passwordless server. Update documentation to reflect this. --- README.md | 2 +- bookworm/Dockerfile | 1 - bookworm/etc/entry.sh | 8 ++++++-- examples/docker-compose.yml | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9f64c25..b598655 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ CS2_RCON_PORT="" (Optional, use a simple TCP proxy to have RCON liste Useful for services like AWS Fargate which do not support mixed protocol ports.) CS2_LAN="0" (0 - LAN mode disabled, 1 - LAN Mode enabled) CS2_RCONPW="changeme" (RCON password) -CS2_PW="changeme" (CS2 server password) +CS2_PW="" (Optional, CS2 server password) CS2_MAXPLAYERS=10 (Max players) CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) ``` diff --git a/bookworm/Dockerfile b/bookworm/Dockerfile index 98cb3f9..189dcd4 100644 --- a/bookworm/Dockerfile +++ b/bookworm/Dockerfile @@ -49,7 +49,6 @@ ENV CS2_SERVERNAME="cs2 private server" \ CS2_RCON_PORT="" \ CS2_MAXPLAYERS=10 \ CS2_RCONPW="changeme" \ - CS2_PW="changeme" \ CS2_MAPGROUP="mg_active" \ CS2_STARTMAP="de_inferno" \ CS2_GAMEALIAS="" \ diff --git a/bookworm/etc/entry.sh b/bookworm/etc/entry.sh index f1f75e8..bf019fb 100644 --- a/bookworm/etc/entry.sh +++ b/bookworm/etc/entry.sh @@ -35,7 +35,7 @@ fi # Download and extract custom config bundle if [[ ! -z $CS2_CFG_URL ]]; then echo "Downloading config pack from ${CS2_CFG_URL}" - + TEMP_DIR=$(mktemp -d) TEMP_FILE="${TEMP_DIR}/$(basename ${CS2_CFG_URL})" wget -qO "${TEMP_FILE}" "${CS2_CFG_URL}" @@ -135,6 +135,10 @@ if [[ ! -z $CS2_HOST_WORKSHOP_MAP ]]; then CS2_HOST_WORKSHOP_MAP_ARGS="+host_workshop_map ${CS2_HOST_WORKSHOP_MAP}" fi +if [[ ! -z $CS2_PW ]]; then + CS2_PW_ARGS="+sv_password ${CS2_PW}" +fi + # Start Server if [[ ! -z $CS2_RCON_PORT ]]; then @@ -156,7 +160,7 @@ eval "./cs2" -dedicated \ "${CS2_MP_MATCH_END_CHANGELEVEL}" \ +rcon_password "${CS2_RCONPW}" \ "${SV_SETSTEAMACCOUNT_ARGS}" \ - +sv_password "${CS2_PW}" \ + "${CS2_PW_ARGS}" \ +sv_lan "${CS2_LAN}" \ +tv_port "${TV_PORT}" \ "${CS2_ADDITIONAL_ARGS}" diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index af3b257..8997463 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -13,7 +13,7 @@ services: - 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.) - CS2_LAN=0 # (0 - LAN mode disabled, 1 - LAN Mode enabled) - CS2_RCONPW=changeme # (RCON password) - - CS2_PW=changeme # (CS2 server password) + - CS2_PW # (Optional, CS2 server password) - CS2_MAXPLAYERS=10 # (Max players) - CS2_ADDITIONAL_ARGS # (Optional additional arguments to pass into cs2) - CS2_CFG_URL # HTTP/HTTPS URL to fetch a Tar Gzip bundle, Tar or Zip archive of configuration files/mods From 2419f0741fdc6d3cb0e320b74719de6326ff3777 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Fri, 24 Jan 2025 21:14:51 +0000 Subject: [PATCH 109/113] Fix: Update failure fix suggestion from jithatsonei --- bookworm/etc/entry.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bookworm/etc/entry.sh b/bookworm/etc/entry.sh index bf019fb..f78af1c 100644 --- a/bookworm/etc/entry.sh +++ b/bookworm/etc/entry.sh @@ -12,6 +12,7 @@ else fi eval bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ + +@bClientTryRequestManifestWithoutCode 1 \ +login anonymous \ +app_update "${STEAMAPPID}" "${VALIDATE}"\ +quit From d9bea078414156b7b86738298987be02922683f2 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sun, 9 Feb 2025 19:36:21 +0000 Subject: [PATCH 110/113] Add DEBUG variable to control logging verbosity --- README.md | 8 ++++++++ bookworm/etc/entry.sh | 18 ++++++++++++++++-- examples/docker-compose.yml | 1 + 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b598655..7746484 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,14 @@ ds_workshop_changelevel $map_name # Customizing this Container +## Debug Logging + +If you want to increase the verbosity of log output set the `DEBUG` environment variable: + +```dockerfile +DEBUG=0 (0=none, 1=steamcmd, 2=cs2, 3=all) +``` + ## Validating Game Files If you break the game through your customisations and want steamcmd to validate and redownload then set the `STEAMAPPVALIDATE` environment variable to `1`: diff --git a/bookworm/etc/entry.sh b/bookworm/etc/entry.sh index f78af1c..a2a1f51 100644 --- a/bookworm/etc/entry.sh +++ b/bookworm/etc/entry.sh @@ -1,17 +1,31 @@ #!/bin/bash +# Debug + +## Steamcmd debugging +if [[ $DEBUG -eq 1 ]] || [[ $DEBUG -eq 3 ]]; then + STEAMCMD_SPEW="+set_spew_level 4 4" +fi +## CS2 server debugging +if [[ $DEBUG -eq 2 ]] || [[ $DEBUG -eq 3 ]]; then + CS2_LOG="on" + CS2_LOG_MONEY=1 + CS2_LOG_DETAIL=3 + CS2_LOG_ITEMS=1 +fi + # Create App Dir mkdir -p "${STEAMAPPDIR}" || true # Download Updates - if [[ "$STEAMAPPVALIDATE" -eq 1 ]]; then VALIDATE="validate" else VALIDATE="" fi -eval bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \ +eval bash "${STEAMCMDDIR}/steamcmd.sh" "${STEAMCMD_SPEW}"\ + +force_install_dir "${STEAMAPPDIR}" \ +@bClientTryRequestManifestWithoutCode 1 \ +login anonymous \ +app_update "${STEAMAPPID}" "${VALIDATE}"\ diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 8997463..724ce99 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -5,6 +5,7 @@ services: environment: # Server configuration - SRCDS_TOKEN # Game Server Token from https://steamcommunity.com/dev/managegameservers + - DEBUG=0 # (0 - off, 1 - steamcmd, 2 - cs2, 3 - all) - STEAMAPPVALIDATE=0 # (0 - no validation, 1 - enable validation) - CS2_SERVERNAME=changeme # (Set the visible name for your private server) - CS2_CHEATS=0 # (0 - disable cheats, 1 - enable cheats) From 7d72ca4125f5c6596ce3302ef9d016bdb6b6a1ca Mon Sep 17 00:00:00 2001 From: John Edwards Date: Wed, 19 Feb 2025 19:55:18 +0000 Subject: [PATCH 111/113] Add success checking to steamcmd command --- bookworm/etc/entry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookworm/etc/entry.sh b/bookworm/etc/entry.sh index a2a1f51..b022e4a 100644 --- a/bookworm/etc/entry.sh +++ b/bookworm/etc/entry.sh @@ -29,7 +29,7 @@ eval bash "${STEAMCMDDIR}/steamcmd.sh" "${STEAMCMD_SPEW}"\ +@bClientTryRequestManifestWithoutCode 1 \ +login anonymous \ +app_update "${STEAMAPPID}" "${VALIDATE}"\ - +quit + +quit || exit $? # steamclient.so fix mkdir -p ~/.steam/sdk64 From c225ca3f01afde6f40094528784f14666af08469 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Wed, 19 Feb 2025 22:18:42 +0000 Subject: [PATCH 112/113] Fix \#142: New steamcmd error handling --- bookworm/etc/entry.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/bookworm/etc/entry.sh b/bookworm/etc/entry.sh index b022e4a..6ec2427 100644 --- a/bookworm/etc/entry.sh +++ b/bookworm/etc/entry.sh @@ -24,12 +24,32 @@ else VALIDATE="" fi -eval bash "${STEAMCMDDIR}/steamcmd.sh" "${STEAMCMD_SPEW}"\ +## SteamCMD can fail to download +## Retry logic +MAX_ATTEMPTS=3 +attempt=0 +while [[ $steamcmd_rc != 0 ]] && [[ $attempt -lt $MAX_ATTEMPTS ]]; do + ((attempt+=1)) + if [[ $attempt -gt 1 ]]; then + echo "Retrying SteamCMD, attempt ${attempt}" + # Stale appmanifest data can lead for HTTP 401 errors when requesting old + # files from SteamPipe CDN + echo "Removing steamapps (appmanifest data)..." + rm -rf "${STEAMAPPDIR}/steamapps" + fi + eval bash "${STEAMCMDDIR}/steamcmd.sh" "${STEAMCMD_SPEW}"\ +force_install_dir "${STEAMAPPDIR}" \ +@bClientTryRequestManifestWithoutCode 1 \ +login anonymous \ +app_update "${STEAMAPPID}" "${VALIDATE}"\ - +quit || exit $? + +quit + steamcmd_rc=$? +done + +## Exit if steamcmd fails +if [[ $steamcmd_rc != 0 ]]; then + exit $steamcmd_rc +fi # steamclient.so fix mkdir -p ~/.steam/sdk64 From 4cfa6d653be7aaf2ed5bca6ef45c4761f121472f Mon Sep 17 00:00:00 2001 From: Astra Date: Wed, 19 Mar 2025 14:55:55 +0000 Subject: [PATCH 113/113] Update files --- .gitignore | 2 +- README.md | 54 ++++++++++++++++++++----------------------- bookworm/Dockerfile | 6 ++++- bookworm/etc/entry.sh | 36 ++++++++++++++--------------- 4 files changed, 48 insertions(+), 50 deletions(-) diff --git a/.gitignore b/.gitignore index 485dee6..80cf615 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -.idea +.cs2.env diff --git a/README.md b/README.md index 7746484..484c1aa 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,51 @@ -[![Docker Image CI](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml/badge.svg?branch=main)](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml) [![Docker Build and Publish](https://github.com/joedwards32/CS2/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/joedwards32/CS2/actions/workflows/docker-publish.yml) - # What is Counter-Strike 2? -For over two decades, Counter-Strike has offered an elite competitive experience, one shaped by millions of players from across the globe. And now the next chapter in the CS story is about to begin. This is Counter-Strike 2. +For over two decades, Counter-Strike has offered an elite competitive experience, one shaped by millions of players from across the globe. And now the next chapter in the CS story is about to begin. This is [Counter-Strike 2](https://store.steampowered.com/app/730/CounterStrike_2/). This Docker image contains the dedicated server of the game. -> [CS2](https://store.steampowered.com/app/730/CounterStrike_2/) - -logo +logo # How to use this image ## Hosting a simple game server -Running using Docker: +Running on the *host* interface (recommended):
```console -$ SRCDS_TOKEN="..." # check https://steamcommunity.com/dev/managegameservers -$ docker run -d --name=cs2 -e SRCDS_TOKEN="$SRCDS_TOKEN" -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/udp joedwards32/cs2 +$ docker run -d --net=host --name=cs2 -e STEAMUSER={YOUR_STEAM_USER} -e STEAMPASS={YOUR_STEAM_PASSWD} git.zio.sh/astra/cs2:latest ``` Running using a bind mount for data persistence on container recreation: ```console $ mkdir -p $(pwd)/cs2-data -$ chown 1000:1000 $(pwd)/cs2-data # Makes sure the directory is writeable by the unprivileged container user with uid 1000, known as steam -$ SRCDS_TOKEN="..." # check https://steamcommunity.com/dev/managegameservers -$ docker run -d --name=cs2 -e SRCDS_TOKEN="$SRCDS_TOKEN" -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/udp joedwards32/cs2 +$ chmod 777 $(pwd)/cs2-data # Makes sure the directory is writeable by the unprivileged container user +$ docker run -d \ + --net=host \ + -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ \ + --name=cs2-dedicated \ + -e STEAMUSER= \ + -e STEAMPASS= \ + git.zio.sh/astra/cs2:latest ``` -or using docker-compose, see [examples](https://github.com/joedwards32/CS2/blob/main/examples/docker-compose.yml): -```console -# Remember to update passwords and SRCDS_TOKEN in your compose file -$ docker compose --file examples/docker-compose.yml up -d cs2-server -``` +`STEAMUSER` and `STEAMPASS` **are required as unlike CS:GO, CS2 can not be downloaded anonymously (at time of writing).** -You must have at least **40GB** of free disk space! See [System Requirements](./#system-requirements). +`STEAMGUARD` **must be used to provide your more recent Steam Guard key if Steam Guard is enabled on your account.** **The container will automatically update the game on startup, so if there is a game update just restart the container.** # Configuration ## System Requirements - -Minimum system requirements are: - -* 2 CPUs -* 2GiB RAM -* 40GB of disk space for the container or mounted as a persistent volume on `/home/steam/cs2-dedicated/` +Please note that you need approximately 1.5g of free RAM. If this is not available, container will crash with err 137. ## Environment Variables -Feel free to overwrite these environment variables, using -e (--env): +Feel free to overwrite these environment variables, using -e (--env) or --env-file (recommended): + +### SteamCMD + +```dockerfile +STEAMUSER="changeme" (Steam User for SteamCMD.) +STEAMPASS="changeme" (Password for Steam User.) +STEAMGUARD="" (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.) +``` ### Server Configuration @@ -63,7 +62,7 @@ CS2_RCON_PORT="" (Optional, use a simple TCP proxy to have RCON liste Useful for services like AWS Fargate which do not support mixed protocol ports.) CS2_LAN="0" (0 - LAN mode disabled, 1 - LAN Mode enabled) CS2_RCONPW="changeme" (RCON password) -CS2_PW="" (Optional, CS2 server password) +CS2_PW="changeme" (Optional, CS2 server password) CS2_MAXPLAYERS=10 (Max players) CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2) ``` @@ -179,9 +178,6 @@ The container can be instructed to download a extract a Tar Gzip bundle, Tar or CS2_CFG_URL="" (HTTP/HTTPS URL to fetch a Tar Gzip bundle, Tar or Zip archive of configuration files/mods) ``` -See [examples](https://github.com/joedwards32/CS2/blob/main/examples/cs2.cfg.tgz) for a correctly formatted Tar Gzip customisation bundle, the same format applies to all archive types. - - # 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/bookworm/Dockerfile b/bookworm/Dockerfile index 189dcd4..f89ff66 100644 --- a/bookworm/Dockerfile +++ b/bookworm/Dockerfile @@ -6,7 +6,7 @@ FROM cm2network/steamcmd:root-bookworm as build_stage -LABEL maintainer="joedwards32@gmail.com" +LABEL maintainer="astra@zio.sh" ENV STEAMAPPID 730 ENV STEAMAPP cs2 @@ -20,8 +20,10 @@ COPY etc/post.sh "/etc/post.sh" RUN set -x \ # Install, update & upgrade packages + && dpkg --add-architecture i386 \ && apt-get update \ && apt-get install -y --no-install-recommends --no-install-suggests \ + libcurl4:i386 \ wget \ ca-certificates \ lib32z1 \ @@ -29,10 +31,12 @@ RUN set -x \ libicu-dev \ unzip \ jq \ + patch \ && mkdir -p "${STEAMAPPDIR}" \ # Add entry script && chmod +x "${HOMEDIR}/entry.sh" \ && chown -R "${USER}:${USER}" "${HOMEDIR}/entry.sh" "${STEAMAPPDIR}" \ + && chmod +x /etc/post.sh /etc/pre.sh \ # Clean up && apt-get clean \ && find /var/lib/apt/lists/ -type f -delete diff --git a/bookworm/etc/entry.sh b/bookworm/etc/entry.sh index 6ec2427..a88f9fb 100644 --- a/bookworm/etc/entry.sh +++ b/bookworm/etc/entry.sh @@ -100,32 +100,30 @@ fi # Rewrite Config Files -sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \ - -e "s/{{SERVER_CHEATS}}/${CS2_CHEATS}/g" \ - -e "s/{{SERVER_HIBERNATE}}/${CS2_SERVER_HIBERNATE}/g" \ - -e "s/{{SERVER_PW}}/${CS2_PW}/g" \ - -e "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/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" \ - -e "s/{{TV_MAXRATE}}/${TV_MAXRATE}/g" \ - -e "s/{{TV_DELAY}}/${TV_DELAY}/g" \ - -e "s/{{SERVER_LOG}}/${CS2_LOG}/g" \ - -e "s/{{SERVER_LOG_MONEY}}/${CS2_LOG_MONEY}/g" \ - -e "s/{{SERVER_LOG_DETAIL}}/${CS2_LOG_DETAIL}/g" \ - -e "s/{{SERVER_LOG_ITEMS}}/${CS2_LOG_ITEMS}/g" \ +sed -r -i -e "s/^(hostname) .*/\1 ${CS2_SERVERNAME}/g" \ + -e "s/^(sv_cheats) .*/\1 ${CS2_CHEATS}/g" \ + -e "s/^(sv_hibernate_when_empty) .*/\1 ${CS2_SERVER_HIBERNATE}/g" \ + -e "s/^(sv_password) .*/\1 ${CS2_PW}/g" \ + -e "s/^(rcon_password) .*/\1 ${CS2_RCONPW}/g" \ + -e "s/^(tv_enable) .*/\1 ${TV_ENABLE}/g" \ + -e "s/^(tv_port) .*/\1 ${TV_PORT}/g" \ + -e "s/^(tv_autorecord) .*/\1 ${TV_AUTORECORD}/g" \ + -e "s/^(tv_password) .*/\1 ${TV_PW}/g" \ + -e "s/^(tv_relaypassword) .*/\1 ${TV_RELAY_PW}/g" \ + -e "s/^(tv_maxrate) .*/\1 ${TV_MAXRATE}/g" \ + -e "s/^(tv_delay) .*/\1 ${TV_DELAY}/g" \ + -e "s/^(tv_name) .*/\1 ${CS2_SERVERNAME} CSTV/g" \ + -e "s/^(tv_title) .*/\1${CS2_SERVERNAME} CSTV/g" \ "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then - sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/* + sed -r -i "s/^(bot_difficulty) .*/\1 ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi if [[ ! -z $CS2_BOT_QUOTA ]] ; then - sed -ri "s/bot_quota[[:space:]]+.*/bot_quota ${CS2_BOT_QUOTA}/" "${STEAMAPPDIR}"/game/csgo/cfg/* + sed -r -i "s/^(bot_quota) .*/\1 ${CS2_BOT_QUOTA}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi if [[ ! -z $CS2_BOT_QUOTA_MODE ]] ; then - sed -i "s/bot_quota_mode.*/bot_quota_mode ${CS2_BOT_QUOTA_MODE}/" "${STEAMAPPDIR}"/game/csgo/cfg/* + sed -r -i "s/^(bot_quota_mode) .*/\1 ${CS2_BOT_QUOTA_MODE}/" "${STEAMAPPDIR}"/game/csgo/cfg/* fi # Switch to server directory