+ added hostname, password, voiceenabled options
This commit is contained in:
parent
b9b1a01c3f
commit
9ebcd4f3a8
@ -10,6 +10,10 @@ ENV STEAM_PATH="/home/steam" \
|
||||
DOCKER_USER=steam \
|
||||
\
|
||||
WORKSHOP_COLLECTION_ID= \
|
||||
SERVER_NAME="" \
|
||||
SERVER_PASSWORD="" \
|
||||
SERVER_VOICE_ENABLE="1" \
|
||||
\
|
||||
INSTALL_CSS=false \
|
||||
INSTALL_HL2=false \
|
||||
INSTALL_HLDM=false \
|
||||
|
14
README.md
14
README.md
@ -3,22 +3,25 @@ GMOD TTT server image, https://hub.docker.com/r/jusito/
|
||||
|
||||
## TODO
|
||||
- use readme template
|
||||
- create script which adds all workshop donwloads to lua (arg host_workshop_collection)
|
||||
- \lua\autorun\server\workshop.lua, resource.AddWorkshop( "943738100" )
|
||||
- force cleanup of downloaded elements => removed workshop elements are otherwise used
|
||||
|
||||
## run example
|
||||
```
|
||||
docker run -d -p 27015:27015/tcp -p 27015:27015/udp -e WORKSHOP_COLLECTION_ID=123456 -e INSTALL_CSS=true "jusito/docker-ttt" +host_workshop_collection 123456 +map ttt_rooftops_2016_v1 -maxplayers 16 -hostname "New Server"
|
||||
docker run -d -p 27015:27015/tcp -p 27015:27015/udp -e WORKSHOP_COLLECTION_ID=123456 -e INSTALL_CSS=true "jusito/docker-ttt" +host_workshop_collection 123456 +map ttt_rooftops_2016_v1 -maxplayers
|
||||
```
|
||||
-d exit if entrypoint exits
|
||||
tcp port for rcon
|
||||
tcp port for rcon, if you want to use it start with -usercon +rcon_password "yourPW"
|
||||
udp port for game traffic
|
||||
|
||||
## environment variables
|
||||
If set every workshop item at the collection is added as forced, that means its automatically downloaded on connecting. Don't add collections with maps here just like weapons aso.
|
||||
WORKSHOP_COLLECTION_ID=
|
||||
|
||||
This variables are used to write the value to the server.cfg:
|
||||
SERVER_NAME=""
|
||||
SERVER_PASSWORD=""
|
||||
SERVER_VOICE_ENABLE="1"
|
||||
|
||||
If set to "true" the game is installed and mounted, most of the time you want to add the css content.
|
||||
INSTALL_CSS=false
|
||||
INSTALL_HL2=false
|
||||
@ -27,7 +30,8 @@ INSTALL_TF2=false
|
||||
|
||||
## server config
|
||||
http://ttt.badking.net/config-and-commands/convars
|
||||
https://wiki.garrysmod.de/server.cfg
|
||||
|
||||
Path in container is:
|
||||
docker cp "your server.cfg path" CONTAINER:/home/steam/server/garrysmod/cfg/server.cfg
|
||||
docker cp "your server.cfg path" CONTAINER:/home/steam/serverfiles/garrysmod/cfg/server.cfg
|
||||
|
||||
|
@ -2,13 +2,43 @@
|
||||
|
||||
set -e
|
||||
|
||||
function configReplace() {
|
||||
source="$1"
|
||||
target="$source \"$2\""
|
||||
count=$(grep -Po "($source).+" "${SERVER_PATH}/garrysmod/cfg/server.cfg" | wc -l)
|
||||
|
||||
echo "Request for replacing $source to $target, source is found $count times"
|
||||
|
||||
if [ "$count" == "1" ]; then
|
||||
source=$(grep -Po "($source).+" "${SERVER_PATH}/garrysmod/cfg/server.cfg" | sed 's/\\/\\\\/g' | sed 's/\//\\\//g')
|
||||
target=$(echo "$target" | sed 's/\\/\\\\/g' | sed 's/\//\\\//g')
|
||||
sed -i "s/$source/$target/g" "${SERVER_PATH}/garrysmod/cfg/server.cfg"
|
||||
elif [ "$count" == "0" ]; then
|
||||
echo "" >> "${SERVER_PATH}/garrysmod/cfg/server.cfg"
|
||||
echo "$target" >> "${SERVER_PATH}/garrysmod/cfg/server.cfg"
|
||||
else
|
||||
echo "can't set $1 because there are multiple in"
|
||||
fi
|
||||
}
|
||||
|
||||
#create default server.config
|
||||
# not empty: grep -q '[^[:space:]]' < 'server.cfg' && echo "not empty"
|
||||
if [ ! -e "${SERVER_PATH}/garrysmod/cfg/server.cfg" ] || [ "0" = "$(grep -o '[^[:space:]]' "${SERVER_PATH}/garrysmod/cfg/server.cfg" | wc -l)" ]; then
|
||||
mkdir -p "${SERVER_PATH}/garrysmod/cfg"
|
||||
wget -O "${SERVER_PATH}/garrysmod/cfg/server.cfg" "https://raw.githubusercontent.com/jusito/docker-ttt/master/server.cfg"
|
||||
chown "$USER_ID:$GROUP_ID" "${SERVER_PATH}/garrysmod/cfg/server.cfg"
|
||||
chmod u+rw "${SERVER_PATH}/garrysmod/cfg/server.cfg"
|
||||
fi
|
||||
|
||||
#set hostname & password, working if only one entry is in
|
||||
if [ -n "${SERVER_NAME}" ]; then
|
||||
configReplace "hostname" "$SERVER_NAME"
|
||||
fi
|
||||
if [ -n "${SERVER_PASSWORD}" ]; then
|
||||
configReplace "sv_password" "$SERVER_PASSWORD"
|
||||
fi
|
||||
if [ -n "${SERVER_VOICE_ENABLE}" ]; then
|
||||
configReplace "sv_voiceenable" "$SERVER_VOICE_ENABLE"
|
||||
fi
|
||||
|
||||
#this is a simple option for myself, but you can use it too
|
||||
|
@ -1,7 +1,10 @@
|
||||
// server name
|
||||
hostname "New Server"
|
||||
hostname ""
|
||||
sv_password ""
|
||||
sv_voiceenable 0
|
||||
|
||||
sv_contact "unknown"
|
||||
|
||||
|
||||
// rcon passsword
|
||||
sv_rcon_banpenalty 5
|
||||
sv_rcon_maxfailures 3
|
||||
|
Loading…
Reference in New Issue
Block a user