diff --git a/.project b/.project deleted file mode 100644 index f64b954..0000000 --- a/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - docker-ttt - - - - - - - - diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5b5050d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -services: - - docker - -script: - - docker build -t "jusito/docker-ttt:develop" . - - docker volume create TTT - - docker run -d -P -e INSTALL_CSS=true -e WORKSHOP_COLLECTION_ID=899062542 --name "TTT" -p 27015:27015/tcp -p 27015:27015/udp -v "TTT:/home/steam/server:rw" \ - "jusito/docker-ttt:develop" "testing" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 1a10977..9a66718 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,39 +6,23 @@ ENV STEAM_PATH="/home/steam" \ SERVER_PATH="/home/steam/server" \ GROUP_ID=10000 \ USER_ID=10000 \ - DOCKER_USER=steam \ - \ - WORKSHOP_COLLECTION_ID= \ - INSTALL_CSS=false \ - INSTALL_HL2=false \ - INSTALL_HLDM=false \ - INSTALL_TF2=false \ - \ - CSS_PATH="/home/steam/addons/css" \ - HL2_PATH="/home/steam/addons/hl2" \ - HLDM_PATH="/home/steam/addons/hldm" \ - TF2_PATH="/home/steam/addons/tf2" \ - \ - USE_MY_REPLACER_CONFIG=false + DOCKER_USER=steam ENTRYPOINT ["./home/entrypoint.sh"] -COPY ["entrypoint.sh", "installAndMountAddons.sh", "forceWorkshopDownload.sh", "experimental.sh", "/home/"] +COPY ["entrypoint.sh", "/home/"] # removed dep. lib32gcc1 libtcmalloc-minimal4:i386 gdb RUN dpkg --add-architecture i386 && \ apt-get update -y && \ - apt-get install -y wget tar gzip ca-certificates lib32stdc++6 lib32tinfo5 \ - lib32gcc1 libtcmalloc-minimal4:i386 gdb && \ + apt-get install -y wget tar gzip ca-certificates lib32stdc++6 \ + \ groupadd -g $GROUP_ID $DOCKER_USER && \ useradd -d /home/steam/ -g $GROUP_ID -u $USER_ID -m $DOCKER_USER && \ chown "$DOCKER_USER:$DOCKER_USER" /home/entrypoint.sh && \ mkdir -p "$SERVER_PATH" && \ chown -R "$DOCKER_USER:$DOCKER_USER" "$STEAM_PATH" && \ chmod a=rx /home/entrypoint.sh && \ - chmod a=rx /home/installAndMountAddons.sh && \ - chmod a=rx /home/forceWorkshopDownload.sh && \ - chmod a=rx /home/experimental.sh && \ ulimit -n 2048 && \ \ locale-gen en_US.UTF-8 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index a6e2b23..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 jusito - -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 deleted file mode 100644 index b2ef4d1..0000000 --- a/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# docker-ttt -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" -``` --d exit if entrypoint exits -tcp port for rcon -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= - -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 -INSTALL_HLDM=false -INSTALL_TF2=false - -## server config -http://ttt.badking.net/config-and-commands/convars - -Path in container is: -docker cp "your server.cfg path" CONTAINER:/home/steam/server/garrysmod/cfg/server.cfg - diff --git a/entrypoint.sh b/entrypoint.sh index a0d54aa..9c26497 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,64 +3,21 @@ echo "starting entrypoint.sh" set -e -DEBUG_MODE=false -if [ "$1" = "testing" ]; then - DEBUG_MODE=true -fi - echo "installing / updating steamcmd in $STEAM_PATH" cd "$STEAM_PATH" wget -q -O - "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar -zxvf - -if [ -e "${STEAM_PATH}/server/steam_cache" ]; then - echo "clearing steam cache" - rm -rf "${STEAM_PATH}/server/steam_cache/" -fi -if [ -e "${STEAM_PATH}/server/garrysmod/cache" ]; then - echo "clearing cache" - rm -rf "${STEAM_PATH}/server/garrysmod/cache/*" -fi - echo "testing steamcmd" -chmod ug=rwx,o= steamcmd.sh ./steamcmd.sh -noasync +login anonymous +quit echo "installing / validating ttt" cd "$STEAM_PATH" -./steamcmd.sh -noasync +login anonymous +force_install_dir "$STEAM_PATH/server/" +app_update 4020 validate +quit || \ - (echo '[error][1] catched => printing stderr.txt:' && \ - cat "Steam/logs/stderr.txt" && \ - echo '[error][1] <= printed' && \ - ./steamcmd.sh -noasync +login anonymous +force_install_dir "$STEAM_PATH/server/" +app_update 4020 validate +quit) || \ - (echo '[error][2] catched => printing stderr.txt:' && \ - cat "Steam/logs/stderr.txt" && \ - echo '[error][2] <= printed' && \ - ./steamcmd.sh -noasync +login anonymous +force_install_dir "$STEAM_PATH/server/" +app_update 4020 validate +quit) - -echo "processing scripts before start" - -echo "experimental.sh" -bash /home/experimental.sh -#echo "forceWorkshopDownload.sh" -#bash /home/forceWorkshopDownload.sh -#echo "installAndMountAddons.sh" -#bash /home/installAndMountAddons.sh - - -if [ -e "$SERVER_PATH/custom.sh" ]; then - echo "existing: $SERVER_PATH/custom.sh" - bash "$SERVER_PATH/custom.sh" -else - echo "not existing: $SERVER_PATH/custom.sh" -fi +./steamcmd.sh -noasync +login anonymous +force_install_dir "$STEAM_PATH/server/" +app_update 4020 validate +quit # todo catch => send killserver / quit cd "$STEAM_PATH/server/" trap 'pkill -15 srcds_run' SIGTERM -if [ "$DEBUG_MODE" != "true" ]; then - ./srcds_run -console -game garrysmod +gamemode terrortown "$@" & - wait "$!" -else - echo "debug ended" -fi \ No newline at end of file +#-console -game garrysmod +gamemode terrortown +./srcds_run "$@" & +wait "$!" \ No newline at end of file diff --git a/experimental.sh b/experimental.sh deleted file mode 100644 index bbad9ad..0000000 --- a/experimental.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -set -e - -#create default server.config -#TODO || [ cat "${SERVER_PATH}/garrysmod/cfg/server.cfg" ] check if empty (only whitespaces) -#TODO don't miss to change to master! -# 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/develop/server.cfg" -fi - -#this is a simple option for myself, but you can use it too -if [ "$USE_MY_REPLACER_CONFIG" = "true" ]; then - mkdir -p "${SERVER_PATH}/garrysmod/data/jusito_ttt_entity_replace" - wget -O "${SERVER_PATH}/garrysmod/data/jusito_ttt_entity_replace/config.txt" "https://raw.githubusercontent.com/jusito/ttt_entity_replace/master/config.txt.example_fas2" -fi - diff --git a/forceWorkshopDownload.sh b/forceWorkshopDownload.sh deleted file mode 100644 index 6e2c130..0000000 --- a/forceWorkshopDownload.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -set -e - -#using WORKSHOP_COLLECTION_ID -LUA_PATH="${SERVER_PATH}/garrysmod/lua/autorun/server" -LUA_FILE="${LUA_PATH}/workshop_autoload.lua" - -#remove old file -if [ -e "$LUA_FILE" ]; then - rm "$LUA_FILE" -else - mkdir -p "$LUA_PATH" -fi - -if [ "$WORKSHOP_COLLECTION_ID" = "0" ] || [ "$WORKSHOP_COLLECTION_ID" = "" ]; then - echo "given ID is default, no workshop download" -else - touch "$LUA_FILE" - arr="$(wget -q -O - https://steamcommunity.com/sharedfiles/filedetails/?id=${WORKSHOP_COLLECTION_ID} | tr '\n' ' ' | grep -Po '"workshopItem"[^"]+"https://steamcommunity.com/sharedfiles/filedetails/\?id=(\d+)' | grep -Po '\d\d\d+' )" - str="" - for i in ${arr[@]} - do - str=${str}"resource.AddWorkshop( \"${i}\" )"$'\n' - done - echo "$str" > "$LUA_FILE" -fi - diff --git a/installAndMountAddons.sh b/installAndMountAddons.sh deleted file mode 100644 index 91dc064..0000000 --- a/installAndMountAddons.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -set -e - -mount='"mountcfg"'$'\n{\n' -if [ "$INSTALL_CSS" = "true" ]; then - echo "installing & mounting css" - ./steamcmd.sh +login anonymous +force_install_dir "$CSS_PATH" +app_update 232330 validate +quit - mount=${mount}' "cstrike" "'"${CSS_PATH}/cstrike"$'"\n' - if [ "$INSTALL_HL2" != "true" ]; then - mount=${mount}' "hl2" "'"${CSS_PATH}/hl2"$'"\n' - fi -fi -if [ "$INSTALL_HL2" = "true" ]; then - echo "installing & mounting hl2" - ./steamcmd.sh +login anonymous +force_install_dir "$HL2_PATH" +app_update 232370 validate +quit - mount=${mount}' "hl2" "'"${HL2_PATH}/hl2"$'"\n' - mount=${mount}' "hl2mp" "'"${HL2_PATH}/hl2mp"$'"\n' -fi -if [ "$INSTALL_TF2" = "true" ]; then - echo "installing & mounting tf2" - ./steamcmd.sh +login anonymous +force_install_dir "$TF2_PATH" +app_update 232250 validate +quit - mount=${mount}' "tf2" "'"${TF2_PATH}/tf"$'"\n' - if [ "$INSTALL_CSS" != "true" ] && [ "$INSTALL_HL2" != "true" ]; then - mount=${mount}' "hl2" "'"${TF2_PATH}/hl2"$'"\n' - fi -fi -if [ "$INSTALL_HLDM" = "true" ]; then - echo "installing & mounting hldm" - ./steamcmd.sh +login anonymous +force_install_dir "$HLDM_PATH" +app_update 255470 validate +quit - mount=${mount}' "hl1" "'"${HLDM_PATH}/hl1"$'"\n' - mount=${mount}' "hldm" "'"${HLDM_PATH}/hldm"$'"\n' - if [ "$INSTALL_CSS" != "true" ] && [ "$INSTALL_HL2" != "true" ] && [ "$INSTALL_TF2" != "true" ]; then - mount=${mount}' "hl2" "'"${HLDM_PATH}/hl2"$'"\n' - fi -fi -mount=${mount}$'}\n' - - -if [ ! -e "${SERVER_PATH}/garrysmod/cfg" ]; then - mkdir -p "${SERVER_PATH}/garrysmod/cfg" -fi -if [ -e "${SERVER_PATH}/garrysmod/cfg/mount.cfg" ]; then - rm "${SERVER_PATH}/garrysmod/cfg/mount.cfg" -fi -touch "${SERVER_PATH}/garrysmod/cfg/mount.cfg" -echo "$mount" > "${SERVER_PATH}/garrysmod/cfg/mount.cfg" - diff --git a/server.cfg b/server.cfg deleted file mode 100644 index 0c5a0a0..0000000 --- a/server.cfg +++ /dev/null @@ -1,98 +0,0 @@ -// server name -hostname "New Server" -sv_contact "unknown" - -// rcon passsword -sv_rcon_banpenalty 5 -sv_rcon_maxfailures 3 - -//DNA -ttt_killer_dna_range 300 -ttt_killer_dna_basetime 100 - - -//Prep -ttt_firstpreptime 60 -ttt_preptime_seconds 30 -ttt_posttime_seconds 3 - - -//Round length -ttt_haste 0 -// ttt_haste_starting_minutes 5 -// ttt_haste_minutes_per_death 0.5 - -ttt_roundtime_minutes 10 - - - -//Map Switching -ttt_round_limit 10 -ttt_time_limit_minutes 75 - -//ttt_always_use_mapcycle 0 - - -//Player Counts -ttt_minimum_players 2 -ttt_traitor_pct 0.4 -ttt_traitor_max 32 -ttt_detective_pct 0.1 -ttt_detective_max 32 -ttt_detective_min_players 6 -ttt_detective_karma_min 600 - - -//Karma -ttt_karma 1 -ttt_karma_strict 1 -ttt_karma_starting 1000 -ttt_karma_max 1000 -ttt_karma_ratio 0.001 -ttt_karma_kill_penalty 50 -ttt_karma_round_increment 5 -ttt_karma_clean_bonus 30 -ttt_karma_traitordmg_ratio 0.0003 -ttt_karma_traitorkill_bonus 100 -ttt_karma_low_autokick 1 -ttt_karma_low_amount 300 -ttt_karma_low_ban 0 -ttt_karma_low_ban_minutes 60 -ttt_karma_persist 1 -ttt_karma_clean_half 0.25 - -//Other -ttt_postround_dm 0 -ttt_no_nade_throw_during_prep 0 -ttt_weapon_carrying 1 -ttt_weapon_carrying_range 50 -ttt_teleport_telefrags 1 -ttt_ragdoll_pinning 1 -ttt_ragdoll_pinning_innocents 1 -ttt_use_weapon_spawn_scripts 1 -ttt_spawn_wave_interval 2 -ttt_allow_discomb_jump 1 -ttt_debug_preventwin 0 - -// server logging -log on -sv_logbans 1 -sv_logecho 1 -sv_logfile 0 -sv_log_onefile 0 - -// operation -sv_lan 0 -sv_region 3 //Europa - -// traitor -ttt_credits_detectivekill 2 -ttt_credits_award_repeat 0.5 - -// fastdl -sv_allowdownload 1 -sv_allowupload 0 -// sv_downloadurl "your url" - -exec banned_user.cfg -exec banned_ip.cfg \ No newline at end of file