From de9dc02dbd216cdde13dd4ac04e5faeed0694ad9 Mon Sep 17 00:00:00 2001 From: John Edwards Date: Sat, 11 Nov 2023 09:07:37 +0000 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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-o0c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