Merge pull request #69 from joedwards32/fetch_customisations_from_url

Fetch customisations from url
This commit is contained in:
John Edwards 2023-12-07 17:03:46 +00:00 committed by GitHub
commit 30fb7aa77d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 12 deletions

View file

@ -49,7 +49,7 @@ Feel free to overwrite these environment variables, using -e (--env):
### Server Configuration ### Server Configuration
```dockerfile ```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_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_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_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. 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 # 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! This container leans heavily on the work of [CM2Walki](https://github.com/CM2Walki/), especially his [SteamCMD](https://github.com/CM2Walki/steamcmd) container image. GG!

View file

@ -11,7 +11,6 @@ LABEL maintainer="joedwards32@gmail.com"
ENV STEAMAPPID 730 ENV STEAMAPPID 730
ENV STEAMAPP cs2 ENV STEAMAPP cs2
ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated" 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/entry.sh "${HOMEDIR}/entry.sh"
COPY etc/server.cfg "/etc/server.cfg" COPY etc/server.cfg "/etc/server.cfg"
@ -60,6 +59,7 @@ ENV CS2_SERVERNAME="cs2 private server" \
TV_MAXRATE=0 \ TV_MAXRATE=0 \
TV_DELAY=0 \ TV_DELAY=0 \
SRCDS_TOKEN="" \ SRCDS_TOKEN="" \
CS2_CFG_URL="" \
CS2_ADDITIONAL_ARGS="" CS2_ADDITIONAL_ARGS=""
# Set permissions on STEAMAPPDIR # Set permissions on STEAMAPPDIR

View file

@ -16,6 +16,23 @@ ln -sfT ${STEAMCMDDIR}/linux64/steamclient.so ~/.steam/sdk64/steamclient.so
# Install server.cfg # Install server.cfg
cp /etc/server.cfg "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg cp /etc/server.cfg "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg
# Install hooks if they don't already exist
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
echo "Downloading config pack from ${CS2_CFG_URL}"
wget -qO- "${CS2_CFG_URL}" | tar xvzf - -C "${STEAMAPPDIR}"
fi
# Rewrite Config Files
sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \ sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \
-e "s/{{SERVER_PW}}/${CS2_PW}/g" \ -e "s/{{SERVER_PW}}/${CS2_PW}/g" \
-e "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" \ -e "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" \
@ -28,16 +45,6 @@ sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \
-e "s/{{TV_DELAY}}/${TV_DELAY}/g" \ -e "s/{{TV_DELAY}}/${TV_DELAY}/g" \
"${STEAMAPPDIR}"/game/csgo/cfg/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
# Rewrite Config Files
if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then
sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/* sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/*
fi fi
@ -81,6 +88,7 @@ if [[ ! -z $CS2_RCON_PORT ]]; then
simpleproxy -L "${CS2_RCON_PORT}" -R 127.0.0.1:"${CS2_PORT}" & simpleproxy -L "${CS2_RCON_PORT}" -R 127.0.0.1:"${CS2_PORT}" &
fi fi
echo "Starting CS2 Dedicated Server"
eval "./cs2" -dedicated \ eval "./cs2" -dedicated \
"${CS2_IP_ARGS}" -port "${CS2_PORT}" \ "${CS2_IP_ARGS}" -port "${CS2_PORT}" \
-console \ -console \

BIN
examples/cs2.cfg.tgz Normal file

Binary file not shown.