From 7c02ca8668b6a099d619111ccb5db0b16d82f54c Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Tue, 9 Nov 2021 23:21:02 +0100 Subject: [PATCH 001/116] + dependent dependency installation --- Dockerfile | 144 +++++++------------------- entrypoint.sh | 34 ------ scripts/cleanImage.sh | 12 +++ scripts/entrypoint.sh | 52 ++++++++++ scripts/installGosu.sh | 33 ++++++ scripts/installLGSM.sh | 11 ++ scripts/installMinimalDependencies.sh | 12 +++ scripts/setupUser.sh | 29 ++++++ 8 files changed, 189 insertions(+), 138 deletions(-) delete mode 100644 entrypoint.sh create mode 100644 scripts/cleanImage.sh create mode 100644 scripts/entrypoint.sh create mode 100644 scripts/installGosu.sh create mode 100644 scripts/installLGSM.sh create mode 100644 scripts/installMinimalDependencies.sh create mode 100644 scripts/setupUser.sh diff --git a/Dockerfile b/Dockerfile index 04839a0..b783997 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,109 +1,45 @@ -# -# LinuxGSM Dockerfile -# -# https://github.com/GameServerManagers/LinuxGSM-Docker -# +FROM ubuntu:18.04 as dependencyStage + +ENV GOSU_VERSION 1.14 +COPY scripts/installGosu.sh / +RUN set -eux; \ + ./installGosu.sh FROM ubuntu:18.04 LABEL maintainer="LinuxGSM " -ENV DEBIAN_FRONTEND noninteractive - -RUN set -ex; \ -apt-get update; \ -apt-get install -y locales; \ -rm -rf /var/lib/apt/lists/*; \ -localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 - -ENV LANG en_US.utf8 - -## Base System -RUN set -ex; \ -dpkg --add-architecture i386; \ -apt update -y; \ -apt install -y \ - vim \ - apt-transport-https \ - bc \ - binutils \ - bsdmainutils \ - bzip2 \ - ca-certificates \ - curl \ - default-jre \ - expect \ - file \ - gzip \ - iproute2 \ - jq \ - lib32gcc1 \ - lib32stdc++6 \ - lib32tinfo5 \ - lib32z1 \ - libcurl4-gnutls-dev:i386 \ - libdbus-glib-1-2:i386 \ - libglu1-mesa:i386 \ - libldap-2.4-2:i386 \ - libncurses5:i386 \ - libnm-glib-dev:i386 \ - libnm-glib4:i386 \ - libopenal1:i386 \ - libpulse0:i386 \ - libsdl1.2debian \ - libsdl2-2.0-0:i386 \ - libssl1.0.0:i386 \ - libstdc++5:i386 \ - libstdc++6 \ - libstdc++6:i386 \ - libtbb2 \ - libtcmalloc-minimal4:i386 \ - libusb-1.0-0:i386 \ - libxrandr2:i386 \ - libxtst6:i386 \ - mailutils \ - netcat \ - postfix \ - python \ - speex:i386 \ - telnet \ - tmux \ - unzip \ - util-linux \ - wget \ - xz-utils \ - zlib1g \ - zlib1g:i386; \ -apt-get clean; \ -rm -rf /var/lib/apt/lists/* - -## linuxgsm.sh -RUN set -ex; \ -wget https://linuxgsm.com/dl/linuxgsm.sh - -## user config -RUN set -ex; \ -groupadd -g 750 -o linuxgsm; \ -adduser --uid 750 --disabled-password --gecos "" --ingroup linuxgsm linuxgsm; \ -chown linuxgsm:linuxgsm /linuxgsm.sh; \ -chmod +x /linuxgsm.sh; \ -cp /linuxgsm.sh /home/linuxgsm/linuxgsm.sh; \ -usermod -G tty linuxgsm; \ -chown -R linuxgsm:linuxgsm /home/linuxgsm/; \ -chmod 755 /home/linuxgsm - -USER linuxgsm - -WORKDIR /home/linuxgsm - -VOLUME [ "/home/linuxgsm" ] - -# need use xterm for LinuxGSM -ENV TERM=xterm - -## Docker Details -ENV PATH=$PATH:/home/linuxgsm - -COPY entrypoint.sh /entrypoint.sh - -ENTRYPOINT ["bash","/entrypoint.sh" ] +COPY scripts/cleanImage.sh \ + scripts/entrypoint.sh \ + scripts/installLGSM.sh \ + scripts/installMinimalDependencies.sh \ + scripts/setupUser.sh \ + scripts/workaroundsLGSM.sh \ + /home/ +COPY --from=dependencyStage /usr/local/bin/gosu /usr/local/bin/gosu + +## changable +ARG LGSM_VERSION="v21.4.1" +ENV LGSM_VERSION="$LGSM_VERSION" \ + USER_ID="750" \ + GROUP_ID="750" + +## internal, dont change +ENV USER_NAME="linuxgsm" \ + LGSM_PATH="/home/linuxgsm" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US.UTF-8" \ + LC_ALL="en_US.UTF-8" \ + TERM="xterm" \ + PATH="$PATH:/home/linuxgsm" + +RUN set -eux; \ +cd /home/; \ +./installMinimalDependencies.sh; \ +./setupUser.sh; \ +./installLGSM.sh; \ +./cleanImage.sh + +VOLUME "$LGSM_PATH" +WORKDIR "$LGSM_PATH" +ENTRYPOINT ["bash","../entrypoint.sh" ] diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100644 index 5b4e2ac..0000000 --- a/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -## linuxgsm-docker base image entrypoint script -## execute LinuxGSM or arbitrary server commands at will -## by passing command - - -## Because of a limitation in LinuxGSM script it must be run from the directory -## It is installed in. -## -## If one wants to use a volume for the data directory, which is the home directory -## then we must keep a backup copy of the script on local drive -if [ ! -e ~/linuxgsm.sh ]; then - echo "Initializing Linuxgsm User Script in New Volume" - cp /linuxgsm.sh ./linuxgsm.sh -fi - -# with no command, just spawn a running container suitable for exec's -if [ $# = 0 ]; then - tail -f /dev/null -else - # execute the command passed through docker - "$@" - - # if this command was a server start cmd - # to get around LinuxGSM running everything in - # tmux; - # we attempt to attach to tmux to track the server - # this keeps the container running - # when invoked via docker run - # but requires -it or at least -t - tmux set -g status off && tmux attach 2> /dev/null -fi - -exec "$@" diff --git a/scripts/cleanImage.sh b/scripts/cleanImage.sh new file mode 100644 index 0000000..e43f041 --- /dev/null +++ b/scripts/cleanImage.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -o errexit +set -o nounset +echo "[cleanImage] cleaning image" + + +apt-get autoremove -y +apt-get clean -y +rm -rf /var/lib/apt/lists/* >> /dev/null 2>&1 || true +rm "/home/installMinimalDependencies.sh" \ + "/home/installLGSM.sh" >> /dev/null 2>&1 || true diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh new file mode 100644 index 0000000..f4f62e7 --- /dev/null +++ b/scripts/entrypoint.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +LGSM_SERVER="$1" +readonly LGSM_SERVER + +set -o errexit +set -o pipefail +set -o nounset + +cd "$LGSM_PATH" + +## linuxgsm-docker base image entrypoint script +## execute LinuxGSM or arbitrary server commands at will +## by passing command + +# uid / gid mod +# fix permissions +./../setupUser.sh + +## Because of a limitation in LinuxGSM script it must be run from the directory +## It is installed in. +## +## If one wants to use a volume for the data directory, which is the home directory +## then we must keep a backup copy of the script on local drive +if [ "$#" = "0" ]; then + echo "[entrypoint] please provide server as first argument" + exit 1 +elif [ ! -e ~/"$LGSM_SERVER" ]; then + echo "installing $LGSM_SERVER" + gosu "$USER_NAME" cp -f /home/linuxgsm.sh ./linuxgsm.sh + gosu "$USER_NAME" ./linuxgsm.sh "$LGSM_SERVER" + + # check if server can be installed + gosu "$USER_NAME" ./"$LGSM_SERVER" auto-install 2>&1 | tee auto-install.log + # if not probably dependencies are missing + IFS=';' cmds=($(grep 'sudo\s*dpkg' auto-install.log | sed -E 's/\s*sudo\s*//g' | sed 's/install/install -y /g')) + if [ "${#cmds[@]}" -gt "0" ]; then + # preselect answers for steam + echo steam steam/question select "I AGREE" | debconf-set-selections + echo steam steam/license note '' | debconf-set-selections + + # install dependencies + for cmd in "${cmds[@]}"; do + eval "DEBIAN_FRONTEND=noninteractive $cmd" + done + # retry + gosu "$USER_NAME" ./"$LGSM_SERVER" auto-install + fi + +fi + +exec gosu "$USER_NAME" ./"$LGSM_SERVER" "start" diff --git a/scripts/installGosu.sh b/scripts/installGosu.sh new file mode 100644 index 0000000..fbf7aa2 --- /dev/null +++ b/scripts/installGosu.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -o errexit +set -o pipefail +set -o nounset + +# save list of currently installed packages for later so we can clean up +savedAptMark="$(apt-mark showmanual)" +apt-get update +apt-get install -y --no-install-recommends ca-certificates wget +if ! command -v gpg; then + apt-get install -y --no-install-recommends gnupg2 dirmngr +elif gpg --version | grep -q '^gpg (GnuPG) 1\.'; then +# "This package provides support for HKPS keyservers." (GnuPG 1.x only) + apt-get install -y --no-install-recommends gnupg-curl +fi +rm -rf /var/lib/apt/lists/* + +dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" +wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" +wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" + +# verify the signature +export GNUPGHOME="$(mktemp -d)" +gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 +gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu +command -v gpgconf && gpgconf --kill all || : +rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc + +chmod +x /usr/local/bin/gosu +# verify that the binary works +gosu --version +gosu nobody true \ No newline at end of file diff --git a/scripts/installLGSM.sh b/scripts/installLGSM.sh new file mode 100644 index 0000000..7c4e9de --- /dev/null +++ b/scripts/installLGSM.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -o errexit +set -o nounset +echo "[installLGSM] installing LGSM" + +GROUP_NAME="$USER_NAME" + +wget "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/$LGSM_VERSION/linuxgsm.sh" +chown "$USER_NAME:$GROUP_NAME" linuxgsm.sh +chmod +x linuxgsm.sh diff --git a/scripts/installMinimalDependencies.sh b/scripts/installMinimalDependencies.sh new file mode 100644 index 0000000..ae1d736 --- /dev/null +++ b/scripts/installMinimalDependencies.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -o errexit +set -o nounset +echo "[installMinimalDependencies] installing ..." + +apt-get update +DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates wget locales curl +localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 + +# verify gosu is working +gosu nobody true diff --git a/scripts/setupUser.sh b/scripts/setupUser.sh new file mode 100644 index 0000000..ccf945b --- /dev/null +++ b/scripts/setupUser.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +set -o errexit +set -o nounset +GROUP_NAME="$USER_NAME" + +# if user doesn't exit +if ! id --user "$USER_ID" > /dev/null 2>&1; then + # create it + groupadd -g "$GROUP_ID" -o "$GROUP_NAME" + adduser --home "$LGSM_PATH" --uid "$USER_ID" --disabled-password --gecos "" --ingroup "$GROUP_NAME" "$USER_NAME" + usermod -G tty "$GROUP_NAME" + +# if user/group has incorrect id +elif [ "$(id --user "$USER_ID")" != "$USER_ID" ] || [ "$(id --group "$USER_ID")" != "$GROUP_ID" ]; then + echo "[setupUser] changing user id" + old_user_id="$(id --user "$USER_ID")" + usermod -u "$USER_ID" "$USER_NAME" + find / -uid "$old_user_id" -exec chown "$USER_NAME" "{}" \; + + echo "[setupUser] changing group id" + old_group_id="$(id --group "$USER_ID")" + groupmod -g "$GROUP_ID" "$GROUP_NAME" + find / -gid "$old_group_id" -exec chown ":$USER_NAME" "{}" \; +fi + +# enforce correct permissions +chown -R "$USER_NAME:$GROUP_NAME" "$LGSM_PATH" +chmod 755 "$LGSM_PATH" From 383e4cbba014ebe18a82345f63c0572419d176c8 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Tue, 9 Nov 2021 23:36:26 +0100 Subject: [PATCH 002/116] cleanup --- Dockerfile | 1 - scripts/cleanImage.sh | 4 +++- scripts/entrypoint.sh | 32 +++++++++++++++++++++----------- scripts/setupUser.sh | 23 ++++------------------- 4 files changed, 28 insertions(+), 32 deletions(-) diff --git a/Dockerfile b/Dockerfile index b783997..64adc49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,6 @@ COPY scripts/cleanImage.sh \ scripts/installLGSM.sh \ scripts/installMinimalDependencies.sh \ scripts/setupUser.sh \ - scripts/workaroundsLGSM.sh \ /home/ COPY --from=dependencyStage /usr/local/bin/gosu /usr/local/bin/gosu diff --git a/scripts/cleanImage.sh b/scripts/cleanImage.sh index e43f041..a6a0913 100644 --- a/scripts/cleanImage.sh +++ b/scripts/cleanImage.sh @@ -9,4 +9,6 @@ apt-get autoremove -y apt-get clean -y rm -rf /var/lib/apt/lists/* >> /dev/null 2>&1 || true rm "/home/installMinimalDependencies.sh" \ - "/home/installLGSM.sh" >> /dev/null 2>&1 || true + "/home/installLGSM.sh" \ + "/home/setupUser.sh" \ + "/home/cleanImage.sh" >> /dev/null 2>&1 || true diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index f4f62e7..e40cab7 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -13,18 +13,29 @@ cd "$LGSM_PATH" ## execute LinuxGSM or arbitrary server commands at will ## by passing command -# uid / gid mod -# fix permissions -./../setupUser.sh - -## Because of a limitation in LinuxGSM script it must be run from the directory -## It is installed in. -## -## If one wants to use a volume for the data directory, which is the home directory -## then we must keep a backup copy of the script on local drive +# check if uid / guid should be changed +GROUP_NAME="$USER_NAME" +if [ "$(id --user "$USER_ID")" != "$USER_ID" ] || [ "$(id --group "$USER_ID")" != "$GROUP_ID" ]; then + echo "[setupUser] changing user id" + old_user_id="$(id --user "$USER_ID")" + usermod -u "$USER_ID" "$USER_NAME" + find / -uid "$old_user_id" -exec chown "$USER_NAME" "{}" \; + + echo "[setupUser] changing group id" + old_group_id="$(id --group "$USER_ID")" + groupmod -g "$GROUP_ID" "$GROUP_NAME" + find / -gid "$old_group_id" -exec chown ":$USER_NAME" "{}" \; +fi + +# enforce correct permissions +chown -R "$USER_NAME:$GROUP_NAME" "$LGSM_PATH" +chmod 755 "$LGSM_PATH" + +# check if wished server is provided if [ "$#" = "0" ]; then echo "[entrypoint] please provide server as first argument" exit 1 +# check if server is already installed elif [ ! -e ~/"$LGSM_SERVER" ]; then echo "installing $LGSM_SERVER" gosu "$USER_NAME" cp -f /home/linuxgsm.sh ./linuxgsm.sh @@ -36,7 +47,7 @@ elif [ ! -e ~/"$LGSM_SERVER" ]; then IFS=';' cmds=($(grep 'sudo\s*dpkg' auto-install.log | sed -E 's/\s*sudo\s*//g' | sed 's/install/install -y /g')) if [ "${#cmds[@]}" -gt "0" ]; then # preselect answers for steam - echo steam steam/question select "I AGREE" | debconf-set-selections + echo steam steam/question select "I AGREE" | debconf-set-selections #"# ide fix echo steam steam/license note '' | debconf-set-selections # install dependencies @@ -46,7 +57,6 @@ elif [ ! -e ~/"$LGSM_SERVER" ]; then # retry gosu "$USER_NAME" ./"$LGSM_SERVER" auto-install fi - fi exec gosu "$USER_NAME" ./"$LGSM_SERVER" "start" diff --git a/scripts/setupUser.sh b/scripts/setupUser.sh index ccf945b..c3dd11a 100644 --- a/scripts/setupUser.sh +++ b/scripts/setupUser.sh @@ -4,25 +4,10 @@ set -o errexit set -o nounset GROUP_NAME="$USER_NAME" -# if user doesn't exit -if ! id --user "$USER_ID" > /dev/null 2>&1; then - # create it - groupadd -g "$GROUP_ID" -o "$GROUP_NAME" - adduser --home "$LGSM_PATH" --uid "$USER_ID" --disabled-password --gecos "" --ingroup "$GROUP_NAME" "$USER_NAME" - usermod -G tty "$GROUP_NAME" - -# if user/group has incorrect id -elif [ "$(id --user "$USER_ID")" != "$USER_ID" ] || [ "$(id --group "$USER_ID")" != "$GROUP_ID" ]; then - echo "[setupUser] changing user id" - old_user_id="$(id --user "$USER_ID")" - usermod -u "$USER_ID" "$USER_NAME" - find / -uid "$old_user_id" -exec chown "$USER_NAME" "{}" \; - - echo "[setupUser] changing group id" - old_group_id="$(id --group "$USER_ID")" - groupmod -g "$GROUP_ID" "$GROUP_NAME" - find / -gid "$old_group_id" -exec chown ":$USER_NAME" "{}" \; -fi +# create it +groupadd -g "$GROUP_ID" -o "$GROUP_NAME" +adduser --home "$LGSM_PATH" --uid "$USER_ID" --disabled-password --gecos "" --ingroup "$GROUP_NAME" "$USER_NAME" +usermod -G tty "$GROUP_NAME" # enforce correct permissions chown -R "$USER_NAME:$GROUP_NAME" "$LGSM_PATH" From 489af8ca2e764ab013bec782d15d4afaef12b797 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 10 Nov 2021 20:01:14 +0100 Subject: [PATCH 003/116] added iproute2 to remoive warnings --- scripts/installMinimalDependencies.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/installMinimalDependencies.sh b/scripts/installMinimalDependencies.sh index ae1d736..22df086 100644 --- a/scripts/installMinimalDependencies.sh +++ b/scripts/installMinimalDependencies.sh @@ -5,7 +5,9 @@ set -o nounset echo "[installMinimalDependencies] installing ..." apt-get update -DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates wget locales curl +# curl / wget needed for lgsm +# iproute2, fix "-o: command not found", fix "ss: command not found" +DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates wget locales curl iproute2 localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 # verify gosu is working From 594376e0a563fa03b80178df3c2432747403d6bc Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 10 Nov 2021 22:55:58 +0100 Subject: [PATCH 004/116] + multi stage build for better dev experience + createAlias for easier docker exec + added scripts to build / run --- Dockerfile | 71 +++++++++++++++++++++------------- scripts/cleanImage.sh | 4 +- scripts/createAlias.sh | 34 ++++++++++++++++ scripts/entrypoint.sh | 70 ++++++++++----------------------- scripts/installDependencies.sh | 27 +++++++++++++ scripts/installLGSM.sh | 1 - scripts/lgsm-fix-permission | 4 ++ scripts/lgsm-init | 4 ++ scripts/lgsm-update-uid-gid | 12 ++++++ tests/build.sh | 42 ++++++++++++++++++++ tests/config | 8 ++++ tests/run.sh | 60 ++++++++++++++++++++++++++++ 12 files changed, 259 insertions(+), 78 deletions(-) create mode 100644 scripts/createAlias.sh create mode 100644 scripts/installDependencies.sh create mode 100644 scripts/lgsm-fix-permission create mode 100644 scripts/lgsm-init create mode 100644 scripts/lgsm-update-uid-gid create mode 100644 tests/build.sh create mode 100644 tests/config create mode 100644 tests/run.sh diff --git a/Dockerfile b/Dockerfile index 64adc49..c60d927 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,44 +1,63 @@ -FROM ubuntu:18.04 as dependencyStage +# download / build / verify dependencies +# own stage = additional deps needed which are only here used +FROM ubuntu:21.04 as dependencyStage ENV GOSU_VERSION 1.14 COPY scripts/installGosu.sh / RUN set -eux; \ ./installGosu.sh -FROM ubuntu:18.04 +# create linuxgsm image +# this stage should be usable by existing developers +FROM ubuntu:21.04 as linuxgsm -LABEL maintainer="LinuxGSM " - -COPY scripts/cleanImage.sh \ - scripts/entrypoint.sh \ - scripts/installLGSM.sh \ - scripts/installMinimalDependencies.sh \ - scripts/setupUser.sh \ - /home/ -COPY --from=dependencyStage /usr/local/bin/gosu /usr/local/bin/gosu - -## changable -ARG LGSM_VERSION="v21.4.1" +ARG LGSM_VERSION="master" ENV LGSM_VERSION="$LGSM_VERSION" \ + LGSM_GAMESERVER="" \ USER_ID="750" \ - GROUP_ID="750" - -## internal, dont change -ENV USER_NAME="linuxgsm" \ + GROUP_ID="750" \ + \ + USER_NAME="linuxgsm" \ LGSM_PATH="/home/linuxgsm" \ + LGSM_SCRIPTS="/home/linuxgsm-scripts/" \ + PATH="$PATH:/home/linuxgsm-scripts/" \ LANG="en_US.UTF-8" \ LANGUAGE="en_US.UTF-8" \ LC_ALL="en_US.UTF-8" \ - TERM="xterm" \ - PATH="$PATH:/home/linuxgsm" + TERM="xterm" + +COPY --from=dependencyStage /usr/local/bin/gosu /usr/local/bin/gosu +COPY scripts/cleanImage.sh \ + scripts/createAlias.sh \ + scripts/entrypoint.sh \ + scripts/installDependencies.sh \ + scripts/installLGSM.sh \ + scripts/installMinimalDependencies.sh \ + scripts/setupUser.sh \ + \ + scripts/lgsm-update-uid-gid \ + scripts/lgsm-fix-permission \ + scripts/lgsm-init \ + "$LGSM_SCRIPTS" RUN set -eux; \ -cd /home/; \ -./installMinimalDependencies.sh; \ -./setupUser.sh; \ -./installLGSM.sh; \ -./cleanImage.sh + cd "$LGSM_SCRIPTS"; \ + ./installMinimalDependencies.sh; \ + ./setupUser.sh; \ + ./installLGSM.sh; \ + ./cleanImage.sh VOLUME "$LGSM_PATH" WORKDIR "$LGSM_PATH" -ENTRYPOINT ["bash","../entrypoint.sh" ] + +# install server specific dependencies +FROM linuxgsm as specific +ARG LGSM_GAMESERVER="" +ENV LGSM_GAMESERVER="$LGSM_GAMESERVER" +RUN set -eux; \ + cd "$LGSM_SCRIPTS"; \ + ./installDependencies.sh "$LGSM_GAMESERVER"; \ + ./createAlias.sh "$LGSM_GAMESERVER"; \ + ./cleanImage.sh + +ENTRYPOINT ["./../linuxgsm-scripts/entrypoint.sh"] diff --git a/scripts/cleanImage.sh b/scripts/cleanImage.sh index a6a0913..90f3b1b 100644 --- a/scripts/cleanImage.sh +++ b/scripts/cleanImage.sh @@ -8,7 +8,7 @@ echo "[cleanImage] cleaning image" apt-get autoremove -y apt-get clean -y rm -rf /var/lib/apt/lists/* >> /dev/null 2>&1 || true +rm -rf "$LGSM_PATH/"* rm "/home/installMinimalDependencies.sh" \ "/home/installLGSM.sh" \ - "/home/setupUser.sh" \ - "/home/cleanImage.sh" >> /dev/null 2>&1 || true + "/home/setupUser.sh" >> /dev/null 2>&1 || true diff --git a/scripts/createAlias.sh b/scripts/createAlias.sh new file mode 100644 index 0000000..bde9c9a --- /dev/null +++ b/scripts/createAlias.sh @@ -0,0 +1,34 @@ +#!/bin/bash +LGSM_GAMESERVER="$1" +if [ -z "$LGSM_GAMESERVER" ]; then + echo "[createAlias] ERROR first argument needs to be target gameserver" + exit 1 +fi + +set -o errexit +set -o nounset +echo "[createAlias] creating linuxgsm alias" + +function createAlias() { + name="$1" + command="$LGSM_PATH/$LGSM_GAMESERVER" + file="$LGSM_SCRIPTS/$name" + + if [ -f "$file" ]; then + echo "[createAlias.sh]error file already exists => cant create alias with this method" + else + echo "[createAlias.sh] $command $name" + cat > "$file" <<- EOM + #!/bin/sh + gosu "$USER_NAME" "$command" "$name" "\$@" + EOM + chmod a=rx "$file" + # create 2nd link for better script readability + ln -s "$file" "$LGSM_SCRIPTS/lgsm-$name" + fi +} + +#TODO if linuxgsm supports -h / --help to list commands this can be generated +for cmd in install auto-install start stop restart details postdetails backup update-lgsm monitor test-alert update check-update force-update validate console debug; do + createAlias "$cmd" +done diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index e40cab7..4e52b8c 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -1,62 +1,34 @@ #!/bin/bash -LGSM_SERVER="$1" -readonly LGSM_SERVER - set -o errexit set -o pipefail set -o nounset cd "$LGSM_PATH" -## linuxgsm-docker base image entrypoint script -## execute LinuxGSM or arbitrary server commands at will -## by passing command - -# check if uid / guid should be changed -GROUP_NAME="$USER_NAME" -if [ "$(id --user "$USER_ID")" != "$USER_ID" ] || [ "$(id --group "$USER_ID")" != "$GROUP_ID" ]; then - echo "[setupUser] changing user id" - old_user_id="$(id --user "$USER_ID")" - usermod -u "$USER_ID" "$USER_NAME" - find / -uid "$old_user_id" -exec chown "$USER_NAME" "{}" \; - - echo "[setupUser] changing group id" - old_group_id="$(id --group "$USER_ID")" - groupmod -g "$GROUP_ID" "$GROUP_NAME" - find / -gid "$old_group_id" -exec chown ":$USER_NAME" "{}" \; -fi - -# enforce correct permissions -chown -R "$USER_NAME:$GROUP_NAME" "$LGSM_PATH" -chmod 755 "$LGSM_PATH" +lgsm-update-uid-gid +lgsm-fix-permission # check if wished server is provided -if [ "$#" = "0" ]; then - echo "[entrypoint] please provide server as first argument" - exit 1 -# check if server is already installed -elif [ ! -e ~/"$LGSM_SERVER" ]; then - echo "installing $LGSM_SERVER" - gosu "$USER_NAME" cp -f /home/linuxgsm.sh ./linuxgsm.sh - gosu "$USER_NAME" ./linuxgsm.sh "$LGSM_SERVER" +if [ ! -e "$LGSM_GAMESERVER" ]; then + echo "installing $LGSM_GAMESERVER" + lgsm-init + lgsm-auto-install +else + lgsm-update +fi - # check if server can be installed - gosu "$USER_NAME" ./"$LGSM_SERVER" auto-install 2>&1 | tee auto-install.log - # if not probably dependencies are missing - IFS=';' cmds=($(grep 'sudo\s*dpkg' auto-install.log | sed -E 's/\s*sudo\s*//g' | sed 's/install/install -y /g')) - if [ "${#cmds[@]}" -gt "0" ]; then - # preselect answers for steam - echo steam steam/question select "I AGREE" | debconf-set-selections #"# ide fix - echo steam steam/license note '' | debconf-set-selections +isRunning="true" +function stopServer() { + lgsm-stop + isRunning="false" +} - # install dependencies - for cmd in "${cmds[@]}"; do - eval "DEBIAN_FRONTEND=noninteractive $cmd" - done - # retry - gosu "$USER_NAME" ./"$LGSM_SERVER" auto-install - fi -fi +lgsm-start +trap stopServer SIGTERM SIGINT -exec gosu "$USER_NAME" ./"$LGSM_SERVER" "start" +echo "Server is running, waiting for SIGTERM / SIGINT" +while "$isRunning"; do + sleep 1s +done +echo "Server closed gracefully" diff --git a/scripts/installDependencies.sh b/scripts/installDependencies.sh new file mode 100644 index 0000000..bc53201 --- /dev/null +++ b/scripts/installDependencies.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +server="$1" +set -o errexit +set -o pipefail +set -o nounset +echo "[installServer] installing $server" +cd "$LGSM_PATH" +gosu "$USER_NAME" cp -f "$LGSM_SCRIPTS/linuxgsm.sh" . +gosu "$USER_NAME" ./linuxgsm.sh "$server" + +# check if server can be installed +# TODO currently this is the only way to recognize if new dependencies are needed +# maybe add a "./linuxgsm.sh installDependencies" +gosu "$USER_NAME" ./"$server" auto-install 2>&1 | tee auto-install.log || true +# if not probably dependencies are missing +IFS=';' cmds=($(grep 'sudo\s*dpkg' auto-install.log | sed -E 's/\s*sudo\s*//g' | sed 's/install/install -y /g')) +if [ "${#cmds[@]}" -gt "0" ]; then + # preselect answers for steam + echo steam steam/question select "I AGREE" | debconf-set-selections #"# ide fix + echo steam steam/license note '' | debconf-set-selections + + # install dependencies + for cmd in "${cmds[@]}"; do + eval "DEBIAN_FRONTEND=noninteractive $cmd" + done +fi diff --git a/scripts/installLGSM.sh b/scripts/installLGSM.sh index 7c4e9de..0836091 100644 --- a/scripts/installLGSM.sh +++ b/scripts/installLGSM.sh @@ -7,5 +7,4 @@ echo "[installLGSM] installing LGSM" GROUP_NAME="$USER_NAME" wget "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/$LGSM_VERSION/linuxgsm.sh" -chown "$USER_NAME:$GROUP_NAME" linuxgsm.sh chmod +x linuxgsm.sh diff --git a/scripts/lgsm-fix-permission b/scripts/lgsm-fix-permission new file mode 100644 index 0000000..a780f28 --- /dev/null +++ b/scripts/lgsm-fix-permission @@ -0,0 +1,4 @@ +#!/bin/bash + +chown -R "$USER_NAME:$GROUP_NAME" "$LGSM_PATH" +chmod 755 "$LGSM_PATH" diff --git a/scripts/lgsm-init b/scripts/lgsm-init new file mode 100644 index 0000000..ee9995f --- /dev/null +++ b/scripts/lgsm-init @@ -0,0 +1,4 @@ +#!/bin/bash + +gosu "$USER_NAME" cp -f "$LGSM_SCRIPTS/linuxgsm.sh" . +gosu "$USER_NAME" ./linuxgsm.sh "$LGSM_GAMESERVER" diff --git a/scripts/lgsm-update-uid-gid b/scripts/lgsm-update-uid-gid new file mode 100644 index 0000000..459c019 --- /dev/null +++ b/scripts/lgsm-update-uid-gid @@ -0,0 +1,12 @@ +#!/bin/bash + +GROUP_NAME="$USER_NAME" +if [ "$(id --user "$USER_ID")" != "$USER_ID" ] || [ "$(id --group "$USER_ID")" != "$GROUP_ID" ]; then + echo "[setupUser] changing user id" + old_user_id="$(id --user "$USER_ID")" + usermod -u "$USER_ID" "$USER_NAME" + + echo "[setupUser] changing group id" + old_group_id="$(id --group "$USER_ID")" + groupmod -g "$GROUP_ID" "$GROUP_NAME" +fi diff --git a/tests/build.sh b/tests/build.sh new file mode 100644 index 0000000..f6bb696 --- /dev/null +++ b/tests/build.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +server="" +lgsm_version="" +while [ $# -ge 1 ]; do + key="$1" + shift + + case "$key" in + -h|--help) + echo "build.sh [option] [server]" + echo "" + echo "options:" + echo "-v x use provided lgsm version where x is branch / tag / commit" + echo "--version x e.g. --version v21.4.1" + echo "" + echo "server:" + echo "gmodserver build linuxgsm image and specific gmodserver" + echo "..." + exit 0;; + -v|--version) + lgsm_version="--build-arg=\"LGSM_VERSION=$1\" --no-cache " + echo "using lgsm version ${lgsm_version:-default}" + shift + ;; + *) + echo "$key is server" + server="$key";; + esac +done + +source "$(dirname "$0")/config" +cd "$(dirname "$0")/.." + +cmd=(docker build -t "$IMAGE:lgsm" --target linuxgsm $lgsm_version .) +echo "${cmd[@]}" +"${cmd[@]}" +if [ -n "$server" ]; then + cmd=(docker build -t "$IMAGE:specific" --build-arg "LGSM_GAMESERVER=$server" $lgsm_version .) + echo "${cmd[@]}" + "${cmd[@]}" +fi diff --git a/tests/config b/tests/config new file mode 100644 index 0000000..75cc6f9 --- /dev/null +++ b/tests/config @@ -0,0 +1,8 @@ +#!/bin/bash + +set -o errexit +set -o pipefail +set -o nounset + +IMAGE="lgsm-test" +CONTAINER="lgsm-test" \ No newline at end of file diff --git a/tests/run.sh b/tests/run.sh new file mode 100644 index 0000000..02fb1e8 --- /dev/null +++ b/tests/run.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +source "$(dirname "$0")/config" + +args=() +debug="" +tag="" +volume="" +remove="false" +while [ $# -ge 1 ]; do + key="$1" + shift + + case "$key" in + -h|--help) + echo "run.sh [option] tag [args]" + echo "" + echo "options:" + echo "-d set entrypoint to bash" + echo "--debug" + echo "-v use volume instead of clean" + echo "--volume" + echo "" + echo "tag:" + echo "lgsm run lgsm image" + echo "specific run last created specific image $IMAGE:$tag" + echo "" + echo "args:" + echo "every other argument is added to docker run ... IMAGE [args] " + exit 0;; + -d|--debug) + debug="--entrypoint bash";; + -v|--volume) + volume="-v $1:/home/linuxgsm" + shift;; + lgsm|specific) + tag="$key";; + *) + echo "$key is argument for docker container" + args+=("$key");; + esac +done + + +if [ -z "$tag" ]; then + echo "please provide the tag to execute as first argument lgsm or specific" + exit 1 +fi + + +cmds=(docker run -it --rm --name "$CONTAINER" $volume $debug "$IMAGE:$tag") +for arg in "$@"; do + if [ "$arg" != "$1" ]; then + cmds+=("$arg") + fi +done + +echo "${cmds[@]}" +"${cmds[@]}" + From 48e81685fefa10eed87d396507ed8002651860b3 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Fri, 12 Nov 2021 00:48:15 +0100 Subject: [PATCH 005/116] + pr #35 tmux, gamedig, cleanup --- Dockerfile | 46 +++++++++++++++++++++------------------ scripts/cleanImage.sh | 13 ++++++----- scripts/entrypoint.sh | 7 +++--- scripts/installGamedig.sh | 10 +++++++++ scripts/installGosu.sh | 1 + scripts/installLGSM.sh | 4 ++-- scripts/lgsm-tmux-attach | 7 ++++++ 7 files changed, 57 insertions(+), 31 deletions(-) create mode 100644 scripts/installGamedig.sh create mode 100644 scripts/lgsm-tmux-attach diff --git a/Dockerfile b/Dockerfile index c60d927..9cb7437 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,11 @@ # own stage = additional deps needed which are only here used FROM ubuntu:21.04 as dependencyStage -ENV GOSU_VERSION 1.14 -COPY scripts/installGosu.sh / +COPY scripts/installGosu.sh \ + scripts/installSupercron.sh \ + / RUN set -eux; \ - ./installGosu.sh + ./installGosu.sh 1.14 # create linuxgsm image # this stage should be usable by existing developers @@ -19,33 +20,37 @@ ENV LGSM_VERSION="$LGSM_VERSION" \ \ USER_NAME="linuxgsm" \ LGSM_PATH="/home/linuxgsm" \ - LGSM_SCRIPTS="/home/linuxgsm-scripts/" \ + LGSM_SCRIPTS="/home/linuxgsm-scripts" \ PATH="$PATH:/home/linuxgsm-scripts/" \ LANG="en_US.UTF-8" \ LANGUAGE="en_US.UTF-8" \ LC_ALL="en_US.UTF-8" \ TERM="xterm" -COPY --from=dependencyStage /usr/local/bin/gosu /usr/local/bin/gosu -COPY scripts/cleanImage.sh \ - scripts/createAlias.sh \ - scripts/entrypoint.sh \ - scripts/installDependencies.sh \ - scripts/installLGSM.sh \ - scripts/installMinimalDependencies.sh \ +COPY --from=dependencyStage \ + /usr/local/bin/gosu \ + /usr/local/bin/ +COPY scripts/installMinimalDependencies.sh \ scripts/setupUser.sh \ + scripts/installLGSM.sh \ + scripts/installGamedig.sh \ + scripts/cleanImage.sh \ + scripts/installDependencies.sh \ + scripts/createAlias.sh \ \ + scripts/entrypoint.sh \ scripts/lgsm-update-uid-gid \ scripts/lgsm-fix-permission \ scripts/lgsm-init \ - "$LGSM_SCRIPTS" + scripts/lgsm-tmux-attach \ + "$LGSM_SCRIPTS"/ RUN set -eux; \ - cd "$LGSM_SCRIPTS"; \ - ./installMinimalDependencies.sh; \ - ./setupUser.sh; \ - ./installLGSM.sh; \ - ./cleanImage.sh + installMinimalDependencies.sh; \ + setupUser.sh; \ + installLGSM.sh; \ + installGamedig.sh; \ + cleanImage.sh VOLUME "$LGSM_PATH" WORKDIR "$LGSM_PATH" @@ -55,9 +60,8 @@ FROM linuxgsm as specific ARG LGSM_GAMESERVER="" ENV LGSM_GAMESERVER="$LGSM_GAMESERVER" RUN set -eux; \ - cd "$LGSM_SCRIPTS"; \ - ./installDependencies.sh "$LGSM_GAMESERVER"; \ - ./createAlias.sh "$LGSM_GAMESERVER"; \ - ./cleanImage.sh + installDependencies.sh "$LGSM_GAMESERVER"; \ + createAlias.sh "$LGSM_GAMESERVER"; \ + cleanImage.sh ENTRYPOINT ["./../linuxgsm-scripts/entrypoint.sh"] diff --git a/scripts/cleanImage.sh b/scripts/cleanImage.sh index 90f3b1b..a38bdec 100644 --- a/scripts/cleanImage.sh +++ b/scripts/cleanImage.sh @@ -3,12 +3,15 @@ set -o errexit set -o nounset echo "[cleanImage] cleaning image" - +if [ -z "$LGSM_PATH" ]; then + exit 10 +fi apt-get autoremove -y apt-get clean -y rm -rf /var/lib/apt/lists/* >> /dev/null 2>&1 || true -rm -rf "$LGSM_PATH/"* -rm "/home/installMinimalDependencies.sh" \ - "/home/installLGSM.sh" \ - "/home/setupUser.sh" >> /dev/null 2>&1 || true +rm -rf "$LGSM_PATH"/* /tmp/* /var/tmp/* || true +rm "$LGSM_SCRIPTS/installMinimalDependencies.sh" \ + "$LGSM_SCRIPTS/installLGSM.sh" \ + "$LGSM_SCRIPTS/installGamedig.sh" \ + "$LGSM_SCRIPTS/setupUser.sh" >> /dev/null 2>&1 || true diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 4e52b8c..51eaa01 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -27,8 +27,9 @@ function stopServer() { lgsm-start trap stopServer SIGTERM SIGINT -echo "Server is running, waiting for SIGTERM / SIGINT" +echo "Started linuxgsm waiting for tmux" + while "$isRunning"; do + lgsm-tmux-attach sleep 1s -done -echo "Server closed gracefully" +done \ No newline at end of file diff --git a/scripts/installGamedig.sh b/scripts/installGamedig.sh new file mode 100644 index 0000000..f4be42f --- /dev/null +++ b/scripts/installGamedig.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -eux +set -o errexit +set -o nounset + +echo 'tzdata tzdata/Areas select Europe' | debconf-set-selections +echo 'tzdata tzdata/Zones/Europe select Paris' | debconf-set-selections +apt-get update +DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends npm +npm install -g gamedig diff --git a/scripts/installGosu.sh b/scripts/installGosu.sh index fbf7aa2..04ff401 100644 --- a/scripts/installGosu.sh +++ b/scripts/installGosu.sh @@ -3,6 +3,7 @@ set -o errexit set -o pipefail set -o nounset +GOSU_VERSION="$1" # save list of currently installed packages for later so we can clean up savedAptMark="$(apt-mark showmanual)" diff --git a/scripts/installLGSM.sh b/scripts/installLGSM.sh index 0836091..98c191e 100644 --- a/scripts/installLGSM.sh +++ b/scripts/installLGSM.sh @@ -6,5 +6,5 @@ echo "[installLGSM] installing LGSM" GROUP_NAME="$USER_NAME" -wget "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/$LGSM_VERSION/linuxgsm.sh" -chmod +x linuxgsm.sh +wget -O "$LGSM_SCRIPTS/linuxgsm.sh" "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/$LGSM_VERSION/linuxgsm.sh" +chmod +x "$LGSM_SCRIPTS/linuxgsm.sh" diff --git a/scripts/lgsm-tmux-attach b/scripts/lgsm-tmux-attach new file mode 100644 index 0000000..d61fb91 --- /dev/null +++ b/scripts/lgsm-tmux-attach @@ -0,0 +1,7 @@ +#!/bin/sh + +set -o errexit +set -o nounset + +gosu "$USER_NAME" tmux set -g status off +gosu "$USER_NAME" tmux attach 2> /dev/null From 7a6b6ead86e94b26de5be651394718a3136d2241 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Fri, 12 Nov 2021 22:33:20 +0100 Subject: [PATCH 006/116] + cron, cleanup --- Dockerfile | 40 +++++++++++-------- commands/lgsm-cron-init | 15 +++++++ commands/lgsm-cron-start | 6 +++ {scripts => commands}/lgsm-fix-permission | 6 ++- {scripts => commands}/lgsm-init | 5 ++- {scripts => commands}/lgsm-tmux-attach | 0 {scripts => commands}/lgsm-update-uid-gid | 5 ++- {scripts => setup}/cleanImage.sh | 0 {scripts => setup}/createAlias.sh | 5 ++- {scripts => setup}/entrypoint.sh | 5 ++- {scripts => setup}/installDependencies.sh | 0 {scripts => setup}/installGamedig.sh | 2 +- {scripts => setup}/installGosu.sh | 0 {scripts => setup}/installLGSM.sh | 0 .../installMinimalDependencies.sh | 0 setup/installSupercronic.sh | 12 ++++++ {scripts => setup}/setupUser.sh | 0 tests/build.sh | 7 +++- 18 files changed, 83 insertions(+), 25 deletions(-) create mode 100644 commands/lgsm-cron-init create mode 100644 commands/lgsm-cron-start rename {scripts => commands}/lgsm-fix-permission (52%) rename {scripts => commands}/lgsm-init (72%) rename {scripts => commands}/lgsm-tmux-attach (100%) rename {scripts => commands}/lgsm-update-uid-gid (90%) rename {scripts => setup}/cleanImage.sh (100%) rename {scripts => setup}/createAlias.sh (82%) rename {scripts => setup}/entrypoint.sh (88%) rename {scripts => setup}/installDependencies.sh (100%) rename {scripts => setup}/installGamedig.sh (76%) rename {scripts => setup}/installGosu.sh (100%) rename {scripts => setup}/installLGSM.sh (100%) rename {scripts => setup}/installMinimalDependencies.sh (100%) create mode 100644 setup/installSupercronic.sh rename {scripts => setup}/setupUser.sh (100%) diff --git a/Dockerfile b/Dockerfile index 9cb7437..7d50328 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,11 +2,12 @@ # own stage = additional deps needed which are only here used FROM ubuntu:21.04 as dependencyStage -COPY scripts/installGosu.sh \ - scripts/installSupercron.sh \ +COPY setup/installGosu.sh \ + setup/installSupercronic.sh \ / RUN set -eux; \ - ./installGosu.sh 1.14 + ./installGosu.sh 1.14; \ + ./installSupercronic.sh v0.1.12 8d3a575654a6c93524c410ae06f681a3507ca5913627fa92c7086fd140fa12ce # create linuxgsm image # this stage should be usable by existing developers @@ -25,24 +26,28 @@ ENV LGSM_VERSION="$LGSM_VERSION" \ LANG="en_US.UTF-8" \ LANGUAGE="en_US.UTF-8" \ LC_ALL="en_US.UTF-8" \ - TERM="xterm" + TERM="xterm" \ + SUPERCRONIC_CONFIG="/home/linuxgsm-scripts/cron.config" COPY --from=dependencyStage \ /usr/local/bin/gosu \ + /usr/local/bin/supercronic \ /usr/local/bin/ -COPY scripts/installMinimalDependencies.sh \ - scripts/setupUser.sh \ - scripts/installLGSM.sh \ - scripts/installGamedig.sh \ - scripts/cleanImage.sh \ - scripts/installDependencies.sh \ - scripts/createAlias.sh \ +COPY setup/installMinimalDependencies.sh \ + setup/setupUser.sh \ + setup/installLGSM.sh \ + setup/installGamedig.sh \ + setup/cleanImage.sh \ + setup/installDependencies.sh \ + setup/createAlias.sh \ + setup/entrypoint.sh \ \ - scripts/entrypoint.sh \ - scripts/lgsm-update-uid-gid \ - scripts/lgsm-fix-permission \ - scripts/lgsm-init \ - scripts/lgsm-tmux-attach \ + commands/lgsm-cron-init \ + commands/lgsm-cron-start \ + commands/lgsm-init \ + commands/lgsm-fix-permission \ + commands/lgsm-tmux-attach \ + commands/lgsm-update-uid-gid \ "$LGSM_SCRIPTS"/ RUN set -eux; \ @@ -52,6 +57,9 @@ RUN set -eux; \ installGamedig.sh; \ cleanImage.sh +HEALTHCHECK --start-period=3600s --interval=300s --timeout=30s --retries=3 \ + CMD [ lgsm-monitor || exit 1 ] + VOLUME "$LGSM_PATH" WORKDIR "$LGSM_PATH" diff --git a/commands/lgsm-cron-init b/commands/lgsm-cron-init new file mode 100644 index 0000000..2f8901a --- /dev/null +++ b/commands/lgsm-cron-init @@ -0,0 +1,15 @@ +#!/bin/sh + +set -o errexit +set -o nounset + +LOG="$LGSM_PATH/log/cron.log" +mkdir -p "$(dirname "$LOG")" + +echo "0 0 * * * [ \"$(du -s "$LOG" | grep -oE "^[0-9]*")\" -gt 1000 ] && savelog -c 3 '$LOG'" > "$SUPERCRONIC_CONFIG" +# allow every CRON_ variable as cronjob +for cron_var in $(env | grep -Eo '^CRON_[^=]*'); do + eval echo "\"\$$cron_var >> '$LOG'\"" >> "$SUPERCRONIC_CONFIG" +done + +gosu "$USER_NAME" supercronic "$SUPERCRONIC_CONFIG" & diff --git a/commands/lgsm-cron-start b/commands/lgsm-cron-start new file mode 100644 index 0000000..c233ea4 --- /dev/null +++ b/commands/lgsm-cron-start @@ -0,0 +1,6 @@ +#!/bin/sh + +set -o errexit +set -o nounset + +gosu "$USER_NAME" supercronic "$CRON_FILE" diff --git a/scripts/lgsm-fix-permission b/commands/lgsm-fix-permission similarity index 52% rename from scripts/lgsm-fix-permission rename to commands/lgsm-fix-permission index a780f28..0bf31fb 100644 --- a/scripts/lgsm-fix-permission +++ b/commands/lgsm-fix-permission @@ -1,4 +1,8 @@ -#!/bin/bash +#!/bin/sh +set -o errexit +set -o nounset + +GROUP_NAME="$USER_NAME" chown -R "$USER_NAME:$GROUP_NAME" "$LGSM_PATH" chmod 755 "$LGSM_PATH" diff --git a/scripts/lgsm-init b/commands/lgsm-init similarity index 72% rename from scripts/lgsm-init rename to commands/lgsm-init index ee9995f..2239e91 100644 --- a/scripts/lgsm-init +++ b/commands/lgsm-init @@ -1,4 +1,7 @@ -#!/bin/bash +#!/bin/sh + +set -o errexit +set -o nounset gosu "$USER_NAME" cp -f "$LGSM_SCRIPTS/linuxgsm.sh" . gosu "$USER_NAME" ./linuxgsm.sh "$LGSM_GAMESERVER" diff --git a/scripts/lgsm-tmux-attach b/commands/lgsm-tmux-attach similarity index 100% rename from scripts/lgsm-tmux-attach rename to commands/lgsm-tmux-attach diff --git a/scripts/lgsm-update-uid-gid b/commands/lgsm-update-uid-gid similarity index 90% rename from scripts/lgsm-update-uid-gid rename to commands/lgsm-update-uid-gid index 459c019..882bea5 100644 --- a/scripts/lgsm-update-uid-gid +++ b/commands/lgsm-update-uid-gid @@ -1,4 +1,7 @@ -#!/bin/bash +#!/bin/sh + +set -o errexit +set -o nounset GROUP_NAME="$USER_NAME" if [ "$(id --user "$USER_ID")" != "$USER_ID" ] || [ "$(id --group "$USER_ID")" != "$GROUP_ID" ]; then diff --git a/scripts/cleanImage.sh b/setup/cleanImage.sh similarity index 100% rename from scripts/cleanImage.sh rename to setup/cleanImage.sh diff --git a/scripts/createAlias.sh b/setup/createAlias.sh similarity index 82% rename from scripts/createAlias.sh rename to setup/createAlias.sh index bde9c9a..e0a7f2b 100644 --- a/scripts/createAlias.sh +++ b/setup/createAlias.sh @@ -20,7 +20,7 @@ function createAlias() { echo "[createAlias.sh] $command $name" cat > "$file" <<- EOM #!/bin/sh - gosu "$USER_NAME" "$command" "$name" "\$@" + gosu "\$USER_NAME" "$command" "$name" "\$@" EOM chmod a=rx "$file" # create 2nd link for better script readability @@ -29,6 +29,7 @@ function createAlias() { } #TODO if linuxgsm supports -h / --help to list commands this can be generated -for cmd in install auto-install start stop restart details postdetails backup update-lgsm monitor test-alert update check-update force-update validate console debug; do +for cmd in install auto-install start stop restart details postdetails backup update-lgsm monitor test-alert update check-update force-update validate console debug \ + change-password map-compressor developer detect-deps detect-glibc detect-ldd query-raw clear-functions; do createAlias "$cmd" done diff --git a/scripts/entrypoint.sh b/setup/entrypoint.sh similarity index 88% rename from scripts/entrypoint.sh rename to setup/entrypoint.sh index 51eaa01..1635439 100644 --- a/scripts/entrypoint.sh +++ b/setup/entrypoint.sh @@ -8,6 +8,7 @@ cd "$LGSM_PATH" lgsm-update-uid-gid lgsm-fix-permission +lgsm-cron-init # check if wished server is provided if [ ! -e "$LGSM_GAMESERVER" ]; then @@ -26,10 +27,10 @@ function stopServer() { lgsm-start trap stopServer SIGTERM SIGINT +lgsm-cron-start & echo "Started linuxgsm waiting for tmux" - while "$isRunning"; do - lgsm-tmux-attach + lgsm-tmux-attach 2> /dev/null sleep 1s done \ No newline at end of file diff --git a/scripts/installDependencies.sh b/setup/installDependencies.sh similarity index 100% rename from scripts/installDependencies.sh rename to setup/installDependencies.sh diff --git a/scripts/installGamedig.sh b/setup/installGamedig.sh similarity index 76% rename from scripts/installGamedig.sh rename to setup/installGamedig.sh index f4be42f..148fbc2 100644 --- a/scripts/installGamedig.sh +++ b/setup/installGamedig.sh @@ -4,7 +4,7 @@ set -o errexit set -o nounset echo 'tzdata tzdata/Areas select Europe' | debconf-set-selections -echo 'tzdata tzdata/Zones/Europe select Paris' | debconf-set-selections +echo 'tzdata tzdata/Zones/Europe select Berlin' | debconf-set-selections apt-get update DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends npm npm install -g gamedig diff --git a/scripts/installGosu.sh b/setup/installGosu.sh similarity index 100% rename from scripts/installGosu.sh rename to setup/installGosu.sh diff --git a/scripts/installLGSM.sh b/setup/installLGSM.sh similarity index 100% rename from scripts/installLGSM.sh rename to setup/installLGSM.sh diff --git a/scripts/installMinimalDependencies.sh b/setup/installMinimalDependencies.sh similarity index 100% rename from scripts/installMinimalDependencies.sh rename to setup/installMinimalDependencies.sh diff --git a/setup/installSupercronic.sh b/setup/installSupercronic.sh new file mode 100644 index 0000000..6885336 --- /dev/null +++ b/setup/installSupercronic.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -o errexit +set -o nounset + +VERSION="$1" +SHA256="$2" +TARGET="/usr/local/bin/supercronic" + +wget -O "$TARGET" "https://github.com/aptible/supercronic/releases/download/$VERSION/supercronic-linux-amd64" +sha256sum "$TARGET" | grep -qF "$SHA256 " || exit 1 +chmod +x "$TARGET" diff --git a/scripts/setupUser.sh b/setup/setupUser.sh similarity index 100% rename from scripts/setupUser.sh rename to setup/setupUser.sh diff --git a/tests/build.sh b/tests/build.sh index f6bb696..7474b61 100644 --- a/tests/build.sh +++ b/tests/build.sh @@ -2,6 +2,7 @@ server="" lgsm_version="" +clear="" while [ $# -ge 1 ]; do key="$1" shift @@ -13,6 +14,8 @@ while [ $# -ge 1 ]; do echo "options:" echo "-v x use provided lgsm version where x is branch / tag / commit" echo "--version x e.g. --version v21.4.1" + echo "-c disable cache using" + echo "--no-cache" echo "" echo "server:" echo "gmodserver build linuxgsm image and specific gmodserver" @@ -23,6 +26,8 @@ while [ $# -ge 1 ]; do echo "using lgsm version ${lgsm_version:-default}" shift ;; + -c|--no-cache) + clear="--no-cache";; *) echo "$key is server" server="$key";; @@ -32,7 +37,7 @@ done source "$(dirname "$0")/config" cd "$(dirname "$0")/.." -cmd=(docker build -t "$IMAGE:lgsm" --target linuxgsm $lgsm_version .) +cmd=(docker build -t "$IMAGE:lgsm" $clear --target linuxgsm $lgsm_version .) echo "${cmd[@]}" "${cmd[@]}" if [ -n "$server" ]; then From 9afc13d40263e9e068a8d1683655df3f8770abc1 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 13 Nov 2021 02:28:50 +0100 Subject: [PATCH 007/116] fix typo --- commands/lgsm-cron-start | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/lgsm-cron-start b/commands/lgsm-cron-start index c233ea4..33ff7d1 100644 --- a/commands/lgsm-cron-start +++ b/commands/lgsm-cron-start @@ -3,4 +3,4 @@ set -o errexit set -o nounset -gosu "$USER_NAME" supercronic "$CRON_FILE" +gosu "$USER_NAME" supercronic "$SUPERCRONIC_CONFIG" From d315393002582bf83b3b5db5c580a2a2cb45fafd Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 13 Nov 2021 03:46:45 +0100 Subject: [PATCH 008/116] fix graceful stop and improved logging --- docker-compose.yaml | 15 ++++++++++----- setup/entrypoint.sh | 24 ++++++++++-------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 219e60c..69f793d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,9 +1,14 @@ +volumes: + server: + services: linuxgsm: - image: gameservermanagers/linuxgsm-docker - container_name: lgsm-docker - hostname: 'LGSM' - network_mode: host + build: + context: . + args: + LGSM_GAMESERVER: gmodserver volumes: - - '/path/to/lgsm:/home/linuxgsm' + - server:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro restart: always + tty: true diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index 1635439..0b4b07c 100644 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -12,25 +12,21 @@ lgsm-cron-init # check if wished server is provided if [ ! -e "$LGSM_GAMESERVER" ]; then - echo "installing $LGSM_GAMESERVER" lgsm-init lgsm-auto-install else lgsm-update fi -isRunning="true" -function stopServer() { - lgsm-stop - isRunning="false" -} - lgsm-start -trap stopServer SIGTERM SIGINT -lgsm-cron-start & +trap lgsm-stop SIGTERM SIGINT +lgsm-cron-start > /dev/null 2>1 & -echo "Started linuxgsm waiting for tmux" -while "$isRunning"; do - lgsm-tmux-attach 2> /dev/null - sleep 1s -done \ No newline at end of file +# tmux in background with log usable for docker +# alternative solution: lgsm-tmux-attach | tee /dev/tty & +rm tmux.pipe > /dev/null 2>1 || true +mkfifo tmux.pipe +lgsm-tmux-attach | tee tmux.pipe & +while read line; do + echo "$line" +done < tmux.pipe From b85ff2b8558aa65cd9a16758500dcf7fd78e3f16 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 14 Nov 2021 19:13:57 +0100 Subject: [PATCH 009/116] prepared health check testing --- Dockerfile | 2 +- tests/config | 8 ---- tests/full.sh | 17 +++++++++ tests/internal/api_docker.sh | 45 ++++++++++++++++++++++ tests/internal/api_various.sh | 9 +++++ tests/{ => internal}/build.sh | 13 +++++-- tests/{ => internal}/run.sh | 27 +++++++++++--- tests/quick.sh | 70 +++++++++++++++++++++++++++++++++++ 8 files changed, 173 insertions(+), 18 deletions(-) delete mode 100644 tests/config create mode 100644 tests/full.sh create mode 100644 tests/internal/api_docker.sh create mode 100644 tests/internal/api_various.sh rename tests/{ => internal}/build.sh (74%) rename tests/{ => internal}/run.sh (59%) create mode 100644 tests/quick.sh diff --git a/Dockerfile b/Dockerfile index 7d50328..595b97a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,7 +57,7 @@ RUN set -eux; \ installGamedig.sh; \ cleanImage.sh -HEALTHCHECK --start-period=3600s --interval=300s --timeout=30s --retries=3 \ +HEALTHCHECK --start-period=3600s --interval=90s --timeout=75s --retries=3 \ CMD [ lgsm-monitor || exit 1 ] VOLUME "$LGSM_PATH" diff --git a/tests/config b/tests/config deleted file mode 100644 index 75cc6f9..0000000 --- a/tests/config +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o pipefail -set -o nounset - -IMAGE="lgsm-test" -CONTAINER="lgsm-test" \ No newline at end of file diff --git a/tests/full.sh b/tests/full.sh new file mode 100644 index 0000000..b260640 --- /dev/null +++ b/tests/full.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -o errexit +set -o pipefail +set -o nounset + +VERSION="$1" + +( + cd "$(dirname "$0")" + + # build clean version + ./build.sh --no-cache --version "$VERSION" + + # run linuxgsm once + +) \ No newline at end of file diff --git a/tests/internal/api_docker.sh b/tests/internal/api_docker.sh new file mode 100644 index 0000000..66f5d3d --- /dev/null +++ b/tests/internal/api_docker.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +function existsContainer() { + [ -z "$(docker ps --all --filter name="$1" -q)" ] +} + +function getContainerState() { + docker ps --all --filter name="$1" --format "{{.Status}}" +} + +function hasContainerHealthCheak() { + [ "$(docker inspect -f '{{.State.Health}}' "$1")" != "" ] +} + +function isContainerHealthStarting() { + getContainerState "$container" | grep -qF '(health: starting)' +} + +function isContainerHealthHealthy() { + getContainerState "$container" | grep -qF '(healthy)' +} + +function removeContainer() { + docker stop "$1" > /dev/null 2>&1 || true + docker rm "$1" > /dev/null 2>&1 || true +} + +function awaitHealthCheck() { + container="$1" + + if existsContainer "$container" || ! hasContainerHealthCheak "$container"; then + return 1 + fi + + echo -n "[awaitHealthCheck] waiting for health check of \"$container\" " + seconds=0 + while isContainerHealthStarting "$container"; do + seconds=$((seconds+1)) + sleep 1s + echo -en "\r[awaitHealthCheck] waiting for health check of \"$container\" currently ${seconds} seconds" + done + echo -e "\r[awaitHealthCheck] \"$container\" health check startup time $seconds" + + isContainerHealthHealthy "$container" +} \ No newline at end of file diff --git a/tests/internal/api_various.sh b/tests/internal/api_various.sh new file mode 100644 index 0000000..a9c6648 --- /dev/null +++ b/tests/internal/api_various.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +function isEmpty() { + [ -z "$1" ] +} + +function contains() { + echo "$1" | grep -qF "$2" +} diff --git a/tests/build.sh b/tests/internal/build.sh similarity index 74% rename from tests/build.sh rename to tests/internal/build.sh index 7474b61..decccff 100644 --- a/tests/build.sh +++ b/tests/internal/build.sh @@ -3,6 +3,7 @@ server="" lgsm_version="" clear="" +image="lgsm-test" while [ $# -ge 1 ]; do key="$1" shift @@ -16,16 +17,20 @@ while [ $# -ge 1 ]; do echo "--version x e.g. --version v21.4.1" echo "-c disable cache using" echo "--no-cache" + echo "-i x target image, default=lgsm-test" + echo "--image x" echo "" echo "server:" echo "gmodserver build linuxgsm image and specific gmodserver" echo "..." exit 0;; -v|--version) - lgsm_version="--build-arg=\"LGSM_VERSION=$1\" --no-cache " + lgsm_version="--build-arg=\"LGSM_VERSION=$1\"" echo "using lgsm version ${lgsm_version:-default}" shift ;; + -i|--image) + image="$key";; -c|--no-cache) clear="--no-cache";; *) @@ -35,13 +40,13 @@ while [ $# -ge 1 ]; do done source "$(dirname "$0")/config" -cd "$(dirname "$0")/.." +cd "$(dirname "$0")/../.." -cmd=(docker build -t "$IMAGE:lgsm" $clear --target linuxgsm $lgsm_version .) +cmd=(docker build -t "$image:lgsm" $clear --target linuxgsm $lgsm_version .) echo "${cmd[@]}" "${cmd[@]}" if [ -n "$server" ]; then - cmd=(docker build -t "$IMAGE:specific" --build-arg "LGSM_GAMESERVER=$server" $lgsm_version .) + cmd=(docker build -t "$image:specific" --build-arg "LGSM_GAMESERVER=$server" $lgsm_version .) echo "${cmd[@]}" "${cmd[@]}" fi diff --git a/tests/run.sh b/tests/internal/run.sh similarity index 59% rename from tests/run.sh rename to tests/internal/run.sh index 02fb1e8..ff36328 100644 --- a/tests/run.sh +++ b/tests/internal/run.sh @@ -1,12 +1,14 @@ #!/bin/bash -source "$(dirname "$0")/config" - args=() debug="" tag="" volume="" remove="false" +docker_run_mode="-it" +quick="" +image="lgsm-test" +container="lgsm-test" while [ $# -ge 1 ]; do key="$1" shift @@ -18,8 +20,14 @@ while [ $# -ge 1 ]; do echo "options:" echo "-d set entrypoint to bash" echo "--debug" - echo "-v use volume instead of clean" - echo "--volume" + echo "--detach run in background instead of foreground" + echo "-v x use volume x" + echo "--volume x" + echo "--quick enforce quick monitoring" + echo "-i x target image, default=lgsm-test" + echo "--image x" + echo "-c x container name default=lgsm-test" + echo "--container x" echo "" echo "tag:" echo "lgsm run lgsm image" @@ -30,9 +38,18 @@ while [ $# -ge 1 ]; do exit 0;; -d|--debug) debug="--entrypoint bash";; + --detach) + docker_run_mode="-dt";; -v|--volume) volume="-v $1:/home/linuxgsm" shift;; + --quick) + quick="--health-interval=10s";; + -i|--image) + image="$key";; + -c|--container) + container="$1" + shift;; lgsm|specific) tag="$key";; *) @@ -48,7 +65,7 @@ if [ -z "$tag" ]; then fi -cmds=(docker run -it --rm --name "$CONTAINER" $volume $debug "$IMAGE:$tag") +cmds=(docker run $docker_run_mode --rm --name "$container" $volume $debug $quick "$image:$tag") for arg in "$@"; do if [ "$arg" != "$1" ]; then cmds+=("$arg") diff --git a/tests/quick.sh b/tests/quick.sh new file mode 100644 index 0000000..7a889ce --- /dev/null +++ b/tests/quick.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +source "$(dirname "$0")/internal/api_docker.sh" +source "$(dirname "$0")/internal/api_various.sh" + +VERSION="" +GAMESERVER="" +VOLUME="" +DEBUG="" +clear="" +while [ $# -ge 1 ]; do + key="$1" + shift + + case "$key" in + -h|--help) + echo "quick testing of provided gameserver" + echo "quick.sh [option] server" + echo "" + echo "options:" + echo "--version x use linuxgsm version x e.g. \"v21.4.1\"" + echo "--volume x use volume x e.g. \"lgsm\"" + echo "-d run gameserver and overwrite entrypoint to bash" + echo "--debug" + echo "-c run without docker cache" + echo "--no-cache" + echo "" + echo "server e.g. gmodserver" + exit 0;; + --version) + VERSION="--version \"$1\"" + shift;; + --volume) + VOLUME="--volume $1" + shift;; + -c|--no-cache) + clear="--no-cache";; + -d|--debug) + DEBUG="--debug";; + *) + if grep -qE '^-' <<< "$key"; then + echo "unknown option $key" + exit 1 + fi + GAMESERVER="$key";; + esac +done + +if [ -z "$GAMESERVER" ]; then + echo "ERROR no gameserver provided" + exit 1 +fi +CONTAINER="linuxgsm-$GAMESERVER" + +( + cd "$(dirname "$0")" + removeContainer "$CONTAINER" + ./internal/build.sh $clear "$VERSION" "$GAMESERVER" + ./internal/run.sh --container "$CONTAINER" --detach $VOLUME specific + if awaitHealthCheck "$CONTAINER"; then + echo "successful" + else + echo "failed" + fi + removeContainer "$CONTAINER" +) From ed31da819bc52ea0f136b71f0ea60d0e5c0f6470 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 14 Nov 2021 22:16:26 +0100 Subject: [PATCH 010/116] fix health check --- Dockerfile | 2 +- tests/internal/api_docker.sh | 3 ++- tests/internal/build.sh | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 595b97a..c1dde12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,7 +58,7 @@ RUN set -eux; \ cleanImage.sh HEALTHCHECK --start-period=3600s --interval=90s --timeout=75s --retries=3 \ - CMD [ lgsm-monitor || exit 1 ] + CMD lgsm-monitor || exit 1 VOLUME "$LGSM_PATH" WORKDIR "$LGSM_PATH" diff --git a/tests/internal/api_docker.sh b/tests/internal/api_docker.sh index 66f5d3d..4a8557f 100644 --- a/tests/internal/api_docker.sh +++ b/tests/internal/api_docker.sh @@ -39,7 +39,8 @@ function awaitHealthCheck() { sleep 1s echo -en "\r[awaitHealthCheck] waiting for health check of \"$container\" currently ${seconds} seconds" done - echo -e "\r[awaitHealthCheck] \"$container\" health check startup time $seconds" + echo "" + echo "[awaitHealthCheck] \"$container\" health check startup time $seconds" isContainerHealthHealthy "$container" } \ No newline at end of file diff --git a/tests/internal/build.sh b/tests/internal/build.sh index decccff..e2deba5 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -1,5 +1,12 @@ #!/bin/bash +set -o errexit +set -o pipefail +set -o nounset + +source "$(dirname "$0")/api_docker.sh" +source "$(dirname "$0")/api_various.sh" + server="" lgsm_version="" clear="" @@ -39,7 +46,6 @@ while [ $# -ge 1 ]; do esac done -source "$(dirname "$0")/config" cd "$(dirname "$0")/../.." cmd=(docker build -t "$image:lgsm" $clear --target linuxgsm $lgsm_version .) From 2770d0781d9d970794ea43631fc1f377692923e0 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 14 Nov 2021 22:16:39 +0100 Subject: [PATCH 011/116] fix dockerignore --- .dockerignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 1f12e98..47a7789 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,7 @@ -live/ +tests/ +.gitignore +docker-compose.yml +LICENSE +linuxgsm-docker.sh README.md + From 491fe387119da63b0974e3729e6631ba2e62e3b2 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 14 Nov 2021 23:15:56 +0100 Subject: [PATCH 012/116] fix log dir permissions --- commands/lgsm-cron-init | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commands/lgsm-cron-init b/commands/lgsm-cron-init index 2f8901a..76a21be 100644 --- a/commands/lgsm-cron-init +++ b/commands/lgsm-cron-init @@ -4,12 +4,13 @@ set -o errexit set -o nounset LOG="$LGSM_PATH/log/cron.log" -mkdir -p "$(dirname "$LOG")" +gosu "$USER_NAME" mkdir -p "$(dirname "$LOG")" echo "0 0 * * * [ \"$(du -s "$LOG" | grep -oE "^[0-9]*")\" -gt 1000 ] && savelog -c 3 '$LOG'" > "$SUPERCRONIC_CONFIG" # allow every CRON_ variable as cronjob for cron_var in $(env | grep -Eo '^CRON_[^=]*'); do eval echo "\"\$$cron_var >> '$LOG'\"" >> "$SUPERCRONIC_CONFIG" done +chown "$USER_NAME:$USER_NAME" "$SUPERCRONIC_CONFIG" gosu "$USER_NAME" supercronic "$SUPERCRONIC_CONFIG" & From ccbd4951c6830cfaa54b9048f5fbe3a0a5155f47 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 14 Nov 2021 23:16:52 +0100 Subject: [PATCH 013/116] fix log not existing very early --- commands/lgsm-cron-init | 1 + 1 file changed, 1 insertion(+) diff --git a/commands/lgsm-cron-init b/commands/lgsm-cron-init index 76a21be..39b5c2c 100644 --- a/commands/lgsm-cron-init +++ b/commands/lgsm-cron-init @@ -5,6 +5,7 @@ set -o nounset LOG="$LGSM_PATH/log/cron.log" gosu "$USER_NAME" mkdir -p "$(dirname "$LOG")" +gosu "$USER_NAME" touch "$LOG" echo "0 0 * * * [ \"$(du -s "$LOG" | grep -oE "^[0-9]*")\" -gt 1000 ] && savelog -c 3 '$LOG'" > "$SUPERCRONIC_CONFIG" # allow every CRON_ variable as cronjob From c9e454cc630c6ec22b0bbf3c0cb04648c787bdab Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 15 Nov 2021 02:11:05 +0100 Subject: [PATCH 014/116] + shellcheck --- setup/cleanImage.sh | 5 +---- setup/entrypoint.sh | 6 +++--- setup/installDependencies.sh | 2 +- setup/installGosu.sh | 8 ++++---- setup/installLGSM.sh | 2 -- tests/internal/build.sh | 7 +++++-- tests/internal/run.sh | 17 ++++++++--------- tests/quick.sh | 20 ++++++++++++-------- tests/shellcheck.sh | 13 +++++++++++++ 9 files changed, 47 insertions(+), 33 deletions(-) create mode 100644 tests/shellcheck.sh diff --git a/setup/cleanImage.sh b/setup/cleanImage.sh index a38bdec..d108d34 100644 --- a/setup/cleanImage.sh +++ b/setup/cleanImage.sh @@ -3,14 +3,11 @@ set -o errexit set -o nounset echo "[cleanImage] cleaning image" -if [ -z "$LGSM_PATH" ]; then - exit 10 -fi apt-get autoremove -y apt-get clean -y rm -rf /var/lib/apt/lists/* >> /dev/null 2>&1 || true -rm -rf "$LGSM_PATH"/* /tmp/* /var/tmp/* || true +rm -rf "${LGSM_PATH:?}"/* /tmp/* /var/tmp/* || true rm "$LGSM_SCRIPTS/installMinimalDependencies.sh" \ "$LGSM_SCRIPTS/installLGSM.sh" \ "$LGSM_SCRIPTS/installGamedig.sh" \ diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index 0b4b07c..1e8c555 100644 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -20,13 +20,13 @@ fi lgsm-start trap lgsm-stop SIGTERM SIGINT -lgsm-cron-start > /dev/null 2>1 & +lgsm-cron-start > /dev/null 2>&1 & # tmux in background with log usable for docker # alternative solution: lgsm-tmux-attach | tee /dev/tty & -rm tmux.pipe > /dev/null 2>1 || true +rm tmux.pipe > /dev/null 2>&1 || true mkfifo tmux.pipe lgsm-tmux-attach | tee tmux.pipe & -while read line; do +while read -r line; do echo "$line" done < tmux.pipe diff --git a/setup/installDependencies.sh b/setup/installDependencies.sh index bc53201..af537fd 100644 --- a/setup/installDependencies.sh +++ b/setup/installDependencies.sh @@ -14,7 +14,7 @@ gosu "$USER_NAME" ./linuxgsm.sh "$server" # maybe add a "./linuxgsm.sh installDependencies" gosu "$USER_NAME" ./"$server" auto-install 2>&1 | tee auto-install.log || true # if not probably dependencies are missing -IFS=';' cmds=($(grep 'sudo\s*dpkg' auto-install.log | sed -E 's/\s*sudo\s*//g' | sed 's/install/install -y /g')) +mapfile -d ";" cmds < <( grep 'sudo\s*dpkg' auto-install.log | sed -E 's/\s*sudo\s*//g' | sed 's/install/install -y /g' ) if [ "${#cmds[@]}" -gt "0" ]; then # preselect answers for steam echo steam steam/question select "I AGREE" | debconf-set-selections #"# ide fix diff --git a/setup/installGosu.sh b/setup/installGosu.sh index 04ff401..8c3f417 100644 --- a/setup/installGosu.sh +++ b/setup/installGosu.sh @@ -6,7 +6,6 @@ set -o nounset GOSU_VERSION="$1" # save list of currently installed packages for later so we can clean up -savedAptMark="$(apt-mark showmanual)" apt-get update apt-get install -y --no-install-recommends ca-certificates wget if ! command -v gpg; then @@ -22,13 +21,14 @@ wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$G wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" # verify the signature -export GNUPGHOME="$(mktemp -d)" +GNUPGHOME="$(mktemp -d)" gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu -command -v gpgconf && gpgconf --kill all || : +command -v gpgconf +command -v gpgconf --kill all rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc chmod +x /usr/local/bin/gosu # verify that the binary works gosu --version -gosu nobody true \ No newline at end of file +gosu nobody true diff --git a/setup/installLGSM.sh b/setup/installLGSM.sh index 98c191e..d25c967 100644 --- a/setup/installLGSM.sh +++ b/setup/installLGSM.sh @@ -4,7 +4,5 @@ set -o errexit set -o nounset echo "[installLGSM] installing LGSM" -GROUP_NAME="$USER_NAME" - wget -O "$LGSM_SCRIPTS/linuxgsm.sh" "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/$LGSM_VERSION/linuxgsm.sh" chmod +x "$LGSM_SCRIPTS/linuxgsm.sh" diff --git a/tests/internal/build.sh b/tests/internal/build.sh index e2deba5..2817468 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -4,7 +4,9 @@ set -o errexit set -o pipefail set -o nounset +# shellcheck source=tests/internal/api_docker.sh source "$(dirname "$0")/api_docker.sh" +# shellcheck source=tests/internal/api_various.sh source "$(dirname "$0")/api_various.sh" server="" @@ -48,11 +50,12 @@ done cd "$(dirname "$0")/../.." -cmd=(docker build -t "$image:lgsm" $clear --target linuxgsm $lgsm_version .) +#shellcheck disable=SC2206 +cmd=(docker build -t "$image:lgsm" $clear --target linuxgsm "$lgsm_version" .) echo "${cmd[@]}" "${cmd[@]}" if [ -n "$server" ]; then - cmd=(docker build -t "$image:specific" --build-arg "LGSM_GAMESERVER=$server" $lgsm_version .) + cmd=(docker build -t "$image:specific" --build-arg "LGSM_GAMESERVER=$server" "$lgsm_version" .) echo "${cmd[@]}" "${cmd[@]}" fi diff --git a/tests/internal/run.sh b/tests/internal/run.sh index ff36328..575714b 100644 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -1,13 +1,12 @@ #!/bin/bash args=() -debug="" +debug=() tag="" -volume="" -remove="false" +volume=() docker_run_mode="-it" quick="" -image="lgsm-test" +IMAGE="lgsm-test" container="lgsm-test" while [ $# -ge 1 ]; do key="$1" @@ -37,16 +36,16 @@ while [ $# -ge 1 ]; do echo "every other argument is added to docker run ... IMAGE [args] " exit 0;; -d|--debug) - debug="--entrypoint bash";; + debug=("--entrypoint" "bash");; --detach) docker_run_mode="-dt";; -v|--volume) - volume="-v $1:/home/linuxgsm" + volume=("-v" "$1:/home/linuxgsm") shift;; --quick) quick="--health-interval=10s";; -i|--image) - image="$key";; + IMAGE="$key";; -c|--container) container="$1" shift;; @@ -64,8 +63,8 @@ if [ -z "$tag" ]; then exit 1 fi - -cmds=(docker run $docker_run_mode --rm --name "$container" $volume $debug $quick "$image:$tag") +#shellcheck disable=SC2206 +cmds=(docker run $docker_run_mode --rm --name "$container" ${volume[@]} ${debug[@]} $quick "$IMAGE:$tag") for arg in "$@"; do if [ "$arg" != "$1" ]; then cmds+=("$arg") diff --git a/tests/quick.sh b/tests/quick.sh index 7a889ce..99b6c3f 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -4,14 +4,18 @@ set -o errexit set -o nounset set -o pipefail +cd "$(dirname "$0")/.." + +# shellcheck source=tests/internal/api_docker.sh source "$(dirname "$0")/internal/api_docker.sh" +# shellcheck source=tests/internal/api_various.sh source "$(dirname "$0")/internal/api_various.sh" -VERSION="" +VERSION=() GAMESERVER="" -VOLUME="" +VOLUME=() DEBUG="" -clear="" +CLEAR="" while [ $# -ge 1 ]; do key="$1" shift @@ -32,13 +36,13 @@ while [ $# -ge 1 ]; do echo "server e.g. gmodserver" exit 0;; --version) - VERSION="--version \"$1\"" + VERSION=("--version" "$1") shift;; --volume) - VOLUME="--volume $1" + VOLUME=("--volume" "$1") shift;; -c|--no-cache) - clear="--no-cache";; + CLEAR="--no-cache";; -d|--debug) DEBUG="--debug";; *) @@ -59,8 +63,8 @@ CONTAINER="linuxgsm-$GAMESERVER" ( cd "$(dirname "$0")" removeContainer "$CONTAINER" - ./internal/build.sh $clear "$VERSION" "$GAMESERVER" - ./internal/run.sh --container "$CONTAINER" --detach $VOLUME specific + ./internal/build.sh "$CLEAR" "${VERSION[@]}" "$GAMESERVER" + ./internal/run.sh --container "$CONTAINER" --detach "${VOLUME[@]}" "$DEBUG" specific if awaitHealthCheck "$CONTAINER"; then echo "successful" else diff --git a/tests/shellcheck.sh b/tests/shellcheck.sh new file mode 100644 index 0000000..53da902 --- /dev/null +++ b/tests/shellcheck.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -o errexit +set -o nounset + +( + cd "$(dirname "$0")/.." + + files=() + mapfile -d $'\0' files < <( find commands setup tests -type f -print0 ) + + shellcheck "${files[@]}" +) From c5e120d41c7afb5b0c129fc605009c294af90db9 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Tue, 23 Nov 2021 01:04:38 +0100 Subject: [PATCH 015/116] + auto testing every server --- .gitignore | 1 + tests/full.sh | 83 +++++++++++++++++++++++++++++++++++++++---- tests/internal/run.sh | 2 +- tests/quick.sh | 18 +++++++++- 4 files changed, 95 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index b25c15b..5c68a54 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *~ +results \ No newline at end of file diff --git a/tests/full.sh b/tests/full.sh index b260640..5b708aa 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -4,14 +4,83 @@ set -o errexit set -o pipefail set -o nounset -VERSION="$1" +VERSION="" +GAMESERVER="" +PARRALEL="" +PARRALEL="$(lscpu -p | grep -Ev '^#' | sort -u -t, -k 2,4 | wc -l)" +ROOT_FOLDER="$(realpath "$(dirname "$0")")/.." +while [ $# -ge 1 ]; do + key="$1" + shift + case "$key" in + -h|--help) + echo "testing every feature of specified server" + echo "full.sh [option] [server]" + echo "" + echo "options:" + echo "-v x" + echo "--version x use linuxgsm version x e.g. \"v21.4.1\"" + echo "-c x run x servers in parralel, default x = physical cores" + echo "--cpus x" + echo "" + echo "server default empty = all, otherwise e.g. gmodserver" + exit 0;; + -v|--version) + VERSION="$1" + shift;; + -c|--cpus) + PARRALEL="$1" + shift;; + *) + if grep -qE '^-' <<< "$key"; then + echo "unknown option $key" + exit 1 + fi + GAMESERVER="$key";; + esac +done + +# create results folder +rm -rf "$ROOT_FOLDER/results" +mkdir -p "$ROOT_FOLDER/results" ( - cd "$(dirname "$0")" + working_folder="$(mktemp -d)" + cd "$working_folder" + wget -O "linuxgsm.sh" "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/$VERSION/linuxgsm.sh" + chmod +x "linuxgsm.sh" + server_list="$(./linuxgsm.sh list)" - # build clean version - ./build.sh --no-cache --version "$VERSION" + subprocesses=() + while IFS=$'\n' read -r line; do + rm -rf "$working_folder" > /dev/null 2>&1 + cd "$ROOT_FOLDER" - # run linuxgsm once - -) \ No newline at end of file + while [ "${#subprocesses[@]}" -ge "$PARRALEL" ]; do + sleep 1s + temp=() + for pid in "${subprocesses[@]}"; do + if ps -p "$pid" -o pid= > /dev/null 2>&1; then + temp+=("$pid") + fi + done + subprocesses=("${temp[@]}") + done + + server_code="$(grep -oE '^\S*' <<< "$line")" + echo "testing: $server_code" + if [ -z "$GAMESERVER" ] || [ "$server_code" = "$GAMESERVER" ]; then + ( + if ./tests/quick.sh --logs --version "$VERSION" "$server_code" > "results/$server_code.log" 2>&1; then + mv "results/$server_code.log" "results/successful.$server_code.log" + else + mv "results/$server_code.log" "results/failed.$server_code.log" + fi + ) & + subprocesses+=("$!") + fi + done < <(echo "$server_list") + + echo "successful: $(find "$ROOT_FOLDER/results/" -iname "successful.*" | wc -l)" + echo "failed: $(find "$ROOT_FOLDER/results/" -iname "failed.*" | wc -l)" +) diff --git a/tests/internal/run.sh b/tests/internal/run.sh index 575714b..030f890 100644 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -64,7 +64,7 @@ if [ -z "$tag" ]; then fi #shellcheck disable=SC2206 -cmds=(docker run $docker_run_mode --rm --name "$container" ${volume[@]} ${debug[@]} $quick "$IMAGE:$tag") +cmds=(docker run $docker_run_mode --name "$container" ${volume[@]} ${debug[@]} $quick "$IMAGE:$tag") for arg in "$@"; do if [ "$arg" != "$1" ]; then cmds+=("$arg") diff --git a/tests/quick.sh b/tests/quick.sh index 99b6c3f..3be7abd 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -16,6 +16,7 @@ GAMESERVER="" VOLUME=() DEBUG="" CLEAR="" +LOGS="false" while [ $# -ge 1 ]; do key="$1" shift @@ -32,6 +33,8 @@ while [ $# -ge 1 ]; do echo "--debug" echo "-c run without docker cache" echo "--no-cache" + echo "--logs print last log lines after run" + echo "-l" echo "" echo "server e.g. gmodserver" exit 0;; @@ -45,6 +48,8 @@ while [ $# -ge 1 ]; do CLEAR="--no-cache";; -d|--debug) DEBUG="--debug";; + -l|--logs) + LOGS="true";; *) if grep -qE '^-' <<< "$key"; then echo "unknown option $key" @@ -65,10 +70,21 @@ CONTAINER="linuxgsm-$GAMESERVER" removeContainer "$CONTAINER" ./internal/build.sh "$CLEAR" "${VERSION[@]}" "$GAMESERVER" ./internal/run.sh --container "$CONTAINER" --detach "${VOLUME[@]}" "$DEBUG" specific + + successful="false" if awaitHealthCheck "$CONTAINER"; then + successful="true" + fi + if "$LOGS"; then + docker logs -n 30 "$CONTAINER" + fi + removeContainer "$CONTAINER" + + if "$successful"; then echo "successful" + exit 0 else echo "failed" + exit 1 fi - removeContainer "$CONTAINER" ) From 37efa66d2af5aa4f054fd0b8bed5b34afc44dd05 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Tue, 23 Nov 2021 01:05:10 +0100 Subject: [PATCH 016/116] ~ fix permissions, untested --- commands/lgsm-update-uid-gid | 2 ++ 1 file changed, 2 insertions(+) diff --git a/commands/lgsm-update-uid-gid b/commands/lgsm-update-uid-gid index 882bea5..455f4da 100644 --- a/commands/lgsm-update-uid-gid +++ b/commands/lgsm-update-uid-gid @@ -8,8 +8,10 @@ if [ "$(id --user "$USER_ID")" != "$USER_ID" ] || [ "$(id --group "$USER_ID")" ! echo "[setupUser] changing user id" old_user_id="$(id --user "$USER_ID")" usermod -u "$USER_ID" "$USER_NAME" + find / -uid "$old_user_id" -exec chown "$USER_ID" \; echo "[setupUser] changing group id" old_group_id="$(id --group "$USER_ID")" groupmod -g "$GROUP_ID" "$GROUP_NAME" + find / -gid "$old_group_id" -exec chown ":$GROUP_ID" \; fi From 043ea82d9da90046faa5fb57372d3594934b49de Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Tue, 23 Nov 2021 01:10:10 +0100 Subject: [PATCH 017/116] ~ moved results folder --- .gitignore | 2 +- tests/full.sh | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 5c68a54..9742426 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ *~ -results \ No newline at end of file +tests/results \ No newline at end of file diff --git a/tests/full.sh b/tests/full.sh index 5b708aa..0257fe0 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -42,8 +42,9 @@ while [ $# -ge 1 ]; do done # create results folder -rm -rf "$ROOT_FOLDER/results" -mkdir -p "$ROOT_FOLDER/results" +RESULTS="$ROOT_FOLDER/tests/results" +rm -rf "$RESULTS" +mkdir -p "$RESULTS" ( working_folder="$(mktemp -d)" cd "$working_folder" @@ -71,16 +72,16 @@ mkdir -p "$ROOT_FOLDER/results" echo "testing: $server_code" if [ -z "$GAMESERVER" ] || [ "$server_code" = "$GAMESERVER" ]; then ( - if ./tests/quick.sh --logs --version "$VERSION" "$server_code" > "results/$server_code.log" 2>&1; then - mv "results/$server_code.log" "results/successful.$server_code.log" + if ./tests/quick.sh --logs --version "$VERSION" "$server_code" > "$RESULTS/$server_code.log" 2>&1; then + mv "$RESULTS/$server_code.log" "$RESULTS/successful.$server_code.log" else - mv "results/$server_code.log" "results/failed.$server_code.log" + mv "$RESULTS/$server_code.log" "$RESULTS/failed.$server_code.log" fi ) & subprocesses+=("$!") fi done < <(echo "$server_list") - echo "successful: $(find "$ROOT_FOLDER/results/" -iname "successful.*" | wc -l)" - echo "failed: $(find "$ROOT_FOLDER/results/" -iname "failed.*" | wc -l)" + echo "successful: $(find "$RESULTS/" -iname "successful.*" | wc -l)" + echo "failed: $(find "$RESULTS/" -iname "failed.*" | wc -l)" ) From 5ad952779530645a55b5fb676429e1428a14b2e9 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 24 Nov 2021 00:17:09 +0100 Subject: [PATCH 018/116] fix full.sh wait until done --- setup/installDependencies.sh | 5 ++++- tests/full.sh | 33 +++++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/setup/installDependencies.sh b/setup/installDependencies.sh index af537fd..de48f01 100644 --- a/setup/installDependencies.sh +++ b/setup/installDependencies.sh @@ -22,6 +22,9 @@ if [ "${#cmds[@]}" -gt "0" ]; then # install dependencies for cmd in "${cmds[@]}"; do - eval "DEBIAN_FRONTEND=noninteractive $cmd" + eval "DEBIAN_FRONTEND=noninteractive $cmd" || ( + apt-get update + eval "DEBIAN_FRONTEND=noninteractive $cmd" + ) done fi diff --git a/tests/full.sh b/tests/full.sh index 0257fe0..98b2fb6 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -5,10 +5,10 @@ set -o pipefail set -o nounset VERSION="" -GAMESERVER="" +GAMESERVER=() PARRALEL="" PARRALEL="$(lscpu -p | grep -Ev '^#' | sort -u -t, -k 2,4 | wc -l)" -ROOT_FOLDER="$(realpath "$(dirname "$0")")/.." +ROOT_FOLDER="$(realpath "$(dirname "$0")/..")" while [ $# -ge 1 ]; do key="$1" shift @@ -37,14 +37,22 @@ while [ $# -ge 1 ]; do echo "unknown option $key" exit 1 fi - GAMESERVER="$key";; + GAMESERVER+=("$key");; esac done # create results folder RESULTS="$ROOT_FOLDER/tests/results" -rm -rf "$RESULTS" +if [ "${#GAMESERVER[@]}" = "0" ]; then + rm -rf "$RESULTS" +else + # rerun only remove specific log + for servercode in "${GAMESERVER[@]}"; do + rm -rf "${RESULTS:?}/"*".$servercode.log" + done +fi mkdir -p "$RESULTS" + ( working_folder="$(mktemp -d)" cd "$working_folder" @@ -57,6 +65,7 @@ mkdir -p "$RESULTS" rm -rf "$working_folder" > /dev/null 2>&1 cd "$ROOT_FOLDER" + # only start $PARRALEL amount of tests while [ "${#subprocesses[@]}" -ge "$PARRALEL" ]; do sleep 1s temp=() @@ -69,8 +78,8 @@ mkdir -p "$RESULTS" done server_code="$(grep -oE '^\S*' <<< "$line")" - echo "testing: $server_code" - if [ -z "$GAMESERVER" ] || [ "$server_code" = "$GAMESERVER" ]; then + if [ "${#GAMESERVER[@]}" = "0" ] || grep -qF "$server_code" <<< "${GAMESERVER[@]}"; then + echo "testing: $server_code" ( if ./tests/quick.sh --logs --version "$VERSION" "$server_code" > "$RESULTS/$server_code.log" 2>&1; then mv "$RESULTS/$server_code.log" "$RESULTS/successful.$server_code.log" @@ -82,6 +91,18 @@ mkdir -p "$RESULTS" fi done < <(echo "$server_list") + # await every job is done + while [ "${#subprocesses[@]}" -gt "0" ]; do + sleep 1s + temp=() + for pid in "${subprocesses[@]}"; do + if ps -p "$pid" -o pid= > /dev/null 2>&1; then + temp+=("$pid") + fi + done + subprocesses=("${temp[@]}") + done + echo "successful: $(find "$RESULTS/" -iname "successful.*" | wc -l)" echo "failed: $(find "$RESULTS/" -iname "failed.*" | wc -l)" ) From 37b34409593c115dc71f6152836fcca9bc3a00d2 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 24 Nov 2021 01:06:14 +0100 Subject: [PATCH 019/116] fix empty arguments + tty issues --- tests/full.sh | 4 ++-- tests/internal/build.sh | 5 +++-- tests/quick.sh | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/full.sh b/tests/full.sh index 98b2fb6..99d8ecc 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -4,7 +4,7 @@ set -o errexit set -o pipefail set -o nounset -VERSION="" +VERSION="master" GAMESERVER=() PARRALEL="" PARRALEL="$(lscpu -p | grep -Ev '^#' | sort -u -t, -k 2,4 | wc -l)" @@ -81,7 +81,7 @@ mkdir -p "$RESULTS" if [ "${#GAMESERVER[@]}" = "0" ] || grep -qF "$server_code" <<< "${GAMESERVER[@]}"; then echo "testing: $server_code" ( - if ./tests/quick.sh --logs --version "$VERSION" "$server_code" > "$RESULTS/$server_code.log" 2>&1; then + if ./tests/quick.sh --logs --version "$VERSION" "$server_code" | tee /dev/tty > "$RESULTS/$server_code.log" 2>&1; then mv "$RESULTS/$server_code.log" "$RESULTS/successful.$server_code.log" else mv "$RESULTS/$server_code.log" "$RESULTS/failed.$server_code.log" diff --git a/tests/internal/build.sh b/tests/internal/build.sh index 2817468..e1a6d1b 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -51,11 +51,12 @@ done cd "$(dirname "$0")/../.." #shellcheck disable=SC2206 -cmd=(docker build -t "$image:lgsm" $clear --target linuxgsm "$lgsm_version" .) +cmd=(docker build -t "$image:lgsm" $clear --target linuxgsm $lgsm_version .) echo "${cmd[@]}" "${cmd[@]}" if [ -n "$server" ]; then - cmd=(docker build -t "$image:specific" --build-arg "LGSM_GAMESERVER=$server" "$lgsm_version" .) + #shellcheck disable=SC2206 + cmd=(docker build -t "$image:specific" --build-arg "LGSM_GAMESERVER=$server" $lgsm_version .) echo "${cmd[@]}" "${cmd[@]}" fi diff --git a/tests/quick.sh b/tests/quick.sh index 3be7abd..f2480f9 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -68,8 +68,10 @@ CONTAINER="linuxgsm-$GAMESERVER" ( cd "$(dirname "$0")" removeContainer "$CONTAINER" - ./internal/build.sh "$CLEAR" "${VERSION[@]}" "$GAMESERVER" - ./internal/run.sh --container "$CONTAINER" --detach "${VOLUME[@]}" "$DEBUG" specific + #shellcheck disable=SC2068 + ./internal/build.sh $CLEAR ${VERSION[@]} "$GAMESERVER" + #shellcheck disable=SC2068 + ./internal/run.sh --container "$CONTAINER" --detach ${VOLUME[@]} "$DEBUG" specific successful="false" if awaitHealthCheck "$CONTAINER"; then From 7c22f91da9fb42ad5b197f9f27d117146c384bcf Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 24 Nov 2021 19:56:19 +0100 Subject: [PATCH 020/116] fix full.sh docker logs --- tests/full.sh | 20 ++++++++------------ tests/internal/api_docker.sh | 6 +++++- tests/internal/api_various.sh | 16 ++++++++++++++++ tests/quick.sh | 3 ++- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/tests/full.sh b/tests/full.sh index 99d8ecc..595fb9f 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -41,6 +41,9 @@ while [ $# -ge 1 ]; do esac done +# shellcheck source=tests/internal/api_various.sh +source "$(dirname "$0")/internal/api_various.sh" + # create results folder RESULTS="$ROOT_FOLDER/tests/results" if [ "${#GAMESERVER[@]}" = "0" ]; then @@ -54,15 +57,9 @@ fi mkdir -p "$RESULTS" ( - working_folder="$(mktemp -d)" - cd "$working_folder" - wget -O "linuxgsm.sh" "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/$VERSION/linuxgsm.sh" - chmod +x "linuxgsm.sh" - server_list="$(./linuxgsm.sh list)" - subprocesses=() - while IFS=$'\n' read -r line; do - rm -rf "$working_folder" > /dev/null 2>&1 + mapfile -d $'\n' -t servers < <(getServerCodeList "$VERSION") + for server_code in "${servers[@]}"; do cd "$ROOT_FOLDER" # only start $PARRALEL amount of tests @@ -77,19 +74,18 @@ mkdir -p "$RESULTS" subprocesses=("${temp[@]}") done - server_code="$(grep -oE '^\S*' <<< "$line")" if [ "${#GAMESERVER[@]}" = "0" ] || grep -qF "$server_code" <<< "${GAMESERVER[@]}"; then echo "testing: $server_code" ( - if ./tests/quick.sh --logs --version "$VERSION" "$server_code" | tee /dev/tty > "$RESULTS/$server_code.log" 2>&1; then + if ./tests/quick.sh --logs --version "$VERSION" "$server_code" > "$RESULTS/$server_code.log" 2>&1; then mv "$RESULTS/$server_code.log" "$RESULTS/successful.$server_code.log" else mv "$RESULTS/$server_code.log" "$RESULTS/failed.$server_code.log" fi - ) & + ) | tee /dev/tty > /dev/null 2>&1 & subprocesses+=("$!") fi - done < <(echo "$server_list") + done # await every job is done while [ "${#subprocesses[@]}" -gt "0" ]; do diff --git a/tests/internal/api_docker.sh b/tests/internal/api_docker.sh index 4a8557f..d5e767d 100644 --- a/tests/internal/api_docker.sh +++ b/tests/internal/api_docker.sh @@ -20,8 +20,12 @@ function isContainerHealthHealthy() { getContainerState "$container" | grep -qF '(healthy)' } -function removeContainer() { +function stopContainer() { docker stop "$1" > /dev/null 2>&1 || true +} + +function removeContainer() { + stopContainer "$1" docker rm "$1" > /dev/null 2>&1 || true } diff --git a/tests/internal/api_various.sh b/tests/internal/api_various.sh index a9c6648..0aaa929 100644 --- a/tests/internal/api_various.sh +++ b/tests/internal/api_various.sh @@ -7,3 +7,19 @@ function isEmpty() { function contains() { echo "$1" | grep -qF "$2" } + +function getServerList() { + linuxgsm_version="$1" + working_folder="$(mktemp -d)" + ( + cd "$working_folder" > /dev/null 2>&1 || exit 1 + wget -O "linuxgsm.sh" "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/$linuxgsm_version/linuxgsm.sh" > /dev/null 2>&1 + chmod +x "linuxgsm.sh" > /dev/null 2>&1 + ./linuxgsm.sh list + rm -rf "$working_folder" > /dev/null 2>&1 + ) +} + +function getServerCodeList() { + getServerList "$1" | grep -oE '^\S*' +} \ No newline at end of file diff --git a/tests/quick.sh b/tests/quick.sh index f2480f9..5f70f04 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -77,8 +77,9 @@ CONTAINER="linuxgsm-$GAMESERVER" if awaitHealthCheck "$CONTAINER"; then successful="true" fi + stopContainer "$CONTAINER" if "$LOGS"; then - docker logs -n 30 "$CONTAINER" + docker logs "$CONTAINER" fi removeContainer "$CONTAINER" From 50548e87bf6496fcb43d8a52e1059acb2ca961be Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 24 Nov 2021 20:21:48 +0100 Subject: [PATCH 021/116] initial docker image creation automation --- tests/createImages.sh | 20 ++++++++++++++++++++ tests/internal/build.sh | 40 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 tests/createImages.sh diff --git a/tests/createImages.sh b/tests/createImages.sh new file mode 100644 index 0000000..7e8d746 --- /dev/null +++ b/tests/createImages.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +VERSION="$1" +IMAGE="jusito/linuxgsm" + +# shellcheck source=tests/internal/api_various.sh +source "$(dirname "$0")/internal/api_various.sh" + +( + cd "$(dirname "$0")" + mapfile -d $'\n' -t servers < <(getServerCodeList "$VERSION") + ./internal/build.sh --no-cache --image "$IMAGE" --version "$VERSION" + for server_code in "${servers[@]}"; do + ./internal/build.sh --image "$IMAGE" --version "$VERSION" --latest "$server_code" + done +) diff --git a/tests/internal/build.sh b/tests/internal/build.sh index e1a6d1b..3b66002 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -13,6 +13,9 @@ server="" lgsm_version="" clear="" image="lgsm-test" +tag_lgsm="latest" +latest="false" +push="false" while [ $# -ge 1 ]; do key="$1" shift @@ -28,18 +31,26 @@ while [ $# -ge 1 ]; do echo "--no-cache" echo "-i x target image, default=lgsm-test" echo "--image x" + echo "--latest every created image is also tagged as latest" + echo "--push every image is also pushed" echo "" echo "server:" echo "gmodserver build linuxgsm image and specific gmodserver" echo "..." exit 0;; -v|--version) + tag_lgsm="$1" lgsm_version="--build-arg=\"LGSM_VERSION=$1\"" echo "using lgsm version ${lgsm_version:-default}" shift ;; -i|--image) - image="$key";; + image="$1" + shift;; + --latest) + latest="true";; + --push) + push="true";; -c|--no-cache) clear="--no-cache";; *) @@ -51,12 +62,35 @@ done cd "$(dirname "$0")/../.." #shellcheck disable=SC2206 -cmd=(docker build -t "$image:lgsm" $clear --target linuxgsm $lgsm_version .) +cmd=(docker build -t "$image:$tag_lgsm" $clear --target linuxgsm $lgsm_version .) echo "${cmd[@]}" "${cmd[@]}" + +if "$push"; then + docker push "$image:$tag_lgsm" +fi + +if "$latest"; then + docker tag "$image:$tag_lgsm" "$image:latest" + if "$push"; then + docker push "$image:latest" + fi +fi + + if [ -n "$server" ]; then #shellcheck disable=SC2206 - cmd=(docker build -t "$image:specific" --build-arg "LGSM_GAMESERVER=$server" $lgsm_version .) + cmd=(docker build -t "$image:${server}_$tag_lgsm" --build-arg "LGSM_GAMESERVER=$server" $lgsm_version .) echo "${cmd[@]}" "${cmd[@]}" + + if "$push"; then + docker push "$image:${server}_$tag_lgsm" + fi + if "$latest"; then + docker tag "$image:${server}_$tag_lgsm" "$image:${server}" + if "$push"; then + docker push "$image:${server}" + fi + fi fi From 5a27eb87b953eb44f3d6f379a86d2c79f9d3d827 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 24 Nov 2021 20:38:32 +0100 Subject: [PATCH 022/116] fix illegal server in list --- tests/internal/api_various.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/internal/api_various.sh b/tests/internal/api_various.sh index 0aaa929..f8c4279 100644 --- a/tests/internal/api_various.sh +++ b/tests/internal/api_various.sh @@ -15,7 +15,7 @@ function getServerList() { cd "$working_folder" > /dev/null 2>&1 || exit 1 wget -O "linuxgsm.sh" "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/$linuxgsm_version/linuxgsm.sh" > /dev/null 2>&1 chmod +x "linuxgsm.sh" > /dev/null 2>&1 - ./linuxgsm.sh list + ./linuxgsm.sh list | grep -vE '^fetching' rm -rf "$working_folder" > /dev/null 2>&1 ) } From 3f1bc30c73ae22261db28216f243374a5b4bfe04 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 24 Nov 2021 22:27:33 +0100 Subject: [PATCH 023/116] fix healthcheck, improved logging --- Dockerfile | 7 ++++--- setup/entrypoint.sh | 5 +++++ setup/installDependencies.sh | 2 ++ tests/full.sh | 3 +++ tests/internal/build.sh | 5 ++++- tests/internal/run.sh | 5 +++-- tests/quick.sh | 4 ++-- 7 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index c1dde12..224a8d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,8 @@ ENV LGSM_VERSION="$LGSM_VERSION" \ LANGUAGE="en_US.UTF-8" \ LC_ALL="en_US.UTF-8" \ TERM="xterm" \ - SUPERCRONIC_CONFIG="/home/linuxgsm-scripts/cron.config" + SUPERCRONIC_CONFIG="/home/linuxgsm-scripts/cron.config" \ + LGSM_STARTED="/home/linuxgsm/server.started" COPY --from=dependencyStage \ /usr/local/bin/gosu \ @@ -57,8 +58,8 @@ RUN set -eux; \ installGamedig.sh; \ cleanImage.sh -HEALTHCHECK --start-period=3600s --interval=90s --timeout=75s --retries=3 \ - CMD lgsm-monitor || exit 1 +HEALTHCHECK --start-period=3600s --interval=90s --timeout=600s --retries=3 \ + CMD [ -f "$LGSM_STARTED" ] && lgsm-monitor || exit 1 VOLUME "$LGSM_PATH" WORKDIR "$LGSM_PATH" diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index 1e8c555..1f8c8cd 100644 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -5,6 +5,7 @@ set -o pipefail set -o nounset cd "$LGSM_PATH" +rm "$LGSM_STARTED" > /dev/null 2>&1 || true lgsm-update-uid-gid lgsm-fix-permission @@ -21,6 +22,7 @@ fi lgsm-start trap lgsm-stop SIGTERM SIGINT lgsm-cron-start > /dev/null 2>&1 & +touch "$LGSM_STARTED" # tmux in background with log usable for docker # alternative solution: lgsm-tmux-attach | tee /dev/tty & @@ -30,3 +32,6 @@ lgsm-tmux-attach | tee tmux.pipe & while read -r line; do echo "$line" done < tmux.pipe +rm "$LGSM_STARTED" > /dev/null 2>&1 || true +echo "entrypoint ended" + diff --git a/setup/installDependencies.sh b/setup/installDependencies.sh index de48f01..0db99d2 100644 --- a/setup/installDependencies.sh +++ b/setup/installDependencies.sh @@ -21,7 +21,9 @@ if [ "${#cmds[@]}" -gt "0" ]; then echo steam steam/license note '' | debconf-set-selections # install dependencies + echo "installing dependencies:" for cmd in "${cmds[@]}"; do + echo "$cmd" eval "DEBIAN_FRONTEND=noninteractive $cmd" || ( apt-get update eval "DEBIAN_FRONTEND=noninteractive $cmd" diff --git a/tests/full.sh b/tests/full.sh index 595fb9f..5f69dbe 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -57,6 +57,9 @@ fi mkdir -p "$RESULTS" ( + echo "building linuxgsm base once" + ./tests/internal/build.sh --version "$VERSION" + subprocesses=() mapfile -d $'\n' -t servers < <(getServerCodeList "$VERSION") for server_code in "${servers[@]}"; do diff --git a/tests/internal/build.sh b/tests/internal/build.sh index 3b66002..f77b526 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -13,7 +13,7 @@ server="" lgsm_version="" clear="" image="lgsm-test" -tag_lgsm="latest" +tag_lgsm="dev" latest="false" push="false" while [ $# -ge 1 ]; do @@ -51,6 +51,9 @@ while [ $# -ge 1 ]; do latest="true";; --push) push="true";; + --tag) + tag="$1" + shift;; -c|--no-cache) clear="--no-cache";; *) diff --git a/tests/internal/run.sh b/tests/internal/run.sh index 030f890..58d4c89 100644 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -49,8 +49,9 @@ while [ $# -ge 1 ]; do -c|--container) container="$1" shift;; - lgsm|specific) - tag="$key";; + -t|--tag) + tag="$1" + shift;; *) echo "$key is argument for docker container" args+=("$key");; diff --git a/tests/quick.sh b/tests/quick.sh index 5f70f04..9fe4e5e 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -69,9 +69,9 @@ CONTAINER="linuxgsm-$GAMESERVER" cd "$(dirname "$0")" removeContainer "$CONTAINER" #shellcheck disable=SC2068 - ./internal/build.sh $CLEAR ${VERSION[@]} "$GAMESERVER" + ./internal/build.sh $CLEAR ${VERSION[@]} --latest "$GAMESERVER" #shellcheck disable=SC2068 - ./internal/run.sh --container "$CONTAINER" --detach ${VOLUME[@]} "$DEBUG" specific + ./internal/run.sh --container "$CONTAINER" --detach ${VOLUME[@]} "$DEBUG" --tag "$GAMESERVER" successful="false" if awaitHealthCheck "$CONTAINER"; then From e9fa7a93e79b1150ddcb6af111af8af2704f6d18 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 24 Nov 2021 22:57:55 +0100 Subject: [PATCH 024/116] fix wsl2 != ubuntu --- tests/internal/build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/internal/build.sh b/tests/internal/build.sh index f77b526..9622ae9 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -10,7 +10,7 @@ source "$(dirname "$0")/api_docker.sh" source "$(dirname "$0")/api_various.sh" server="" -lgsm_version="" +lgsm_version=() clear="" image="lgsm-test" tag_lgsm="dev" @@ -40,7 +40,7 @@ while [ $# -ge 1 ]; do exit 0;; -v|--version) tag_lgsm="$1" - lgsm_version="--build-arg=\"LGSM_VERSION=$1\"" + lgsm_version=("--build-arg" "LGSM_VERSION=$1") echo "using lgsm version ${lgsm_version:-default}" shift ;; @@ -65,7 +65,7 @@ done cd "$(dirname "$0")/../.." #shellcheck disable=SC2206 -cmd=(docker build -t "$image:$tag_lgsm" $clear --target linuxgsm $lgsm_version .) +cmd=(docker build -t "$image:$tag_lgsm" $clear --target linuxgsm ${lgsm_version[@]} .) echo "${cmd[@]}" "${cmd[@]}" @@ -83,7 +83,7 @@ fi if [ -n "$server" ]; then #shellcheck disable=SC2206 - cmd=(docker build -t "$image:${server}_$tag_lgsm" --build-arg "LGSM_GAMESERVER=$server" $lgsm_version .) + cmd=(docker build -t "$image:${server}_$tag_lgsm" --build-arg "LGSM_GAMESERVER=$server" ${lgsm_version[@]} .) echo "${cmd[@]}" "${cmd[@]}" From 0601f6a20c2f6dce85378a544dce1719c29409a5 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 24 Nov 2021 23:42:21 +0100 Subject: [PATCH 025/116] + build arg fail early --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 224a8d7..9c9aa5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -68,7 +68,7 @@ WORKDIR "$LGSM_PATH" FROM linuxgsm as specific ARG LGSM_GAMESERVER="" ENV LGSM_GAMESERVER="$LGSM_GAMESERVER" -RUN set -eux; \ +RUN set -eux; echo "${LGSM_GAMESERVER:?}"; \ installDependencies.sh "$LGSM_GAMESERVER"; \ createAlias.sh "$LGSM_GAMESERVER"; \ cleanImage.sh From 87b0c1b7ea8791f6c9d509c128bd5a283230eb2d Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 25 Nov 2021 19:31:33 +0100 Subject: [PATCH 026/116] fix build-arg hidden on some systems --- Dockerfile | 4 ++-- tests/internal/build.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9c9aa5d..187003b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,8 +66,8 @@ WORKDIR "$LGSM_PATH" # install server specific dependencies FROM linuxgsm as specific -ARG LGSM_GAMESERVER="" -ENV LGSM_GAMESERVER="$LGSM_GAMESERVER" +ARG ARG_LGSM_GAMESERVER="" +ENV LGSM_GAMESERVER="$ARG_LGSM_GAMESERVER" RUN set -eux; echo "${LGSM_GAMESERVER:?}"; \ installDependencies.sh "$LGSM_GAMESERVER"; \ createAlias.sh "$LGSM_GAMESERVER"; \ diff --git a/tests/internal/build.sh b/tests/internal/build.sh index 9622ae9..e6c03d4 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -83,7 +83,7 @@ fi if [ -n "$server" ]; then #shellcheck disable=SC2206 - cmd=(docker build -t "$image:${server}_$tag_lgsm" --build-arg "LGSM_GAMESERVER=$server" ${lgsm_version[@]} .) + cmd=(docker build -t "$image:${server}_$tag_lgsm" --build-arg "ARG_LGSM_GAMESERVER=$server" ${lgsm_version[@]} .) echo "${cmd[@]}" "${cmd[@]}" From 7ed95ed98eb35086ebe04b12075c29da1acbbb97 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 25 Nov 2021 19:45:52 +0100 Subject: [PATCH 027/116] + rerun --- tests/full.sh | 21 ++++++++++++++++++--- tests/internal/run.sh | 7 +++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/tests/full.sh b/tests/full.sh index 5f69dbe..409435d 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -9,6 +9,7 @@ GAMESERVER=() PARRALEL="" PARRALEL="$(lscpu -p | grep -Ev '^#' | sort -u -t, -k 2,4 | wc -l)" ROOT_FOLDER="$(realpath "$(dirname "$0")/..")" +RERUN="false" while [ $# -ge 1 ]; do key="$1" shift @@ -23,6 +24,7 @@ while [ $# -ge 1 ]; do echo "--version x use linuxgsm version x e.g. \"v21.4.1\"" echo "-c x run x servers in parralel, default x = physical cores" echo "--cpus x" + echo "--rerun check results and runs every gameserver which isn't successful" echo "" echo "server default empty = all, otherwise e.g. gmodserver" exit 0;; @@ -32,6 +34,9 @@ while [ $# -ge 1 ]; do -c|--cpus) PARRALEL="$1" shift;; + --rerun) + RERUN="true" + ;; *) if grep -qE '^-' <<< "$key"; then echo "unknown option $key" @@ -40,14 +45,19 @@ while [ $# -ge 1 ]; do GAMESERVER+=("$key");; esac done +testAllServer="$([ "${#GAMESERVER[@]}" = "0" ] && echo true || echo false )" # shellcheck source=tests/internal/api_various.sh source "$(dirname "$0")/internal/api_various.sh" -# create results folder +# prepare results folder RESULTS="$ROOT_FOLDER/tests/results" if [ "${#GAMESERVER[@]}" = "0" ]; then - rm -rf "$RESULTS" + if "$RERUN"; then + find "$RESULTS" -type f ! -name "successful.*" -exec rm -f "{}" \; + else + rm -rf "$RESULTS" + fi else # rerun only remove specific log for servercode in "${GAMESERVER[@]}"; do @@ -77,7 +87,12 @@ mkdir -p "$RESULTS" subprocesses=("${temp[@]}") done - if [ "${#GAMESERVER[@]}" = "0" ] || grep -qF "$server_code" <<< "${GAMESERVER[@]}"; then + + isServercodeInServerlist="$(grep -qF "$server_code" <<< "${GAMESERVER[@]}" && echo true || echo false )" + serverDidntStartSuccessful="$([ ! -f "$RESULTS/successful.$server_code.log" ] && echo true || echo false )" + testThisServercode="$( ("$testAllServer" || "$isServercodeInServerlist") && echo true || echo false )" + rerunIsFine="$( ( ! "$RERUN" || "$serverDidntStartSuccessful" ) && echo true || echo false )" + if "$testThisServercode" && "$rerunIsFine"; then echo "testing: $server_code" ( if ./tests/quick.sh --logs --version "$VERSION" "$server_code" > "$RESULTS/$server_code.log" 2>&1; then diff --git a/tests/internal/run.sh b/tests/internal/run.sh index 58d4c89..fa2d774 100644 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -53,8 +53,11 @@ while [ $# -ge 1 ]; do tag="$1" shift;; *) - echo "$key is argument for docker container" - args+=("$key");; + if [ -n "$key" ]; then + echo "$key is argument for docker container" + args+=("$key") + fi + ;; esac done From d1bbba62e880161165892e60663b1add95204162 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 25 Nov 2021 19:51:51 +0100 Subject: [PATCH 028/116] + feat interuptable testing --- tests/full.sh | 7 +++++++ tests/quick.sh | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/tests/full.sh b/tests/full.sh index 409435d..37ca00d 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -71,6 +71,13 @@ mkdir -p "$RESULTS" ./tests/internal/build.sh --version "$VERSION" subprocesses=() + function handleInterrupt() { + for pid in "${subprocesses[@]}"; do + kill -s SIGINT "$pid" || true + done + } + trap handleInterrupt SIGTERM SIGINT + mapfile -d $'\n' -t servers < <(getServerCodeList "$VERSION") for server_code in "${servers[@]}"; do cd "$ROOT_FOLDER" diff --git a/tests/quick.sh b/tests/quick.sh index 9fe4e5e..a541575 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -65,6 +65,11 @@ if [ -z "$GAMESERVER" ]; then fi CONTAINER="linuxgsm-$GAMESERVER" +function handleInterrupt() { + removeContainer "$CONTAINER" +} +trap handleInterrupt SIGTERM SIGINT + ( cd "$(dirname "$0")" removeContainer "$CONTAINER" From a61dde301b74fc859b25c90573b57ecc77030aef Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 25 Nov 2021 19:52:48 +0100 Subject: [PATCH 029/116] ~ changed healthcheck intervall 90 / 75 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 187003b..fcd7478 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,7 +58,7 @@ RUN set -eux; \ installGamedig.sh; \ cleanImage.sh -HEALTHCHECK --start-period=3600s --interval=90s --timeout=600s --retries=3 \ +HEALTHCHECK --start-period=3600s --interval=90s --timeout=75s --retries=3 \ CMD [ -f "$LGSM_STARTED" ] && lgsm-monitor || exit 1 VOLUME "$LGSM_PATH" From 5bdae26eef24c8409f680b70d5af6bb39ece053a Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 25 Nov 2021 21:24:46 +0100 Subject: [PATCH 030/116] fix healthcheck report to early unhealthy --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index fcd7478..d563154 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,7 +58,7 @@ RUN set -eux; \ installGamedig.sh; \ cleanImage.sh -HEALTHCHECK --start-period=3600s --interval=90s --timeout=75s --retries=3 \ +HEALTHCHECK --start-period=3600s --interval=60s --timeout=900s --retries=3 \ CMD [ -f "$LGSM_STARTED" ] && lgsm-monitor || exit 1 VOLUME "$LGSM_PATH" From 2eb1507d9fa0df4a9fb0470fce183f6dfa56283d Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 25 Nov 2021 22:13:06 +0100 Subject: [PATCH 031/116] + lgsm-load-config --- Dockerfile | 5 +++- commands/lgsm-load-config | 61 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 commands/lgsm-load-config diff --git a/Dockerfile b/Dockerfile index d563154..849198b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,10 @@ ENV LGSM_VERSION="$LGSM_VERSION" \ LC_ALL="en_US.UTF-8" \ TERM="xterm" \ SUPERCRONIC_CONFIG="/home/linuxgsm-scripts/cron.config" \ - LGSM_STARTED="/home/linuxgsm/server.started" + LGSM_STARTED="/home/linuxgsm/server.started" \ + LGSM_PATTERN_CONFIG='%s="%s"' \ + LGSM_PATTERN_COMMON='%s="%s"' \ + LGSM_PATTERN_GAME='%s="%s"' COPY --from=dependencyStage \ /usr/local/bin/gosu \ diff --git a/commands/lgsm-load-config b/commands/lgsm-load-config new file mode 100644 index 0000000..22676c2 --- /dev/null +++ b/commands/lgsm-load-config @@ -0,0 +1,61 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +if [ -z "$LGSM_GAMESERVER" ]; then + echo "[error][lgsm-load-config] \$LGSM_GAMESERVER is unset but needed for this script, abort" + exit 10 +fi + +configfile_default="$LGSM_PATH/lgsm/config-default/config-lgsm/$LGSM_GAMESERVER/_default.cfg" +configfile_common="$LGSM_PATH/lgsm/config-lgsm/$LGSM_GAMESERVER/common.cfg" +configfile_game="$( lgsm-details | grep -Eo 'Config file:.*' | grep -o '/.*' || true )" + +if [ ! -f "$configfile_default" ]; then + echo "[error][lgsm-load-config] expected _default config file doesn't exist at \"$configfile_default\"" + exit 11 +fi + +function handleEnvironmentVariablePrefix() { + prefix="$1" + target_file="$2" + pattern="$3" + check_file="$4" + for config in $( env | grep -Eo "^$prefix[^=]*" ); do + key="${config:${#prefix}}" + value="$( eval "\$$config" )" + echo "[info][lgsm-load-config] processing $key" + if [ -z "$check_file" ]; then + if grep -Eo "^$key" "$check_file"; then + echo "[info][lgsm-load-config] $key is part of $check_file, adding to $target_file" + #shellcheck disable=SC2059 + printf "$pattern\n" "$key" "$value" >> "$target_file" + else + echo "[error][lgsm-load-config] provided environment variable $config seems illegal for current gameserver $LGSM_GAMESERVER" + exit 12 + fi + else + echo "[info][lgsm-load-config] $key is part of $check_file, adding to $target_file" + echo "$key=$value" >> "$target_file" + fi + + done +} + + +rm -f "$configfile_common" +# CONFIG options should be safe to use => fail if not correct because we can verify they are part of _default.cfg +handleEnvironmentVariablePrefix "CONFIG_" "$configfile_common" "$LGSM_PATTERN_CONFIG" "$configfile_default" +# COMMON options will be directly added +handleEnvironmentVariablePrefix "COMMON_" "$configfile_common" "$LGSM_PATTERN_COMMON" + +# GAME_ is added to game specific config file +# TODO probably there need to be more options for non cfg configs, e.g. json format or so +if [ -f "$configfile_game" ]; then + rm -f "$configfile_game" + handleEnvironmentVariablePrefix "GAME_" "$configfile_game" "$LGSM_PATTERN_GAME" +else + echo "[warning][lgsm-load-config] couldn't get config file for $LGSM_GAMESERVER, therefore skipped all environment variables with \$GAME_ " +fi From 946bcbe4595b8ec3d5a637c82ef7e4a6ffd11d52 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 25 Nov 2021 23:39:28 +0100 Subject: [PATCH 032/116] + tests + shellcheck fix --- .gitignore | 3 +- commands/lgsm-load-config | 1 + tests/features.sh | 22 ++++++++ tests/functions/testCron.sh | 89 +++++++++++++++++++++++++++++++ tests/functions/testDockerLogs.sh | 23 ++++++++ tests/internal/build.sh | 3 -- tests/internal/run.sh | 11 ++-- tests/shellcheck.sh | 2 +- 8 files changed, 143 insertions(+), 11 deletions(-) create mode 100644 tests/features.sh create mode 100644 tests/functions/testCron.sh create mode 100644 tests/functions/testDockerLogs.sh diff --git a/.gitignore b/.gitignore index 9742426..617cab2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ -tests/results \ No newline at end of file +tests/results +tests/functions/*.log \ No newline at end of file diff --git a/commands/lgsm-load-config b/commands/lgsm-load-config index 22676c2..bb31693 100644 --- a/commands/lgsm-load-config +++ b/commands/lgsm-load-config @@ -23,6 +23,7 @@ function handleEnvironmentVariablePrefix() { target_file="$2" pattern="$3" check_file="$4" + #shellcheck disable=SC1087 #prefix is no array for config in $( env | grep -Eo "^$prefix[^=]*" ); do key="${config:${#prefix}}" value="$( eval "\$$config" )" diff --git a/tests/features.sh b/tests/features.sh new file mode 100644 index 0000000..e086345 --- /dev/null +++ b/tests/features.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +VERSION="$1" +CLEAR="$( grep -qE '(-c|--clear)' <<< "$@" && echo true || echo false )" +GAMESERVER="gmodserver" +VOLUME="linuxgsm-$GAMESERVER-testFeatures" + + +( + cd "$(dirname "$0")/.." + if "$CLEAR"; then + docker volume rm "$VOLUME" || true + fi + ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + + ./tests/functions/testCron.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/functions/testDockerLogs.sh "$VERSION" "$GAMESERVER" "$VOLUME" +) diff --git a/tests/functions/testCron.sh b/tests/functions/testCron.sh new file mode 100644 index 0000000..3275188 --- /dev/null +++ b/tests/functions/testCron.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +VERSION="$1" +GAMESERVER="$2" +VOLUME="$3" +CONTAINER="linuxgsm-$GAMESERVER-testCron" +# shellcheck source=tests/internal/api_docker.sh +source "$(dirname "$0")/../internal/api_docker.sh" +# shellcheck source=tests/internal/api_various.sh +source "$(dirname "$0")/../internal/api_various.sh" + +( + cd "$(dirname "$0")/../.." + DOCKERFILE_CRONLOCATION="$(grep -Po '(?<=SUPERCRONIC_CONFIG=")[^"]*' Dockerfile)" + + ./tests/internal/build.sh "$VERSION" --latest "$GAMESERVER" + + function handleInterrupt() { + removeContainer "$CONTAINER" + exit 1 + } + trap handleInterrupt SIGTERM SIGINT ERR + + # initial run = no cron + removeContainer "$CONTAINER" + ./tests/internal/run.sh --container "$CONTAINER" --detach --volume "$VOLUME" --tag "$GAMESERVER" + if awaitHealthCheck "$CONTAINER"; then + if [ "0" != "$(docker exec -it "$CONTAINER" cat "$DOCKERFILE_CRONLOCATION" | wc -l)" ]; then + echo "[testCron] successful no cron job found" + else + echo "[error][testCron] container shouldn't have a cronjob" + exit 20 + fi + else + echo "[error][testCron] container is unhealthy" + exit 10 + fi + + # inject one cron + CRON_TEST1="* * * * echo \"hello world1\"" + removeContainer "$CONTAINER" + ./tests/internal/run.sh --container "$CONTAINER" --detach --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_test1=$CRON_TEST1" + if awaitHealthCheck "$CONTAINER"; then + crontab="$(docker exec -it "$CONTAINER" cat "$DOCKERFILE_CRONLOCATION")" + if [ "2" != "$(echo "$crontab" | wc -l)" ]; then + echo "[error][testCron] expected two cron lines, found $(echo "$crontab" | wc -l)" + exit 21 + elif ! grep -qE "^$CRON_TEST1" <<< "$crontab"; then + echo "[error][testCron] provided crontab isn't part of container but should be" + exit 22 + else + echo "[testCron] successfully tested one cronjob" + fi + else + echo "[error][testCron] container is unhealthy" + exit 10 + fi + + # inject multiple cron + CRON_TEST2="* * * * echo \"hello world2\"" + removeContainer "$CONTAINER" + ./tests/internal/run.sh --container "$CONTAINER" --detach --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_test1=$CRON_TEST1" "-e" "CRON_test2=$CRON_TEST2" + if awaitHealthCheck "$CONTAINER"; then + crontab="$(docker exec -it "$CONTAINER" cat "$DOCKERFILE_CRONLOCATION")" + if [ "3" != "$(echo "$crontab" | wc -l)" ]; then + echo "[error][testCron] expected 3 cron lines, found $(echo "$crontab" | wc -l)" + exit 23 + elif ! grep -qE "^$CRON_TEST1" <<< "$crontab"; then + echo "[error][testCron] provided first crontab isn't part of container but should be" + exit 24 + elif ! grep -qE "^$CRON_TEST2" <<< "$crontab"; then + echo "[error][testCron] provided second crontab isn't part of container but should be" + exit 25 + else + echo "[testCron] successfully tested two cronjobs" + echo "crontab:" + echo "$crontab" + fi + else + echo "[error][testCron] container is unhealthy" + exit 10 + fi + + removeContainer "$CONTAINER" +) diff --git a/tests/functions/testDockerLogs.sh b/tests/functions/testDockerLogs.sh new file mode 100644 index 0000000..51235cd --- /dev/null +++ b/tests/functions/testDockerLogs.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +VERSION="$1" +GAMESERVER="$2" +VOLUME="$3" + +( + cd "$(dirname "$0")/../.." + log="tests/functions/testDockerLogs.log" + ./tests/quick.sh --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" + if grep -qE 'VAC\s*secure\s*mode\s*is\s*activated.' "$log"; then + rm "$log" + echo "[testDockerLogs] successful" + exit 0 + else + echo "[testDockerLogs] failed, check $log" + exit 1 + fi +) diff --git a/tests/internal/build.sh b/tests/internal/build.sh index e6c03d4..0808892 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -51,9 +51,6 @@ while [ $# -ge 1 ]; do latest="true";; --push) push="true";; - --tag) - tag="$1" - shift;; -c|--no-cache) clear="--no-cache";; *) diff --git a/tests/internal/run.sh b/tests/internal/run.sh index fa2d774..c688bc3 100644 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -54,7 +54,7 @@ while [ $# -ge 1 ]; do shift;; *) if [ -n "$key" ]; then - echo "$key is argument for docker container" + echo "$key is additional argument to dockerr" args+=("$key") fi ;; @@ -68,12 +68,11 @@ if [ -z "$tag" ]; then fi #shellcheck disable=SC2206 -cmds=(docker run $docker_run_mode --name "$container" ${volume[@]} ${debug[@]} $quick "$IMAGE:$tag") -for arg in "$@"; do - if [ "$arg" != "$1" ]; then - cmds+=("$arg") - fi +cmds=(docker run $docker_run_mode --name "$container" ${volume[@]} ${debug[@]} $quick) +for arg in "${args[@]}"; do + cmds+=("$arg") done +cmds+=("$IMAGE:$tag") echo "${cmds[@]}" "${cmds[@]}" diff --git a/tests/shellcheck.sh b/tests/shellcheck.sh index 53da902..37ab4b6 100644 --- a/tests/shellcheck.sh +++ b/tests/shellcheck.sh @@ -7,7 +7,7 @@ set -o nounset cd "$(dirname "$0")/.." files=() - mapfile -d $'\0' files < <( find commands setup tests -type f -print0 ) + mapfile -d $'\0' files < <( find commands setup tests -type f ! -iname "*.log" -print0 ) shellcheck "${files[@]}" ) From ac5569fb3707e0d4de6b2ed41dc6585ba9b375c9 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Fri, 26 Nov 2021 02:44:53 +0100 Subject: [PATCH 033/116] + testFixPermissions.sh --- Dockerfile | 8 +-- commands/lgsm-fix-permission | 6 +- tests/features.sh | 3 + tests/functions/testCron.sh | 4 +- tests/functions/testFixPermissions.sh | 83 +++++++++++++++++++++++++++ tests/internal/build.sh | 2 +- tests/internal/run.sh | 2 +- 7 files changed, 98 insertions(+), 10 deletions(-) create mode 100644 tests/functions/testFixPermissions.sh diff --git a/Dockerfile b/Dockerfile index 849198b..962ceae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,8 +13,8 @@ RUN set -eux; \ # this stage should be usable by existing developers FROM ubuntu:21.04 as linuxgsm -ARG LGSM_VERSION="master" -ENV LGSM_VERSION="$LGSM_VERSION" \ +ARG ARG_LGSM_VERSION="master" +ENV LGSM_VERSION="${ARG_LGSM_VERSION:?}" \ LGSM_GAMESERVER="" \ USER_ID="750" \ GROUP_ID="750" \ @@ -70,8 +70,8 @@ WORKDIR "$LGSM_PATH" # install server specific dependencies FROM linuxgsm as specific ARG ARG_LGSM_GAMESERVER="" -ENV LGSM_GAMESERVER="$ARG_LGSM_GAMESERVER" -RUN set -eux; echo "${LGSM_GAMESERVER:?}"; \ +ENV LGSM_GAMESERVER="${ARG_LGSM_GAMESERVER:?}" +RUN set -eux; \ installDependencies.sh "$LGSM_GAMESERVER"; \ createAlias.sh "$LGSM_GAMESERVER"; \ cleanImage.sh diff --git a/commands/lgsm-fix-permission b/commands/lgsm-fix-permission index 0bf31fb..05cbcab 100644 --- a/commands/lgsm-fix-permission +++ b/commands/lgsm-fix-permission @@ -3,6 +3,10 @@ set -o errexit set -o nounset +# only volume needs to be fixed, everything else can be fixed by recreating the container + GROUP_NAME="$USER_NAME" chown -R "$USER_NAME:$GROUP_NAME" "$LGSM_PATH" -chmod 755 "$LGSM_PATH" +chmod 750 "$LGSM_PATH" +chmod 750 "$LGSM_PATH/$LGSM_GAMESERVER" +chmod -R ug+rw,o= "$LGSM_PATH" diff --git a/tests/features.sh b/tests/features.sh index e086345..7f910a3 100644 --- a/tests/features.sh +++ b/tests/features.sh @@ -19,4 +19,7 @@ VOLUME="linuxgsm-$GAMESERVER-testFeatures" ./tests/functions/testCron.sh "$VERSION" "$GAMESERVER" "$VOLUME" ./tests/functions/testDockerLogs.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/functions/testFixPermissions.sh "$VERSION" "$GAMESERVER" "$VOLUME" + + echo "successful" ) diff --git a/tests/functions/testCron.sh b/tests/functions/testCron.sh index 3275188..ab00502 100644 --- a/tests/functions/testCron.sh +++ b/tests/functions/testCron.sh @@ -4,7 +4,7 @@ set -o errexit set -o nounset set -o pipefail -VERSION="$1" +#VERSION="$1" GAMESERVER="$2" VOLUME="$3" CONTAINER="linuxgsm-$GAMESERVER-testCron" @@ -17,8 +17,6 @@ source "$(dirname "$0")/../internal/api_various.sh" cd "$(dirname "$0")/../.." DOCKERFILE_CRONLOCATION="$(grep -Po '(?<=SUPERCRONIC_CONFIG=")[^"]*' Dockerfile)" - ./tests/internal/build.sh "$VERSION" --latest "$GAMESERVER" - function handleInterrupt() { removeContainer "$CONTAINER" exit 1 diff --git a/tests/functions/testFixPermissions.sh b/tests/functions/testFixPermissions.sh new file mode 100644 index 0000000..6c65d8e --- /dev/null +++ b/tests/functions/testFixPermissions.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +# assuming volume is initialized! +VERSION="$1" +GAMESERVER="$2" +VOLUME="$3" +uid="750" +gid="750" +# shellcheck source=tests/internal/api_docker.sh +source "$(dirname "$0")/../internal/api_docker.sh" +# shellcheck source=tests/internal/api_various.sh +source "$(dirname "$0")/../internal/api_various.sh" + +( + cd "$(dirname "$0")/../.." + + # test volume change + newFile="newFile.test" + dockerRun=(docker run -it --rm -v "$VOLUME:/home" --workdir "/home") + # new file in volume with wrong owner + "${dockerRun[@]}" -u root:root alpine touch "$newFile" + # existing folder changed ownership + "${dockerRun[@]}" -u root:root alpine chown -R 1234:5678 "lgsm" + # server executable with false permissions + "${dockerRun[@]}" alpine chmod ugo= "$GAMESERVER" + + if ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER"; then + permission="$("${dockerRun[@]}" alpine ls -l "$newFile")" + owner="$("${dockerRun[@]}" alpine ls -l "$newFile")" + if ! grep -qE '^.rw.r..---' <<< "$permission"; then + echo "[error][testFixPermissions] new file has wrong permission \"$permission\"" + exit 20 + + elif ! grep -qE "^[^ ]*\s*[0-9]\s*$uid\s*$gid" <<< "$owner"; then + echo "[error][testFixPermissions] new file has wrong owner \"$owner\"" + exit 21 + else + echo "[testFixPermissions] new file has correct permissions / owner" + fi + + permission="$("${dockerRun[@]}" alpine ls -l "lgsm")" + if ! grep -qE '^.rw.r..---' <<< "$permission"; then + echo "[error][testFixPermissions] lgsm folder has wrong permission" + exit 22 + + elif [ "0" != "$("${dockerRun[@]}" alpine find "lgsm" ! -user "$uid" | wc -l)" ]; then + echo "[error][testFixPermissions] lgsm folder / subfile has false uid" + "${dockerRun[@]}" alpine find "lgsm" ! -user "$uid" + exit 23 + + elif [ "0" != "$("${dockerRun[@]}" alpine find "lgsm" ! -group "$gid" | wc -l)" ]; then + echo "[error][testFixPermissions] lgsm folder / subfile has false gid" + "${dockerRun[@]}" alpine find "lgsm" ! -group "$gid" + exit 24 + + else + echo "[testFixPermissions] lgsm folder has correct permissions / owner" + fi + + permission="$("${dockerRun[@]}" alpine ls -l "$GAMESERVER")" + owner="$("${dockerRun[@]}" alpine ls -l "$GAMESERVER")" + if ! grep -qE '^.r.x...---' <<< "$permission"; then + echo "[error][testFixPermissions] gameserver executable has wrong permission \"$permission\"" + exit 25 + + elif ! grep -qE "^[^ ]*\s*[0-9]\s*$uid\s*$gid" <<< "$owner"; then + echo "[error][testFixPermissions] gameserver executable wrong owner \"$owner\"" + exit 26 + + else + echo "[testFixPermissions] gameserver executable has correct permissions / owner" + fi + else + echo "[error][testFixPermissions] permissions not fixed and container failed to start" + exit 10 + fi + + "${dockerRun[@]}" alpine rm "$newFile" +) diff --git a/tests/internal/build.sh b/tests/internal/build.sh index 0808892..e0aee17 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -40,7 +40,7 @@ while [ $# -ge 1 ]; do exit 0;; -v|--version) tag_lgsm="$1" - lgsm_version=("--build-arg" "LGSM_VERSION=$1") + lgsm_version=("--build-arg" "ARG_LGSM_VERSION=$1") echo "using lgsm version ${lgsm_version:-default}" shift ;; diff --git a/tests/internal/run.sh b/tests/internal/run.sh index c688bc3..e5b605d 100644 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -54,7 +54,7 @@ while [ $# -ge 1 ]; do shift;; *) if [ -n "$key" ]; then - echo "$key is additional argument to dockerr" + echo "$key is additional argument to docker" args+=("$key") fi ;; From d2f550947eed458b9090b891ab1b12a3c3d971b6 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Fri, 26 Nov 2021 21:46:19 +0100 Subject: [PATCH 034/116] + cleanup testCron --- Dockerfile | 6 +++--- tests/functions/testCron.sh | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 962ceae..ffd46fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,9 +61,6 @@ RUN set -eux; \ installGamedig.sh; \ cleanImage.sh -HEALTHCHECK --start-period=3600s --interval=60s --timeout=900s --retries=3 \ - CMD [ -f "$LGSM_STARTED" ] && lgsm-monitor || exit 1 - VOLUME "$LGSM_PATH" WORKDIR "$LGSM_PATH" @@ -76,4 +73,7 @@ RUN set -eux; \ createAlias.sh "$LGSM_GAMESERVER"; \ cleanImage.sh +HEALTHCHECK --start-period=3600s --interval=60s --timeout=900s --retries=3 \ + CMD [ -f "$LGSM_STARTED" ] && lgsm-monitor || exit 1 + ENTRYPOINT ["./../linuxgsm-scripts/entrypoint.sh"] diff --git a/tests/functions/testCron.sh b/tests/functions/testCron.sh index ab00502..959d691 100644 --- a/tests/functions/testCron.sh +++ b/tests/functions/testCron.sh @@ -83,5 +83,12 @@ source "$(dirname "$0")/../internal/api_various.sh" exit 10 fi + # check supercron is running + if docker exec -it "$CONTAINER" pidof supercronic > /dev/null; then + echo "[testCron] supercronic started!" + else + echo "[error][testCron] supercronic NOT started" + fi + removeContainer "$CONTAINER" ) From 43cd4eef24f1a0c5c65ac3430a669905e43a89ef Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Fri, 26 Nov 2021 23:36:25 +0100 Subject: [PATCH 035/116] + testUpdateUidGuid.sh --- commands/lgsm-update-uid-gid | 10 +++--- tests/functions/testUpdateUidGuid.sh | 49 ++++++++++++++++++++++++++++ tests/internal/run.sh | 2 +- tests/quick.sh | 13 +++++--- 4 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 tests/functions/testUpdateUidGuid.sh diff --git a/commands/lgsm-update-uid-gid b/commands/lgsm-update-uid-gid index 455f4da..b6b6d6e 100644 --- a/commands/lgsm-update-uid-gid +++ b/commands/lgsm-update-uid-gid @@ -4,14 +4,14 @@ set -o errexit set -o nounset GROUP_NAME="$USER_NAME" -if [ "$(id --user "$USER_ID")" != "$USER_ID" ] || [ "$(id --group "$USER_ID")" != "$GROUP_ID" ]; then +if [ "$(id --user "$USER_ID" 2> /dev/null)" != "$USER_ID" ] || [ "$(id --group "$USER_ID" 2> /dev/null)" != "$GROUP_ID" ]; then echo "[setupUser] changing user id" - old_user_id="$(id --user "$USER_ID")" + old_user_id="$(id --user "$USER_NAME")" usermod -u "$USER_ID" "$USER_NAME" - find / -uid "$old_user_id" -exec chown "$USER_ID" \; + find /home/ -uid "$old_user_id" -exec chown "$USER_ID" "{}" \; echo "[setupUser] changing group id" - old_group_id="$(id --group "$USER_ID")" + old_group_id="$(id --group "$USER_NAME")" groupmod -g "$GROUP_ID" "$GROUP_NAME" - find / -gid "$old_group_id" -exec chown ":$GROUP_ID" \; + find /home/ -gid "$old_group_id" -exec chown ":$GROUP_ID" "{}" \; fi diff --git a/tests/functions/testUpdateUidGuid.sh b/tests/functions/testUpdateUidGuid.sh new file mode 100644 index 0000000..17f5f6f --- /dev/null +++ b/tests/functions/testUpdateUidGuid.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +VERSION="$1" +GAMESERVER="$2" +VOLUME="$3" +uid="750" +gid="750" + +( + cd "$(dirname "$0")/../.." + ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + + dockerRun=(docker run -it --rm -v "$VOLUME:/home" --workdir "/home") + if [ "0" != "$("${dockerRun[@]}" alpine find . ! -user "$uid" ! -iname "tmux.pipe" | wc -l )" ]; then + echo "[testUpdateUidGuid] precondition failed, there are files in \"$VOLUME\" which aren't owned by user \"$uid\"" + "${dockerRun[@]}" alpine find . ! -user "$uid" ! -iname "tmux.pipe" | tail + exit 20 + + elif [ "0" != "$("${dockerRun[@]}" alpine find . ! -group "$gid" ! -iname "tmux.pipe" | wc -l )" ]; then + echo "[testUpdateUidGuid] precondition failed, there are files in \"$VOLUME\" which aren't owned by group \"$gid\"" + "${dockerRun[@]}" alpine find . ! -group "$gid" ! -iname "tmux.pipe" | tail + exit 21 + + else + echo "[testUpdateUidGuid] precondition successful" + fi + + ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" -e "USER_ID=1234" -e "GROUP_ID=5678" + if [ "0" != "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | wc -l )" ]; then + echo "[testUpdateUidGuid] update failed, there are files in \"$VOLUME\" which aren't owned by user \"1234\"" + "${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | tail + exit 22 + + elif [ "0" != "$("${dockerRun[@]}" alpine find . ! -group "5678" ! -iname "tmux.pipe" | wc -l )" ]; then + echo "[testUpdateUidGuid] update failed, there are files in \"$VOLUME\" which aren't owned by group \"5678\"" + "${dockerRun[@]}" alpine find . ! -group "5678" ! -iname "tmux.pipe" | tail + exit 23 + + else + echo "[testUpdateUidGuid] update successful" + fi + + echo "[testUpdateUidGuid] resetting permissions" + "${dockerRun[@]}" alpine chown -R "$uid:$gid" . +) diff --git a/tests/internal/run.sh b/tests/internal/run.sh index e5b605d..9145106 100644 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -54,7 +54,7 @@ while [ $# -ge 1 ]; do shift;; *) if [ -n "$key" ]; then - echo "$key is additional argument to docker" + echo "[run.sh] additional argument to docker: $key" args+=("$key") fi ;; diff --git a/tests/quick.sh b/tests/quick.sh index a541575..b1d706b 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -17,6 +17,7 @@ VOLUME=() DEBUG="" CLEAR="" LOGS="false" +RUN_ARGS=() while [ $# -ge 1 ]; do key="$1" shift @@ -51,11 +52,13 @@ while [ $# -ge 1 ]; do -l|--logs) LOGS="true";; *) - if grep -qE '^-' <<< "$key"; then - echo "unknown option $key" - exit 1 + if [ -z "$GAMESERVER" ]; then + GAMESERVER="$key" + else + echo "[quick.sh] additional argument to docker: \"$key\"" + RUN_ARGS+=("$key") fi - GAMESERVER="$key";; + ;; esac done @@ -76,7 +79,7 @@ trap handleInterrupt SIGTERM SIGINT #shellcheck disable=SC2068 ./internal/build.sh $CLEAR ${VERSION[@]} --latest "$GAMESERVER" #shellcheck disable=SC2068 - ./internal/run.sh --container "$CONTAINER" --detach ${VOLUME[@]} "$DEBUG" --tag "$GAMESERVER" + ./internal/run.sh --container "$CONTAINER" --detach ${VOLUME[@]} "$DEBUG" --tag "$GAMESERVER" ${RUN_ARGS[@]} successful="false" if awaitHealthCheck "$CONTAINER"; then From 3670106a1c7936760309931588782eac95f1de89 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Fri, 26 Nov 2021 23:41:02 +0100 Subject: [PATCH 036/116] fix cron tests --- commands/lgsm-cron-init | 2 +- commands/lgsm-cron-start | 2 +- tests/functions/testCron.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/lgsm-cron-init b/commands/lgsm-cron-init index 39b5c2c..99203e8 100644 --- a/commands/lgsm-cron-init +++ b/commands/lgsm-cron-init @@ -14,4 +14,4 @@ for cron_var in $(env | grep -Eo '^CRON_[^=]*'); do done chown "$USER_NAME:$USER_NAME" "$SUPERCRONIC_CONFIG" -gosu "$USER_NAME" supercronic "$SUPERCRONIC_CONFIG" & +gosu "$USER_NAME" supercronic -test -debug "$SUPERCRONIC_CONFIG" diff --git a/commands/lgsm-cron-start b/commands/lgsm-cron-start index 33ff7d1..8fe6440 100644 --- a/commands/lgsm-cron-start +++ b/commands/lgsm-cron-start @@ -3,4 +3,4 @@ set -o errexit set -o nounset -gosu "$USER_NAME" supercronic "$SUPERCRONIC_CONFIG" +gosu "$USER_NAME" supercronic -debug "$SUPERCRONIC_CONFIG" diff --git a/tests/functions/testCron.sh b/tests/functions/testCron.sh index 959d691..dafc1c6 100644 --- a/tests/functions/testCron.sh +++ b/tests/functions/testCron.sh @@ -39,7 +39,7 @@ source "$(dirname "$0")/../internal/api_various.sh" fi # inject one cron - CRON_TEST1="* * * * echo \"hello world1\"" + CRON_TEST1="* * * * * echo \"hello world1\"" removeContainer "$CONTAINER" ./tests/internal/run.sh --container "$CONTAINER" --detach --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_test1=$CRON_TEST1" if awaitHealthCheck "$CONTAINER"; then @@ -59,7 +59,7 @@ source "$(dirname "$0")/../internal/api_various.sh" fi # inject multiple cron - CRON_TEST2="* * * * echo \"hello world2\"" + CRON_TEST2="* * * * * echo \"hello world2\"" removeContainer "$CONTAINER" ./tests/internal/run.sh --container "$CONTAINER" --detach --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_test1=$CRON_TEST1" "-e" "CRON_test2=$CRON_TEST2" if awaitHealthCheck "$CONTAINER"; then From 4a43b32098fe05053e1540061f94d083b441e471 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 27 Nov 2021 00:38:41 +0100 Subject: [PATCH 037/116] + testCron illegal test --- tests/features.sh | 3 +- tests/functions/testCron.sh | 69 ++++++++++++++++++++----------------- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/tests/features.sh b/tests/features.sh index 7f910a3..6e47c2e 100644 --- a/tests/features.sh +++ b/tests/features.sh @@ -20,6 +20,7 @@ VOLUME="linuxgsm-$GAMESERVER-testFeatures" ./tests/functions/testCron.sh "$VERSION" "$GAMESERVER" "$VOLUME" ./tests/functions/testDockerLogs.sh "$VERSION" "$GAMESERVER" "$VOLUME" ./tests/functions/testFixPermissions.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/functions/testUpdateUidGuid.sh "$VERSION" "$GAMESERVER" "$VOLUME" - echo "successful" + echo "[features] successful" ) diff --git a/tests/functions/testCron.sh b/tests/functions/testCron.sh index dafc1c6..f24ccf0 100644 --- a/tests/functions/testCron.sh +++ b/tests/functions/testCron.sh @@ -10,32 +10,38 @@ VOLUME="$3" CONTAINER="linuxgsm-$GAMESERVER-testCron" # shellcheck source=tests/internal/api_docker.sh source "$(dirname "$0")/../internal/api_docker.sh" -# shellcheck source=tests/internal/api_various.sh -source "$(dirname "$0")/../internal/api_various.sh" ( cd "$(dirname "$0")/../.." DOCKERFILE_CRONLOCATION="$(grep -Po '(?<=SUPERCRONIC_CONFIG=")[^"]*' Dockerfile)" - function handleInterrupt() { + + function fn_exit() { removeContainer "$CONTAINER" - exit 1 + exit "${1:-1}" } - trap handleInterrupt SIGTERM SIGINT ERR + trap fn_exit SIGTERM SIGINT - # initial run = no cron + function log() { + if [ -n "${2:-}" ]; then + echo "[error][testCron] $1" + fn_exit "$2" + else + echo "[testCron] $1" + fi + } + + # initial run = no cron removeContainer "$CONTAINER" ./tests/internal/run.sh --container "$CONTAINER" --detach --volume "$VOLUME" --tag "$GAMESERVER" if awaitHealthCheck "$CONTAINER"; then if [ "0" != "$(docker exec -it "$CONTAINER" cat "$DOCKERFILE_CRONLOCATION" | wc -l)" ]; then - echo "[testCron] successful no cron job found" + log "successful no cron job found" else - echo "[error][testCron] container shouldn't have a cronjob" - exit 20 + log "container shouldn't have a cronjob" 20 fi else - echo "[error][testCron] container is unhealthy" - exit 10 + log "container is unhealthy" 10 fi # inject one cron @@ -45,17 +51,14 @@ source "$(dirname "$0")/../internal/api_various.sh" if awaitHealthCheck "$CONTAINER"; then crontab="$(docker exec -it "$CONTAINER" cat "$DOCKERFILE_CRONLOCATION")" if [ "2" != "$(echo "$crontab" | wc -l)" ]; then - echo "[error][testCron] expected two cron lines, found $(echo "$crontab" | wc -l)" - exit 21 + log "expected two cron lines, found $(echo "$crontab" | wc -l)" 21 elif ! grep -qE "^$CRON_TEST1" <<< "$crontab"; then - echo "[error][testCron] provided crontab isn't part of container but should be" - exit 22 + log "provided crontab isn't part of container but should be" 22 else - echo "[testCron] successfully tested one cronjob" + log "successfully tested one cronjob" fi else - echo "[error][testCron] container is unhealthy" - exit 10 + log "container is unhealthy" 11 fi # inject multiple cron @@ -65,29 +68,33 @@ source "$(dirname "$0")/../internal/api_various.sh" if awaitHealthCheck "$CONTAINER"; then crontab="$(docker exec -it "$CONTAINER" cat "$DOCKERFILE_CRONLOCATION")" if [ "3" != "$(echo "$crontab" | wc -l)" ]; then - echo "[error][testCron] expected 3 cron lines, found $(echo "$crontab" | wc -l)" - exit 23 + log "expected 3 cron lines, found $(echo "$crontab" | wc -l)" 23 elif ! grep -qE "^$CRON_TEST1" <<< "$crontab"; then - echo "[error][testCron] provided first crontab isn't part of container but should be" - exit 24 + log "provided first crontab isn't part of container but should be" 24 elif ! grep -qE "^$CRON_TEST2" <<< "$crontab"; then - echo "[error][testCron] provided second crontab isn't part of container but should be" - exit 25 + log "provided second crontab isn't part of container but should be" 25 else - echo "[testCron] successfully tested two cronjobs" - echo "crontab:" - echo "$crontab" + log "successfully tested two cronjobs" + log "$crontab" fi else - echo "[error][testCron] container is unhealthy" - exit 10 + log "container is unhealthy" 12 fi # check supercron is running if docker exec -it "$CONTAINER" pidof supercronic > /dev/null; then - echo "[testCron] supercronic started!" + log "supercronic started!" + else + log "supercronic NOT started" 13 + fi + + # fail for illegal cron job + removeContainer "$CONTAINER" + ./tests/internal/run.sh --container "$CONTAINER" --detach --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_illegal=* * * * echo \"hello illegal\"" + if ! awaitHealthCheck "$CONTAINER"; then + log "successfully tested illegal cronjob" else - echo "[error][testCron] supercronic NOT started" + log "container is healthy for illegal cronjob which should fail early" 14 fi removeContainer "$CONTAINER" From c1bb9f375ec646f25b622809c8365c3e5ffc4352 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 27 Nov 2021 02:48:23 +0100 Subject: [PATCH 038/116] + testLgsmUpdate --- commands/lgsm-init | 10 +++++++ setup/entrypoint.sh | 1 + tests/features.sh | 7 ++--- tests/functions/testLgsmUpdate.sh | 44 +++++++++++++++++++++++++++++++ tests/internal/build.sh | 2 +- 5 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 tests/functions/testLgsmUpdate.sh diff --git a/commands/lgsm-init b/commands/lgsm-init index 2239e91..823505e 100644 --- a/commands/lgsm-init +++ b/commands/lgsm-init @@ -3,5 +3,15 @@ set -o errexit set -o nounset +# is gameserver already installed ? +# if linuxgsm.sh is changed = update -> remove lgsm folder +# if linuxgsm.sh isn't there this will also fail -> forced lgsm download +if ! echo "$(sha256sum "$LGSM_SCRIPTS/linuxgsm.sh" | grep -Eo '^[^ ]*') linuxgsm.sh" | sha256sum -c > /dev/null 2>&1; then + echo "[lgsm-init] force uninstall lgsm, either linuxgsm changed or file to determine installed version is removed" + rm -rf "lgsm" || true +fi +# remove gameserver executable to not install 2nd one +rm "$LGSM_GAMESERVER" > /dev/null 2>&1 || true + gosu "$USER_NAME" cp -f "$LGSM_SCRIPTS/linuxgsm.sh" . gosu "$USER_NAME" ./linuxgsm.sh "$LGSM_GAMESERVER" diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index 1f8c8cd..7936117 100644 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -16,6 +16,7 @@ if [ ! -e "$LGSM_GAMESERVER" ]; then lgsm-init lgsm-auto-install else + lgsm-init lgsm-update fi diff --git a/tests/features.sh b/tests/features.sh index 6e47c2e..fef8db4 100644 --- a/tests/features.sh +++ b/tests/features.sh @@ -17,10 +17,11 @@ VOLUME="linuxgsm-$GAMESERVER-testFeatures" fi ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" - ./tests/functions/testCron.sh "$VERSION" "$GAMESERVER" "$VOLUME" - ./tests/functions/testDockerLogs.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/functions/testCron.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/functions/testDockerLogs.sh "$VERSION" "$GAMESERVER" "$VOLUME" ./tests/functions/testFixPermissions.sh "$VERSION" "$GAMESERVER" "$VOLUME" - ./tests/functions/testUpdateUidGuid.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/functions/testUpdateUidGuid.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/functions/testLgsmUpdate.sh "$VERSION" "$GAMESERVER" "$VOLUME" echo "[features] successful" ) diff --git a/tests/functions/testLgsmUpdate.sh b/tests/functions/testLgsmUpdate.sh new file mode 100644 index 0000000..13a3e55 --- /dev/null +++ b/tests/functions/testLgsmUpdate.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +OLD_VERSION="v21.3.3" +VERSION="$1" +GAMESERVER="$2" +VOLUME="$3" + +( + cd "$(dirname "$0")/../.." + ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + + log_downgrade="downgrade.log" + log_update="upgrade.log" + function log() { + if [ -n "${2:-}" ]; then + echo "[error][testLgsmUpdate] $1" + tail "$log_downgrade" || true + tail "$log_update" || true + rm "$log_downgrade" "$log_update" > /dev/null 2>&1 || true + exit "$2" + else + echo "[testLgsmUpdate] $1" + fi + } + + # old versions are allowed to fail, as long as log contains the expected entry + ./tests/quick.sh --logs --version "$OLD_VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_downgrade" || true + if ! grep -qF '[lgsm-init] force uninstall lgsm' "$log_downgrade"; then + log "downgrading from \"$VERSION\" to \"$OLD_VERSION\" successful but container didn't forcefully uninstalled lgsm" 21 + + elif ! ./tests/quick.sh --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_update"; then + log "upgrading from \"$OLD_VERSION\" to \"$VERSION\" failed" 22 + + elif ! grep -qF '[lgsm-init] force uninstall lgsm' "$log_update"; then + log "upgrading successful but container didn't forcefully uninstalled lgsm" 23 + + else + log "successfully downgraded and upgraded lgsm" + fi +) diff --git a/tests/internal/build.sh b/tests/internal/build.sh index e0aee17..754e899 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -41,7 +41,7 @@ while [ $# -ge 1 ]; do -v|--version) tag_lgsm="$1" lgsm_version=("--build-arg" "ARG_LGSM_VERSION=$1") - echo "using lgsm version ${lgsm_version:-default}" + echo "using lgsm version $1" shift ;; -i|--image) From f1631a16b48423a9cee5de53edf3040a883f2e9b Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 27 Nov 2021 04:08:38 +0100 Subject: [PATCH 039/116] ~ cleanup log entries / shellcheck --- commands/lgsm-init | 2 +- commands/lgsm-update-uid-gid | 4 +- setup/cleanImage.sh | 2 +- setup/createAlias.sh | 8 +-- setup/entrypoint.sh | 2 +- setup/installDependencies.sh | 4 +- setup/installLGSM.sh | 2 +- setup/installMinimalDependencies.sh | 2 +- tests/features.sh | 2 +- tests/full.sh | 41 +++++++------- tests/functions/testCron.sh | 10 ++-- tests/functions/testDockerLogs.sh | 7 +-- tests/functions/testFixPermissions.sh | 44 +++++++-------- tests/functions/testLgsmUpdate.sh | 8 +-- tests/functions/testUpdateUidGuid.sh | 36 +++++++------ tests/internal/api_docker.sh | 6 +-- tests/internal/build.sh | 78 +++++++++++++-------------- tests/internal/run.sh | 75 ++++++++++---------------- tests/quick.sh | 73 ++++++++++++------------- 19 files changed, 196 insertions(+), 210 deletions(-) diff --git a/commands/lgsm-init b/commands/lgsm-init index 823505e..1285f89 100644 --- a/commands/lgsm-init +++ b/commands/lgsm-init @@ -7,7 +7,7 @@ set -o nounset # if linuxgsm.sh is changed = update -> remove lgsm folder # if linuxgsm.sh isn't there this will also fail -> forced lgsm download if ! echo "$(sha256sum "$LGSM_SCRIPTS/linuxgsm.sh" | grep -Eo '^[^ ]*') linuxgsm.sh" | sha256sum -c > /dev/null 2>&1; then - echo "[lgsm-init] force uninstall lgsm, either linuxgsm changed or file to determine installed version is removed" + echo "[info][lgsm-init] force uninstall lgsm, either linuxgsm changed or file to determine installed version is removed" rm -rf "lgsm" || true fi # remove gameserver executable to not install 2nd one diff --git a/commands/lgsm-update-uid-gid b/commands/lgsm-update-uid-gid index b6b6d6e..6337982 100644 --- a/commands/lgsm-update-uid-gid +++ b/commands/lgsm-update-uid-gid @@ -5,12 +5,12 @@ set -o nounset GROUP_NAME="$USER_NAME" if [ "$(id --user "$USER_ID" 2> /dev/null)" != "$USER_ID" ] || [ "$(id --group "$USER_ID" 2> /dev/null)" != "$GROUP_ID" ]; then - echo "[setupUser] changing user id" + echo "[info][setupUser] changing user id" old_user_id="$(id --user "$USER_NAME")" usermod -u "$USER_ID" "$USER_NAME" find /home/ -uid "$old_user_id" -exec chown "$USER_ID" "{}" \; - echo "[setupUser] changing group id" + echo "[info][setupUser] changing group id" old_group_id="$(id --group "$USER_NAME")" groupmod -g "$GROUP_ID" "$GROUP_NAME" find /home/ -gid "$old_group_id" -exec chown ":$GROUP_ID" "{}" \; diff --git a/setup/cleanImage.sh b/setup/cleanImage.sh index d108d34..8b99f48 100644 --- a/setup/cleanImage.sh +++ b/setup/cleanImage.sh @@ -2,7 +2,7 @@ set -o errexit set -o nounset -echo "[cleanImage] cleaning image" +echo "[info][cleanImage] cleaning image" apt-get autoremove -y apt-get clean -y diff --git a/setup/createAlias.sh b/setup/createAlias.sh index e0a7f2b..ac32de6 100644 --- a/setup/createAlias.sh +++ b/setup/createAlias.sh @@ -1,13 +1,13 @@ #!/bin/bash LGSM_GAMESERVER="$1" if [ -z "$LGSM_GAMESERVER" ]; then - echo "[createAlias] ERROR first argument needs to be target gameserver" + echo "[error][createAlias] first argument needs to be target gameserver" exit 1 fi set -o errexit set -o nounset -echo "[createAlias] creating linuxgsm alias" +echo "[info][createAlias] creating linuxgsm alias" function createAlias() { name="$1" @@ -15,9 +15,9 @@ function createAlias() { file="$LGSM_SCRIPTS/$name" if [ -f "$file" ]; then - echo "[createAlias.sh]error file already exists => cant create alias with this method" + echo "[error][createAlias.sh]file already exists => cant create alias with this method" else - echo "[createAlias.sh] $command $name" + echo "[info][createAlias.sh] $command $name" cat > "$file" <<- EOM #!/bin/sh gosu "\$USER_NAME" "$command" "$name" "\$@" diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index 7936117..38469d4 100644 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -34,5 +34,5 @@ while read -r line; do echo "$line" done < tmux.pipe rm "$LGSM_STARTED" > /dev/null 2>&1 || true -echo "entrypoint ended" +echo "[info][entrypoint] entrypoint ended" diff --git a/setup/installDependencies.sh b/setup/installDependencies.sh index 0db99d2..1b1bead 100644 --- a/setup/installDependencies.sh +++ b/setup/installDependencies.sh @@ -4,7 +4,7 @@ server="$1" set -o errexit set -o pipefail set -o nounset -echo "[installServer] installing $server" +echo "[info][installDependencies] installing $server" cd "$LGSM_PATH" gosu "$USER_NAME" cp -f "$LGSM_SCRIPTS/linuxgsm.sh" . gosu "$USER_NAME" ./linuxgsm.sh "$server" @@ -21,7 +21,7 @@ if [ "${#cmds[@]}" -gt "0" ]; then echo steam steam/license note '' | debconf-set-selections # install dependencies - echo "installing dependencies:" + echo "[info][installDependencies] installing dependencies:" for cmd in "${cmds[@]}"; do echo "$cmd" eval "DEBIAN_FRONTEND=noninteractive $cmd" || ( diff --git a/setup/installLGSM.sh b/setup/installLGSM.sh index d25c967..503d27f 100644 --- a/setup/installLGSM.sh +++ b/setup/installLGSM.sh @@ -2,7 +2,7 @@ set -o errexit set -o nounset -echo "[installLGSM] installing LGSM" +echo "[info][installLGSM] installing LGSM" wget -O "$LGSM_SCRIPTS/linuxgsm.sh" "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/$LGSM_VERSION/linuxgsm.sh" chmod +x "$LGSM_SCRIPTS/linuxgsm.sh" diff --git a/setup/installMinimalDependencies.sh b/setup/installMinimalDependencies.sh index 22df086..7270449 100644 --- a/setup/installMinimalDependencies.sh +++ b/setup/installMinimalDependencies.sh @@ -2,7 +2,7 @@ set -o errexit set -o nounset -echo "[installMinimalDependencies] installing ..." +echo "[info][installMinimalDependencies] installing ..." apt-get update # curl / wget needed for lgsm diff --git a/tests/features.sh b/tests/features.sh index fef8db4..bb7c858 100644 --- a/tests/features.sh +++ b/tests/features.sh @@ -23,5 +23,5 @@ VOLUME="linuxgsm-$GAMESERVER-testFeatures" ./tests/functions/testUpdateUidGuid.sh "$VERSION" "$GAMESERVER" "$VOLUME" ./tests/functions/testLgsmUpdate.sh "$VERSION" "$GAMESERVER" "$VOLUME" - echo "[features] successful" + echo "[info][features] successful" ) diff --git a/tests/full.sh b/tests/full.sh index 37ca00d..857b581 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -16,30 +16,29 @@ while [ $# -ge 1 ]; do case "$key" in -h|--help) - echo "testing every feature of specified server" - echo "full.sh [option] [server]" - echo "" - echo "options:" - echo "-v x" - echo "--version x use linuxgsm version x e.g. \"v21.4.1\"" - echo "-c x run x servers in parralel, default x = physical cores" - echo "--cpus x" - echo "--rerun check results and runs every gameserver which isn't successful" - echo "" - echo "server default empty = all, otherwise e.g. gmodserver" + echo "[help][full] testing every feature of specified server" + echo "[help][full] full.sh [option] [server]" + echo "[help][full] " + echo "[help][full] options:" + echo "[help][full] -c --cpus x run x servers in parralel, default x = physical cores" + echo "[help][full] --rerun check results and runs every gameserver which wasn't successful" + echo "[help][full] -v --version x use linuxgsm version x e.g. \"v21.4.1\"" + echo "[help][full] " + echo "[help][full] server:" + echo "[help][full] *empty* test every server" + echo "[help][full] gmodserver ... run only given servers" exit 0;; - -v|--version) - VERSION="$1" - shift;; -c|--cpus) PARRALEL="$1" shift;; --rerun) - RERUN="true" - ;; + RERUN="true";; + -v|--version) + VERSION="$1" + shift;; *) if grep -qE '^-' <<< "$key"; then - echo "unknown option $key" + echo "[error][full] unknown option $key" exit 1 fi GAMESERVER+=("$key");; @@ -67,7 +66,7 @@ fi mkdir -p "$RESULTS" ( - echo "building linuxgsm base once" + echo "[info][full] building linuxgsm base once" ./tests/internal/build.sh --version "$VERSION" subprocesses=() @@ -100,7 +99,7 @@ mkdir -p "$RESULTS" testThisServercode="$( ("$testAllServer" || "$isServercodeInServerlist") && echo true || echo false )" rerunIsFine="$( ( ! "$RERUN" || "$serverDidntStartSuccessful" ) && echo true || echo false )" if "$testThisServercode" && "$rerunIsFine"; then - echo "testing: $server_code" + echo "[info][full] testing: $server_code" ( if ./tests/quick.sh --logs --version "$VERSION" "$server_code" > "$RESULTS/$server_code.log" 2>&1; then mv "$RESULTS/$server_code.log" "$RESULTS/successful.$server_code.log" @@ -124,6 +123,6 @@ mkdir -p "$RESULTS" subprocesses=("${temp[@]}") done - echo "successful: $(find "$RESULTS/" -iname "successful.*" | wc -l)" - echo "failed: $(find "$RESULTS/" -iname "failed.*" | wc -l)" + echo "[info][full] successful: $(find "$RESULTS/" -iname "successful.*" | wc -l)" + echo "[info][full] failed: $(find "$RESULTS/" -iname "failed.*" | wc -l)" ) diff --git a/tests/functions/testCron.sh b/tests/functions/testCron.sh index f24ccf0..4e8ab4a 100644 --- a/tests/functions/testCron.sh +++ b/tests/functions/testCron.sh @@ -27,13 +27,13 @@ source "$(dirname "$0")/../internal/api_docker.sh" echo "[error][testCron] $1" fn_exit "$2" else - echo "[testCron] $1" + echo "[info][testCron] $1" fi } # initial run = no cron removeContainer "$CONTAINER" - ./tests/internal/run.sh --container "$CONTAINER" --detach --volume "$VOLUME" --tag "$GAMESERVER" + ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" if awaitHealthCheck "$CONTAINER"; then if [ "0" != "$(docker exec -it "$CONTAINER" cat "$DOCKERFILE_CRONLOCATION" | wc -l)" ]; then log "successful no cron job found" @@ -47,7 +47,7 @@ source "$(dirname "$0")/../internal/api_docker.sh" # inject one cron CRON_TEST1="* * * * * echo \"hello world1\"" removeContainer "$CONTAINER" - ./tests/internal/run.sh --container "$CONTAINER" --detach --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_test1=$CRON_TEST1" + ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_test1=$CRON_TEST1" if awaitHealthCheck "$CONTAINER"; then crontab="$(docker exec -it "$CONTAINER" cat "$DOCKERFILE_CRONLOCATION")" if [ "2" != "$(echo "$crontab" | wc -l)" ]; then @@ -64,7 +64,7 @@ source "$(dirname "$0")/../internal/api_docker.sh" # inject multiple cron CRON_TEST2="* * * * * echo \"hello world2\"" removeContainer "$CONTAINER" - ./tests/internal/run.sh --container "$CONTAINER" --detach --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_test1=$CRON_TEST1" "-e" "CRON_test2=$CRON_TEST2" + ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_test1=$CRON_TEST1" "-e" "CRON_test2=$CRON_TEST2" if awaitHealthCheck "$CONTAINER"; then crontab="$(docker exec -it "$CONTAINER" cat "$DOCKERFILE_CRONLOCATION")" if [ "3" != "$(echo "$crontab" | wc -l)" ]; then @@ -90,7 +90,7 @@ source "$(dirname "$0")/../internal/api_docker.sh" # fail for illegal cron job removeContainer "$CONTAINER" - ./tests/internal/run.sh --container "$CONTAINER" --detach --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_illegal=* * * * echo \"hello illegal\"" + ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_illegal=* * * * echo \"hello illegal\"" if ! awaitHealthCheck "$CONTAINER"; then log "successfully tested illegal cronjob" else diff --git a/tests/functions/testDockerLogs.sh b/tests/functions/testDockerLogs.sh index 51235cd..e9e27c6 100644 --- a/tests/functions/testDockerLogs.sh +++ b/tests/functions/testDockerLogs.sh @@ -11,13 +11,14 @@ VOLUME="$3" ( cd "$(dirname "$0")/../.." log="tests/functions/testDockerLogs.log" - ./tests/quick.sh --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" + ./tests/quick.sh --quick --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" if grep -qE 'VAC\s*secure\s*mode\s*is\s*activated.' "$log"; then rm "$log" - echo "[testDockerLogs] successful" + echo "[info][testDockerLogs] successful" exit 0 else - echo "[testDockerLogs] failed, check $log" + echo "[failed][testDockerLogs] failed, check $log" + tail "$log" exit 1 fi ) diff --git a/tests/functions/testFixPermissions.sh b/tests/functions/testFixPermissions.sh index 6c65d8e..8fb788c 100644 --- a/tests/functions/testFixPermissions.sh +++ b/tests/functions/testFixPermissions.sh @@ -27,56 +27,56 @@ source "$(dirname "$0")/../internal/api_various.sh" "${dockerRun[@]}" -u root:root alpine chown -R 1234:5678 "lgsm" # server executable with false permissions "${dockerRun[@]}" alpine chmod ugo= "$GAMESERVER" + + function log() { + if [ -n "${2:-}" ]; then + echo "[error][testFixPermissions] $1" + echo "${3:-}" + exit "$2" + else + echo "[info][testFixPermissions] $1" + fi + } - if ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER"; then + if ./tests/quick.sh --quick --version "$VERSION" --volume "$VOLUME" "$GAMESERVER"; then permission="$("${dockerRun[@]}" alpine ls -l "$newFile")" owner="$("${dockerRun[@]}" alpine ls -l "$newFile")" if ! grep -qE '^.rw.r..---' <<< "$permission"; then - echo "[error][testFixPermissions] new file has wrong permission \"$permission\"" - exit 20 + log "new file has wrong permission \"$permission\"" 20 elif ! grep -qE "^[^ ]*\s*[0-9]\s*$uid\s*$gid" <<< "$owner"; then - echo "[error][testFixPermissions] new file has wrong owner \"$owner\"" - exit 21 + log "new file has wrong owner \"$owner\"" 21 else - echo "[testFixPermissions] new file has correct permissions / owner" + log "new file has correct permissions / owner" fi permission="$("${dockerRun[@]}" alpine ls -l "lgsm")" if ! grep -qE '^.rw.r..---' <<< "$permission"; then - echo "[error][testFixPermissions] lgsm folder has wrong permission" - exit 22 + log "lgsm folder has wrong permission" 22 elif [ "0" != "$("${dockerRun[@]}" alpine find "lgsm" ! -user "$uid" | wc -l)" ]; then - echo "[error][testFixPermissions] lgsm folder / subfile has false uid" - "${dockerRun[@]}" alpine find "lgsm" ! -user "$uid" - exit 23 + log "lgsm folder / subfile has false uid" 23 "$("${dockerRun[@]}" alpine find "lgsm" ! -user "$uid" | tail)" elif [ "0" != "$("${dockerRun[@]}" alpine find "lgsm" ! -group "$gid" | wc -l)" ]; then - echo "[error][testFixPermissions] lgsm folder / subfile has false gid" - "${dockerRun[@]}" alpine find "lgsm" ! -group "$gid" - exit 24 + log "lgsm folder / subfile has false gid" 24 "$("${dockerRun[@]}" alpine find "lgsm" ! -group "$gid" | tail)" else - echo "[testFixPermissions] lgsm folder has correct permissions / owner" + log "lgsm folder has correct permissions / owner" fi permission="$("${dockerRun[@]}" alpine ls -l "$GAMESERVER")" owner="$("${dockerRun[@]}" alpine ls -l "$GAMESERVER")" if ! grep -qE '^.r.x...---' <<< "$permission"; then - echo "[error][testFixPermissions] gameserver executable has wrong permission \"$permission\"" - exit 25 + log "gameserver executable has wrong permission \"$permission\"" 25 elif ! grep -qE "^[^ ]*\s*[0-9]\s*$uid\s*$gid" <<< "$owner"; then - echo "[error][testFixPermissions] gameserver executable wrong owner \"$owner\"" - exit 26 + log "gameserver executable wrong owner \"$owner\"" 26 else - echo "[testFixPermissions] gameserver executable has correct permissions / owner" + log "gameserver executable has correct permissions / owner" fi else - echo "[error][testFixPermissions] permissions not fixed and container failed to start" - exit 10 + log "permissions not fixed and container failed to start" 10 fi "${dockerRun[@]}" alpine rm "$newFile" diff --git a/tests/functions/testLgsmUpdate.sh b/tests/functions/testLgsmUpdate.sh index 13a3e55..38008e0 100644 --- a/tests/functions/testLgsmUpdate.sh +++ b/tests/functions/testLgsmUpdate.sh @@ -11,7 +11,7 @@ VOLUME="$3" ( cd "$(dirname "$0")/../.." - ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./tests/quick.sh --quick --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" log_downgrade="downgrade.log" log_update="upgrade.log" @@ -23,16 +23,16 @@ VOLUME="$3" rm "$log_downgrade" "$log_update" > /dev/null 2>&1 || true exit "$2" else - echo "[testLgsmUpdate] $1" + echo "[info][testLgsmUpdate] $1" fi } # old versions are allowed to fail, as long as log contains the expected entry - ./tests/quick.sh --logs --version "$OLD_VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_downgrade" || true + ./tests/quick.sh --quick --logs --version "$OLD_VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_downgrade" || true if ! grep -qF '[lgsm-init] force uninstall lgsm' "$log_downgrade"; then log "downgrading from \"$VERSION\" to \"$OLD_VERSION\" successful but container didn't forcefully uninstalled lgsm" 21 - elif ! ./tests/quick.sh --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_update"; then + elif ! ./tests/quick.sh --quick --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_update"; then log "upgrading from \"$OLD_VERSION\" to \"$VERSION\" failed" 22 elif ! grep -qF '[lgsm-init] force uninstall lgsm' "$log_update"; then diff --git a/tests/functions/testUpdateUidGuid.sh b/tests/functions/testUpdateUidGuid.sh index 17f5f6f..008ccda 100644 --- a/tests/functions/testUpdateUidGuid.sh +++ b/tests/functions/testUpdateUidGuid.sh @@ -12,38 +12,40 @@ gid="750" ( cd "$(dirname "$0")/../.." - ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./tests/quick.sh --quick --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + + function log() { + if [ -n "${2:-}" ]; then + echo "[error][testUpdateUidGuid] $1" + echo "${3:-}" + exit "$2" + else + echo "[info][testUpdateUidGuid] $1" + fi + } dockerRun=(docker run -it --rm -v "$VOLUME:/home" --workdir "/home") if [ "0" != "$("${dockerRun[@]}" alpine find . ! -user "$uid" ! -iname "tmux.pipe" | wc -l )" ]; then - echo "[testUpdateUidGuid] precondition failed, there are files in \"$VOLUME\" which aren't owned by user \"$uid\"" - "${dockerRun[@]}" alpine find . ! -user "$uid" ! -iname "tmux.pipe" | tail - exit 20 + log "precondition failed, there are files in \"$VOLUME\" which aren't owned by user \"$uid\"" 20 "$("${dockerRun[@]}" alpine find . ! -user "$uid" ! -iname "tmux.pipe" | tail)" elif [ "0" != "$("${dockerRun[@]}" alpine find . ! -group "$gid" ! -iname "tmux.pipe" | wc -l )" ]; then - echo "[testUpdateUidGuid] precondition failed, there are files in \"$VOLUME\" which aren't owned by group \"$gid\"" - "${dockerRun[@]}" alpine find . ! -group "$gid" ! -iname "tmux.pipe" | tail - exit 21 + log "precondition failed, there are files in \"$VOLUME\" which aren't owned by group \"$gid\"" 21 "$("${dockerRun[@]}" alpine find . ! -group "$gid" ! -iname "tmux.pipe" | tail)" else - echo "[testUpdateUidGuid] precondition successful" + log "precondition successful" fi - ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" -e "USER_ID=1234" -e "GROUP_ID=5678" + ./tests/quick.sh --quick --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" -e "USER_ID=1234" -e "GROUP_ID=5678" if [ "0" != "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | wc -l )" ]; then - echo "[testUpdateUidGuid] update failed, there are files in \"$VOLUME\" which aren't owned by user \"1234\"" - "${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | tail - exit 22 + log "update failed, there are files in \"$VOLUME\" which aren't owned by user \"1234\"" 22 "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | tail)" elif [ "0" != "$("${dockerRun[@]}" alpine find . ! -group "5678" ! -iname "tmux.pipe" | wc -l )" ]; then - echo "[testUpdateUidGuid] update failed, there are files in \"$VOLUME\" which aren't owned by group \"5678\"" - "${dockerRun[@]}" alpine find . ! -group "5678" ! -iname "tmux.pipe" | tail - exit 23 + log "update failed, there are files in \"$VOLUME\" which aren't owned by group \"5678\"" 23 "$("${dockerRun[@]}" alpine find . ! -group "5678" ! -iname "tmux.pipe" | tail)" else - echo "[testUpdateUidGuid] update successful" + log "update successful" fi - echo "[testUpdateUidGuid] resetting permissions" + log "resetting permissions" "${dockerRun[@]}" alpine chown -R "$uid:$gid" . ) diff --git a/tests/internal/api_docker.sh b/tests/internal/api_docker.sh index d5e767d..eab79e7 100644 --- a/tests/internal/api_docker.sh +++ b/tests/internal/api_docker.sh @@ -36,15 +36,15 @@ function awaitHealthCheck() { return 1 fi - echo -n "[awaitHealthCheck] waiting for health check of \"$container\" " + echo -n "[info][awaitHealthCheck] waiting for health check of \"$container\" " seconds=0 while isContainerHealthStarting "$container"; do seconds=$((seconds+1)) sleep 1s - echo -en "\r[awaitHealthCheck] waiting for health check of \"$container\" currently ${seconds} seconds" + echo -en "\r[info][awaitHealthCheck] waiting for health check of \"$container\" currently ${seconds} seconds" done echo "" - echo "[awaitHealthCheck] \"$container\" health check startup time $seconds" + echo "[info][awaitHealthCheck] \"$container\" health check startup time $seconds" isContainerHealthHealthy "$container" } \ No newline at end of file diff --git a/tests/internal/build.sh b/tests/internal/build.sh index 754e899..5bfdd93 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -10,40 +10,33 @@ source "$(dirname "$0")/api_docker.sh" source "$(dirname "$0")/api_various.sh" server="" -lgsm_version=() -clear="" image="lgsm-test" tag_lgsm="dev" latest="false" push="false" + +build_lgsm=(docker build) +build_specific=(docker build) while [ $# -ge 1 ]; do key="$1" shift case "$key" in -h|--help) - echo "build.sh [option] [server]" - echo "" - echo "options:" - echo "-v x use provided lgsm version where x is branch / tag / commit" - echo "--version x e.g. --version v21.4.1" - echo "-c disable cache using" - echo "--no-cache" - echo "-i x target image, default=lgsm-test" - echo "--image x" - echo "--latest every created image is also tagged as latest" - echo "--push every image is also pushed" - echo "" - echo "server:" - echo "gmodserver build linuxgsm image and specific gmodserver" - echo "..." + echo "[help][build] build.sh [option] [server]" + echo "[help][build] " + echo "[help][build] options:" + echo "[help][build] -c --no-cache disable cache using" + echo "[help][build] -i --image x target image, default=lgsm-test" + echo "[help][build] --latest every created image is also tagged as latest" + echo "[help][build] --push every image is also pushed" + echo "[help][build] -v --version x use provided lgsm version where x is branch / tag / commit e.g. --version v21.4.1" + echo "[help][build] " + echo "[help][build] server:" + echo "[help][build] gmodserver build linuxgsm image and specific gmodserver" exit 0;; - -v|--version) - tag_lgsm="$1" - lgsm_version=("--build-arg" "ARG_LGSM_VERSION=$1") - echo "using lgsm version $1" - shift - ;; + -c|--no-cache) + build_lgsm+=(--no-cache);; -i|--image) image="$1" shift;; @@ -51,25 +44,34 @@ while [ $# -ge 1 ]; do latest="true";; --push) push="true";; - -c|--no-cache) - clear="--no-cache";; + -v|--version) + tag_lgsm="$1" + build_lgsm+=(--build-arg "ARG_LGSM_VERSION=$1") + build_specific+=(--build-arg "ARG_LGSM_VERSION=$1") + echo "[info][build] using lgsm version $1" + shift;; *) - echo "$key is server" - server="$key";; + if [ -z "$server" ]; then + echo "[info][build] $key is server" + server="$key" + else + echo "[error][build] server is already set to \"$server\" but you provided a second one \"$key\"" + exit 1 + fi esac done +build_lgsm+=(-t "$image:$tag_lgsm" --target linuxgsm .) +build_specific+=(-t "$image:${server}_$tag_lgsm" --build-arg "ARG_LGSM_GAMESERVER=$server" .) cd "$(dirname "$0")/../.." -#shellcheck disable=SC2206 -cmd=(docker build -t "$image:$tag_lgsm" $clear --target linuxgsm ${lgsm_version[@]} .) -echo "${cmd[@]}" -"${cmd[@]}" +# build lgsm image +echo "${build_lgsm[@]}" +"${build_lgsm[@]}" if "$push"; then docker push "$image:$tag_lgsm" fi - if "$latest"; then docker tag "$image:$tag_lgsm" "$image:latest" if "$push"; then @@ -77,12 +79,10 @@ if "$latest"; then fi fi - +# build specific image if [ -n "$server" ]; then - #shellcheck disable=SC2206 - cmd=(docker build -t "$image:${server}_$tag_lgsm" --build-arg "ARG_LGSM_GAMESERVER=$server" ${lgsm_version[@]} .) - echo "${cmd[@]}" - "${cmd[@]}" + echo "${build_specific[@]}" + "${build_specific[@]}" if "$push"; then docker push "$image:${server}_$tag_lgsm" @@ -90,7 +90,7 @@ if [ -n "$server" ]; then if "$latest"; then docker tag "$image:${server}_$tag_lgsm" "$image:${server}" if "$push"; then - docker push "$image:${server}" - fi + docker push "$image:${server}" + fi fi fi diff --git a/tests/internal/run.sh b/tests/internal/run.sh index 9145106..eb423ee 100644 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -1,79 +1,62 @@ #!/bin/bash - -args=() -debug=() tag="" -volume=() docker_run_mode="-it" -quick="" IMAGE="lgsm-test" container="lgsm-test" + +run_image=(docker run) while [ $# -ge 1 ]; do key="$1" shift case "$key" in -h|--help) - echo "run.sh [option] tag [args]" - echo "" - echo "options:" - echo "-d set entrypoint to bash" - echo "--debug" - echo "--detach run in background instead of foreground" - echo "-v x use volume x" - echo "--volume x" - echo "--quick enforce quick monitoring" - echo "-i x target image, default=lgsm-test" - echo "--image x" - echo "-c x container name default=lgsm-test" - echo "--container x" - echo "" - echo "tag:" - echo "lgsm run lgsm image" - echo "specific run last created specific image $IMAGE:$tag" - echo "" - echo "args:" - echo "every other argument is added to docker run ... IMAGE [args] " + echo "[help][run] run.sh [option] [args]" + echo "[help][run] " + echo "[help][run] options:" + echo "[help][run] -c --container x container name default=lgsm-test" + echo "[help][run] -d --debug set entrypoint to bash" + echo "[help][run] --detach run in background instead of foreground" + echo "[help][run] -i --image x target image, default=lgsm-test" + echo "[help][run] --tag x \"lgsm\" run lgsm image or \"specific\" run last created $IMAGE:$tag" + echo "[help][run] --quick enforce quick monitoring" + echo "[help][run] -v --volume x use volume x" + echo "[help][run] " + echo "[help][run] args:" + echo "[help][run] x every other argument is added to docker run ... [args] IMAGE" exit 0;; + -c|--container) + container="$1" + shift;; -d|--debug) - debug=("--entrypoint" "bash");; + run_image+=(--entrypoint "bash");; --detach) docker_run_mode="-dt";; - -v|--volume) - volume=("-v" "$1:/home/linuxgsm") - shift;; - --quick) - quick="--health-interval=10s";; -i|--image) IMAGE="$key";; - -c|--container) - container="$1" - shift;; -t|--tag) tag="$1" shift;; + --quick) + run_image+=(--health-interval=10s);; + -v|--volume) + run_image+=(-v "$1:/home/linuxgsm") + shift;; *) if [ -n "$key" ]; then - echo "[run.sh] additional argument to docker: $key" - args+=("$key") + echo "[info][run] additional argument to docker: $key" + run_image+=("$key") fi ;; esac done - +run_image+=("$docker_run_mode" --name "$container" "$IMAGE:$tag") if [ -z "$tag" ]; then echo "please provide the tag to execute as first argument lgsm or specific" exit 1 fi -#shellcheck disable=SC2206 -cmds=(docker run $docker_run_mode --name "$container" ${volume[@]} ${debug[@]} $quick) -for arg in "${args[@]}"; do - cmds+=("$arg") -done -cmds+=("$IMAGE:$tag") - -echo "${cmds[@]}" -"${cmds[@]}" +echo "${run_image[@]}" +"${run_image[@]}" diff --git a/tests/quick.sh b/tests/quick.sh index b1d706b..4799f4e 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -11,54 +11,52 @@ source "$(dirname "$0")/internal/api_docker.sh" # shellcheck source=tests/internal/api_various.sh source "$(dirname "$0")/internal/api_various.sh" -VERSION=() + GAMESERVER="" -VOLUME=() -DEBUG="" -CLEAR="" LOGS="false" -RUN_ARGS=() + +build=(./internal/build.sh) +run=(./internal/run.sh) while [ $# -ge 1 ]; do key="$1" shift case "$key" in -h|--help) - echo "quick testing of provided gameserver" - echo "quick.sh [option] server" - echo "" - echo "options:" - echo "--version x use linuxgsm version x e.g. \"v21.4.1\"" - echo "--volume x use volume x e.g. \"lgsm\"" - echo "-d run gameserver and overwrite entrypoint to bash" - echo "--debug" - echo "-c run without docker cache" - echo "--no-cache" - echo "--logs print last log lines after run" - echo "-l" - echo "" - echo "server e.g. gmodserver" + echo "[help][quick] quick testing of provided gameserver" + echo "[help][quick] quick.sh [option] server" + echo "[help][quick] " + echo "[help][quick] options:" + echo "[help][quick] -c --no-cache run without docker cache" + echo "[help][quick] -d --debug run gameserver and overwrite entrypoint to bash" + echo "[help][quick] -l --logs print last log lines after run" + echo "[help][quick] --quick enforces a faster health check interval" + echo "[help][quick] --version x use linuxgsm version x e.g. \"v21.4.1\"" + echo "[help][quick] --volume x use volume x e.g. \"lgsm\"" + echo "[help][quick] " + echo "[help][quick] server e.g. gmodserver" exit 0;; - --version) - VERSION=("--version" "$1") - shift;; - --volume) - VOLUME=("--volume" "$1") - shift;; -c|--no-cache) - CLEAR="--no-cache";; + build+=(--no-cache);; -d|--debug) - DEBUG="--debug";; + run+=(--debug);; -l|--logs) LOGS="true";; + --quick) + run+=(--quick);; + --version) + build+=(--version "$1") + shift;; + --volume) + run+=(--volume "$1") + shift;; *) if [ -z "$GAMESERVER" ]; then GAMESERVER="$key" else echo "[quick.sh] additional argument to docker: \"$key\"" - RUN_ARGS+=("$key") - fi - ;; + run+=("$key") + fi;; esac done @@ -67,6 +65,8 @@ if [ -z "$GAMESERVER" ]; then exit 1 fi CONTAINER="linuxgsm-$GAMESERVER" +build+=(--latest "$GAMESERVER") +run+=(--container "$CONTAINER" --detach --tag "$GAMESERVER") function handleInterrupt() { removeContainer "$CONTAINER" @@ -76,10 +76,11 @@ trap handleInterrupt SIGTERM SIGINT ( cd "$(dirname "$0")" removeContainer "$CONTAINER" - #shellcheck disable=SC2068 - ./internal/build.sh $CLEAR ${VERSION[@]} --latest "$GAMESERVER" - #shellcheck disable=SC2068 - ./internal/run.sh --container "$CONTAINER" --detach ${VOLUME[@]} "$DEBUG" --tag "$GAMESERVER" ${RUN_ARGS[@]} + + echo "${build[@]}" + "${build[@]}" + echo "${run[@]}" + "${run[@]}" successful="false" if awaitHealthCheck "$CONTAINER"; then @@ -92,10 +93,10 @@ trap handleInterrupt SIGTERM SIGINT removeContainer "$CONTAINER" if "$successful"; then - echo "successful" + echo "[info][quick] successful" exit 0 else - echo "failed" + echo "[error][quick] failed" exit 1 fi ) From 6c0aafa8902b3db8e7ac870e236bf240d11ae606 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 27 Nov 2021 04:12:16 +0100 Subject: [PATCH 040/116] fix test cleanup --- tests/functions/testLgsmUpdate.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/functions/testLgsmUpdate.sh b/tests/functions/testLgsmUpdate.sh index 38008e0..3aeedc5 100644 --- a/tests/functions/testLgsmUpdate.sh +++ b/tests/functions/testLgsmUpdate.sh @@ -23,6 +23,7 @@ VOLUME="$3" rm "$log_downgrade" "$log_update" > /dev/null 2>&1 || true exit "$2" else + rm "$log_downgrade" "$log_update" > /dev/null 2>&1 || true echo "[info][testLgsmUpdate] $1" fi } From 35d9cec3fa24c9cf8d9b07f68ce2bb482cf0c664 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 27 Nov 2021 04:15:35 +0100 Subject: [PATCH 041/116] ~ mv functions -> features --- tests/features.sh | 10 +++++----- tests/{functions => features}/testCron.sh | 0 tests/{functions => features}/testDockerLogs.sh | 0 tests/{functions => features}/testFixPermissions.sh | 0 tests/{functions => features}/testLgsmUpdate.sh | 0 tests/{functions => features}/testUpdateUidGuid.sh | 0 6 files changed, 5 insertions(+), 5 deletions(-) rename tests/{functions => features}/testCron.sh (100%) rename tests/{functions => features}/testDockerLogs.sh (100%) rename tests/{functions => features}/testFixPermissions.sh (100%) rename tests/{functions => features}/testLgsmUpdate.sh (100%) rename tests/{functions => features}/testUpdateUidGuid.sh (100%) diff --git a/tests/features.sh b/tests/features.sh index bb7c858..7107aa4 100644 --- a/tests/features.sh +++ b/tests/features.sh @@ -17,11 +17,11 @@ VOLUME="linuxgsm-$GAMESERVER-testFeatures" fi ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" - ./tests/functions/testCron.sh "$VERSION" "$GAMESERVER" "$VOLUME" - ./tests/functions/testDockerLogs.sh "$VERSION" "$GAMESERVER" "$VOLUME" - ./tests/functions/testFixPermissions.sh "$VERSION" "$GAMESERVER" "$VOLUME" - ./tests/functions/testUpdateUidGuid.sh "$VERSION" "$GAMESERVER" "$VOLUME" - ./tests/functions/testLgsmUpdate.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/features/testCron.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/features/testDockerLogs.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/features/testFixPermissions.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/features/testUpdateUidGuid.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/features/testLgsmUpdate.sh "$VERSION" "$GAMESERVER" "$VOLUME" echo "[info][features] successful" ) diff --git a/tests/functions/testCron.sh b/tests/features/testCron.sh similarity index 100% rename from tests/functions/testCron.sh rename to tests/features/testCron.sh diff --git a/tests/functions/testDockerLogs.sh b/tests/features/testDockerLogs.sh similarity index 100% rename from tests/functions/testDockerLogs.sh rename to tests/features/testDockerLogs.sh diff --git a/tests/functions/testFixPermissions.sh b/tests/features/testFixPermissions.sh similarity index 100% rename from tests/functions/testFixPermissions.sh rename to tests/features/testFixPermissions.sh diff --git a/tests/functions/testLgsmUpdate.sh b/tests/features/testLgsmUpdate.sh similarity index 100% rename from tests/functions/testLgsmUpdate.sh rename to tests/features/testLgsmUpdate.sh diff --git a/tests/functions/testUpdateUidGuid.sh b/tests/features/testUpdateUidGuid.sh similarity index 100% rename from tests/functions/testUpdateUidGuid.sh rename to tests/features/testUpdateUidGuid.sh From 02a7c105db9b5b2c431901c36d01c7ab37532e8a Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 27 Nov 2021 04:33:34 +0100 Subject: [PATCH 042/116] fix rename issues --- .gitignore | 2 +- tests/features/testDockerLogs.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 617cab2..95630d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ *~ tests/results -tests/functions/*.log \ No newline at end of file +**/*.log \ No newline at end of file diff --git a/tests/features/testDockerLogs.sh b/tests/features/testDockerLogs.sh index e9e27c6..c1f30fe 100644 --- a/tests/features/testDockerLogs.sh +++ b/tests/features/testDockerLogs.sh @@ -9,8 +9,9 @@ GAMESERVER="$2" VOLUME="$3" ( + log="$(realpath "$(dirname "$0")")/testDockerLogs.log" cd "$(dirname "$0")/../.." - log="tests/functions/testDockerLogs.log" + ./tests/quick.sh --quick --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" if grep -qE 'VAC\s*secure\s*mode\s*is\s*activated.' "$log"; then rm "$log" From 096ff17faed60687d20b61445aadee3d5bb59008 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 27 Nov 2021 14:40:48 +0100 Subject: [PATCH 043/116] ~ test --quick as default --- tests/features/testDockerLogs.sh | 2 +- tests/features/testFixPermissions.sh | 2 +- tests/features/testLgsmUpdate.sh | 6 +++--- tests/features/testUpdateUidGuid.sh | 4 ++-- tests/quick.sh | 5 +---- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/features/testDockerLogs.sh b/tests/features/testDockerLogs.sh index c1f30fe..4a86e85 100644 --- a/tests/features/testDockerLogs.sh +++ b/tests/features/testDockerLogs.sh @@ -12,7 +12,7 @@ VOLUME="$3" log="$(realpath "$(dirname "$0")")/testDockerLogs.log" cd "$(dirname "$0")/../.." - ./tests/quick.sh --quick --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" + ./tests/quick.sh --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" if grep -qE 'VAC\s*secure\s*mode\s*is\s*activated.' "$log"; then rm "$log" echo "[info][testDockerLogs] successful" diff --git a/tests/features/testFixPermissions.sh b/tests/features/testFixPermissions.sh index 8fb788c..48fe129 100644 --- a/tests/features/testFixPermissions.sh +++ b/tests/features/testFixPermissions.sh @@ -38,7 +38,7 @@ source "$(dirname "$0")/../internal/api_various.sh" fi } - if ./tests/quick.sh --quick --version "$VERSION" --volume "$VOLUME" "$GAMESERVER"; then + if ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER"; then permission="$("${dockerRun[@]}" alpine ls -l "$newFile")" owner="$("${dockerRun[@]}" alpine ls -l "$newFile")" if ! grep -qE '^.rw.r..---' <<< "$permission"; then diff --git a/tests/features/testLgsmUpdate.sh b/tests/features/testLgsmUpdate.sh index 3aeedc5..6b1cd0f 100644 --- a/tests/features/testLgsmUpdate.sh +++ b/tests/features/testLgsmUpdate.sh @@ -11,7 +11,7 @@ VOLUME="$3" ( cd "$(dirname "$0")/../.." - ./tests/quick.sh --quick --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" log_downgrade="downgrade.log" log_update="upgrade.log" @@ -29,11 +29,11 @@ VOLUME="$3" } # old versions are allowed to fail, as long as log contains the expected entry - ./tests/quick.sh --quick --logs --version "$OLD_VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_downgrade" || true + ./tests/quick.sh --logs --version "$OLD_VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_downgrade" || true if ! grep -qF '[lgsm-init] force uninstall lgsm' "$log_downgrade"; then log "downgrading from \"$VERSION\" to \"$OLD_VERSION\" successful but container didn't forcefully uninstalled lgsm" 21 - elif ! ./tests/quick.sh --quick --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_update"; then + elif ! ./tests/quick.sh --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_update"; then log "upgrading from \"$OLD_VERSION\" to \"$VERSION\" failed" 22 elif ! grep -qF '[lgsm-init] force uninstall lgsm' "$log_update"; then diff --git a/tests/features/testUpdateUidGuid.sh b/tests/features/testUpdateUidGuid.sh index 008ccda..d3b4fda 100644 --- a/tests/features/testUpdateUidGuid.sh +++ b/tests/features/testUpdateUidGuid.sh @@ -12,7 +12,7 @@ gid="750" ( cd "$(dirname "$0")/../.." - ./tests/quick.sh --quick --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" function log() { if [ -n "${2:-}" ]; then @@ -35,7 +35,7 @@ gid="750" log "precondition successful" fi - ./tests/quick.sh --quick --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" -e "USER_ID=1234" -e "GROUP_ID=5678" + ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" -e "USER_ID=1234" -e "GROUP_ID=5678" if [ "0" != "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | wc -l )" ]; then log "update failed, there are files in \"$VOLUME\" which aren't owned by user \"1234\"" 22 "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | tail)" diff --git a/tests/quick.sh b/tests/quick.sh index 4799f4e..fdaa040 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -16,7 +16,7 @@ GAMESERVER="" LOGS="false" build=(./internal/build.sh) -run=(./internal/run.sh) +run=(./internal/run.sh --quick) while [ $# -ge 1 ]; do key="$1" shift @@ -30,7 +30,6 @@ while [ $# -ge 1 ]; do echo "[help][quick] -c --no-cache run without docker cache" echo "[help][quick] -d --debug run gameserver and overwrite entrypoint to bash" echo "[help][quick] -l --logs print last log lines after run" - echo "[help][quick] --quick enforces a faster health check interval" echo "[help][quick] --version x use linuxgsm version x e.g. \"v21.4.1\"" echo "[help][quick] --volume x use volume x e.g. \"lgsm\"" echo "[help][quick] " @@ -42,8 +41,6 @@ while [ $# -ge 1 ]; do run+=(--debug);; -l|--logs) LOGS="true";; - --quick) - run+=(--quick);; --version) build+=(--version "$1") shift;; From e693299065d81c4bc78841a45411bc1c2637de11 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 03:49:13 +0100 Subject: [PATCH 044/116] + testLoadConfig --- Dockerfile | 7 +- commands/lgsm-fix-permission | 4 +- commands/lgsm-load-config | 117 +++++++++++++++++---- setup/entrypoint.sh | 8 +- setup/installGamedig.sh | 2 +- tests/createImages.sh | 2 +- tests/features.sh | 1 + tests/features/testLoadConfig.sh | 175 +++++++++++++++++++++++++++++++ tests/full.sh | 15 ++- tests/internal/run.sh | 2 +- tests/quick.sh | 14 ++- tests/shellcheck.sh | 2 +- tests/steam_test_credentials | 6 ++ 13 files changed, 318 insertions(+), 37 deletions(-) create mode 100644 tests/features/testLoadConfig.sh create mode 100644 tests/steam_test_credentials diff --git a/Dockerfile b/Dockerfile index ffd46fe..b2040e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ FROM ubuntu:21.04 as linuxgsm ARG ARG_LGSM_VERSION="master" ENV LGSM_VERSION="${ARG_LGSM_VERSION:?}" \ LGSM_GAMESERVER="" \ + LGSM_CONFIG_PATTERN_GAME="" \ USER_ID="750" \ GROUP_ID="750" \ \ @@ -28,10 +29,7 @@ ENV LGSM_VERSION="${ARG_LGSM_VERSION:?}" \ LC_ALL="en_US.UTF-8" \ TERM="xterm" \ SUPERCRONIC_CONFIG="/home/linuxgsm-scripts/cron.config" \ - LGSM_STARTED="/home/linuxgsm/server.started" \ - LGSM_PATTERN_CONFIG='%s="%s"' \ - LGSM_PATTERN_COMMON='%s="%s"' \ - LGSM_PATTERN_GAME='%s="%s"' + LGSM_STARTED="/home/linuxgsm/server.started" COPY --from=dependencyStage \ /usr/local/bin/gosu \ @@ -50,6 +48,7 @@ COPY setup/installMinimalDependencies.sh \ commands/lgsm-cron-start \ commands/lgsm-init \ commands/lgsm-fix-permission \ + commands/lgsm-load-config \ commands/lgsm-tmux-attach \ commands/lgsm-update-uid-gid \ "$LGSM_SCRIPTS"/ diff --git a/commands/lgsm-fix-permission b/commands/lgsm-fix-permission index 05cbcab..c4e5669 100644 --- a/commands/lgsm-fix-permission +++ b/commands/lgsm-fix-permission @@ -8,5 +8,7 @@ set -o nounset GROUP_NAME="$USER_NAME" chown -R "$USER_NAME:$GROUP_NAME" "$LGSM_PATH" chmod 750 "$LGSM_PATH" -chmod 750 "$LGSM_PATH/$LGSM_GAMESERVER" +if [ -f "$LGSM_PATH/$LGSM_GAMESERVER" ]; then + chmod 750 "$LGSM_PATH/$LGSM_GAMESERVER" +fi chmod -R ug+rw,o= "$LGSM_PATH" diff --git a/commands/lgsm-load-config b/commands/lgsm-load-config index bb31693..26b5721 100644 --- a/commands/lgsm-load-config +++ b/commands/lgsm-load-config @@ -8,8 +8,7 @@ if [ -z "$LGSM_GAMESERVER" ]; then echo "[error][lgsm-load-config] \$LGSM_GAMESERVER is unset but needed for this script, abort" exit 10 fi - -configfile_default="$LGSM_PATH/lgsm/config-default/config-lgsm/$LGSM_GAMESERVER/_default.cfg" +configfile_default="$LGSM_PATH/lgsm/config-lgsm/$LGSM_GAMESERVER/_default.cfg" configfile_common="$LGSM_PATH/lgsm/config-lgsm/$LGSM_GAMESERVER/common.cfg" configfile_game="$( lgsm-details | grep -Eo 'Config file:.*' | grep -o '/.*' || true )" @@ -18,45 +17,119 @@ if [ ! -f "$configfile_default" ]; then exit 11 fi +function fgrep_ignore_leading_whitespaces() { + local find="$1" + local file="$2" + + mapfile -d $'\n' -t lines < <(cat "$file") + for line in "${lines[@]}"; do + trimmed_line="$(grep -E -e '\S.*\S|\S' <<< "$line" || true)" + if [ "${trimmed_line:0:${#find}}" = "$find" ]; then + echo "$line" + fi + done +} + +function sed_sanitize() { + local sanitized="$1" + local sanitized="${sanitized//\\/\\\\}" # \ need to be escaped e.g. 's/\//' + local sanitized="${sanitized//\//\\/}" # / need to be escaped e.g. 's///' + #local sanitized="${sanitized//\{/\\\\{}" # { need to be escaped + local sanitized="${sanitized//[/\\[}" # [ need to be escaped + local sanitized="${sanitized//&/\\&}" # & need to be escaped + echo "$sanitized" +} + +# TODO probably there need to be more options for non cfg configs, e.g. json format or so +function addConfigToFile() { + file="$1" + # IMPORTANT: currently exactly two %s are allowed! + pattern="${2:-}" + key="$3" + value="$4" + + # determine pattern for given file, if not provided + if [ -z "$pattern" ]; then + if grep -Eq '^\s*[a-zA-Z0-9_-]*=\s*"' "$file"; then + pattern='%s="%s"' + elif grep -Eq '^\s*[a-zA-Z0-9_-]*\s\s*"' "$file"; then + pattern='%s "%s"' + else + echo "[error][lgsm-load-config] couldn't determine pattern for \"$file\" please provide it in environment variable \"LGSM_CONFIG_PATTERN_GAME\" or dont provide values for injection" + exit 1 + fi + echo "[info][lgsm-load-config] choosing pattern \"$pattern\" " + else + echo "[info][lgsm-load-config] using provided pattern \"$pattern\" for \"$file\"" + fi + + # assuming pattern is prefix %s mid %s suffix + pattern_prefix="${pattern%%%s*}" # 1 %s 2 %s 3 -> 1 + pattern_mid="${pattern#*%s}" # 1 %s 2 %s 3 -> 2 %s 3 + pattern_mid="${pattern_mid%%%s*}" # 2 %s 3 -> 2 + pattern_suffix="${pattern##*%s}" # 1 %s 2 %s 3 -> 3 + + exact_match="$pattern_prefix$key$pattern_mid" + mapfile -t lines < <(fgrep_ignore_leading_whitespaces "$exact_match" "$file") + if [ "${#lines[@]}" -ge "1" ]; then + echo "[info][lgsm-load-config] $key is already part of $file, replacing" + find="$(sed_sanitize "${lines[0]}")" + replace="$(sed_sanitize "$exact_match$value$pattern_suffix")" + sed -i "s/$find/$replace/" "$file" + + for i in $(seq 1 "$((${#lines[@]}-1))"); do + echo "[warning][lgsm-load-config] found multiple entries of \"$key\" and removing it now" + find="$(sed_sanitize "${lines[$i]}")" + sed -i "s/$find//" "$file" + done + else + echo "[info][lgsm-load-config] adding $key to $target_file" + printf "\n%s%s%s%s%s\n" "$pattern_prefix" "$key" "$pattern_mid" "$value" "$pattern_suffix" >> "$file" + fi +} + function handleEnvironmentVariablePrefix() { prefix="$1" target_file="$2" - pattern="$3" - check_file="$4" + pattern="${3:-}" + check_file="${4:-}" + #shellcheck disable=SC1087 #prefix is no array for config in $( env | grep -Eo "^$prefix[^=]*" ); do key="${config:${#prefix}}" - value="$( eval "\$$config" )" + value="$( eval echo "\"\$$config\"" )" + echo "[info][lgsm-load-config] processing $key" - if [ -z "$check_file" ]; then - if grep -Eo "^$key" "$check_file"; then - echo "[info][lgsm-load-config] $key is part of $check_file, adding to $target_file" - #shellcheck disable=SC2059 - printf "$pattern\n" "$key" "$value" >> "$target_file" + if [ -n "$check_file" ]; then + if [ -f "$check_file" ]; then + if grep -Eq "^$key" "$check_file"; then + echo "[info][lgsm-load-config] $key is part of $check_file" + addConfigToFile "$target_file" "$pattern" "$key" "$value" + + else + echo "[error][lgsm-load-config] provided environment variable $config is a non-default variable for current gameserver $LGSM_GAMESERVER, if you are sure you want it added use CONFIGFORCED_ as prefix." + exit 12 + fi else - echo "[error][lgsm-load-config] provided environment variable $config seems illegal for current gameserver $LGSM_GAMESERVER" - exit 12 + echo "[error][lgsm-load-config] can't check if $key is part of $check_file because the file doesn't exist" + exit 13 fi else - echo "[info][lgsm-load-config] $key is part of $check_file, adding to $target_file" - echo "$key=$value" >> "$target_file" + addConfigToFile "$target_file" "$pattern" "$key" "$value" fi - done } rm -f "$configfile_common" # CONFIG options should be safe to use => fail if not correct because we can verify they are part of _default.cfg -handleEnvironmentVariablePrefix "CONFIG_" "$configfile_common" "$LGSM_PATTERN_CONFIG" "$configfile_default" -# COMMON options will be directly added -handleEnvironmentVariablePrefix "COMMON_" "$configfile_common" "$LGSM_PATTERN_COMMON" +handleEnvironmentVariablePrefix "CONFIG_" "$configfile_common" "%s=\"%s\"" "$configfile_default" +# CONFIGFORCED_ -> skip check, e.g. +handleEnvironmentVariablePrefix "CONFIGFORCED_" "$configfile_common" "%s=\"%s\"" # GAME_ is added to game specific config file -# TODO probably there need to be more options for non cfg configs, e.g. json format or so -if [ -f "$configfile_game" ]; then - rm -f "$configfile_game" - handleEnvironmentVariablePrefix "GAME_" "$configfile_game" "$LGSM_PATTERN_GAME" +if [ -n "$configfile_game" ] && [ -f "$configfile_game" ]; then + handleEnvironmentVariablePrefix "GAME_" "$configfile_game" "$LGSM_CONFIG_PATTERN_GAME" else echo "[warning][lgsm-load-config] couldn't get config file for $LGSM_GAMESERVER, therefore skipped all environment variables with \$GAME_ " fi diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index 38469d4..d1b9ad2 100644 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -17,9 +17,15 @@ if [ ! -e "$LGSM_GAMESERVER" ]; then lgsm-auto-install else lgsm-init - lgsm-update + if ! lgsm-update; then + echo "" + echo "[error][entrypoint] update failed, remove $LGSM_GAMESERVER from volume if you want to reinstall it" + echo "[error][entrypoint] docker run --rm -v VOLUME_NAME:/home alpine:3.15 rm -vf /home/$LGSM_GAMESERVER" + exit 1 + fi fi +lgsm-load-config lgsm-start trap lgsm-stop SIGTERM SIGINT lgsm-cron-start > /dev/null 2>&1 & diff --git a/setup/installGamedig.sh b/setup/installGamedig.sh index 148fbc2..2726a04 100644 --- a/setup/installGamedig.sh +++ b/setup/installGamedig.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -eux + set -o errexit set -o nounset diff --git a/tests/createImages.sh b/tests/createImages.sh index 7e8d746..e4c29c0 100644 --- a/tests/createImages.sh +++ b/tests/createImages.sh @@ -5,7 +5,7 @@ set -o nounset set -o pipefail VERSION="$1" -IMAGE="jusito/linuxgsm" +IMAGE="gameservermanagers/linuxgsm-docker" # shellcheck source=tests/internal/api_various.sh source "$(dirname "$0")/internal/api_various.sh" diff --git a/tests/features.sh b/tests/features.sh index 7107aa4..dfe4ead 100644 --- a/tests/features.sh +++ b/tests/features.sh @@ -22,6 +22,7 @@ VOLUME="linuxgsm-$GAMESERVER-testFeatures" ./tests/features/testFixPermissions.sh "$VERSION" "$GAMESERVER" "$VOLUME" ./tests/features/testUpdateUidGuid.sh "$VERSION" "$GAMESERVER" "$VOLUME" ./tests/features/testLgsmUpdate.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./tests/features/testLoadConfig.sh "$VERSION" "$GAMESERVER" "$VOLUME" echo "[info][features] successful" ) diff --git a/tests/features/testLoadConfig.sh b/tests/features/testLoadConfig.sh new file mode 100644 index 0000000..1c6300c --- /dev/null +++ b/tests/features/testLoadConfig.sh @@ -0,0 +1,175 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +# shellcheck source=tests/internal/api_docker.sh +source "$(dirname "$0")/../internal/api_docker.sh" + +#VERSION="$1" +GAMESERVER="$2" +VOLUME="$3" +CONTAINER="linuxgsm-$GAMESERVER-testLoadConfig" +configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" + +( + cd "$(dirname "$0")/../.." + + function log() { + if [ -n "${2:-}" ]; then + echo "[error][testLoadConfig] $1 exit code $2" + removeContainer "$CONTAINER" + echo "${3:-}" + exit "$2" + else + echo "[info][testLoadConfig] $1" + fi + } + + inContainer=(docker exec -it "$CONTAINER") + + # test valid CONFIG_ -> common.cfg + maxbackups="$RANDOM" + removeContainer "$CONTAINER" + ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" \ + -e CONFIG_maxbackups="$maxbackups" + if awaitHealthCheck "$CONTAINER"; then + log "container started with maxbackups injected" + common_cfg="$( "${inContainer[@]}" cat "$configfile_common" || true )" + if ! grep -qE "^maxbackups=\"$maxbackups\"" <<< "$common_cfg"; then + log "environment variable for maxbackups not added to common.cfg" 21 "$common_cfg" + else + log "maxbackups successfully added!" + fi + else + log "container didn't start with steamcredentials" 20 "$(docker logs "$CONTAINER")" + fi + + # test steam credentials with CONFIGFORCED_ -> common.cfg (two different usages) + # using slightly different keys because illegal credentials will break the container + removeContainer "$CONTAINER" + ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" \ + -e CONFIGFORCED_steamuser_test="new Steam User" -e "CONFIGFORCED_steampass_test=new Steam Password" + if awaitHealthCheck "$CONTAINER"; then + log "container started with steam credentials injected" + common_cfg="$( "${inContainer[@]}" cat "$configfile_common" || true )" + if ! grep -qE '^steamuser_test="new Steam User"' <<< "$common_cfg"; then + log "environment variable for steamuser not added to common.cfg" 21 "$common_cfg" + elif ! grep -qE '^steampass_test="new Steam Password"' <<< "$common_cfg"; then + log "environment variable for steampassword not added to common.cfg" 22 "$common_cfg" + else + log "steamuser and steampass successfully added!" + fi + else + log "container didn't start with steamcredentials" 20 "$(docker logs "$CONTAINER")" + fi + + # test overwriting lgsm common.cfg on every start + removeContainer "$CONTAINER" + ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" + if awaitHealthCheck "$CONTAINER"; then + log "container started, checking if common.cfg is overwritten" + common_cfg="$("${inContainer[@]}" cat "$configfile_common" || true)" + if grep -qE '^steamuser="newSteamUser"' <<< "$common_cfg"; then + log "environment variable for steamuser still there, common.cfg not overwritten" 24 "$common_cfg" + elif grep -qE '^steamuser="newSteamUser"' <<< "$common_cfg"; then + log "environment variable for steampass still there, common.cfg not overwritten" 25 "$common_cfg" + else + log "common.cfg successfully overwritten on startup!" + fi + else + log "container didn't start, cant check if common.cfg is overwritten " 23 "$(docker logs "$CONTAINER" || true )" + fi + + # test illegal CONFIG_ value which isn't part of _default.cfg -> expecting crash + removeContainer "$CONTAINER" + ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" \ + -e CONFIG_steamuser_illegal="newSteamUser" + if ! awaitHealthCheck "$CONTAINER"; then + log "container didn't start with illegal CONFIG value \"steamuser_illegal\"" + else + log "illegal CONFIG option didn't break the container" 26 "$(docker logs "$CONTAINER" || true)" + fi + + # test valid GAME_ entry which isn't already part of the game cfg + removeContainer "$CONTAINER" + ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" \ + -e GAME_steamuser_illegal="newSteamUser" + if awaitHealthCheck "$CONTAINER"; then + log "container started with valid GAME_ value" + lgsm_details="$(printf "%s\n" "$("${inContainer[@]}" lgsm-details 2>&1 | tr -d '\r' || true )")" + configfile_game="$( grep -Eo 'Config file:.*' <<< "$lgsm_details" | grep -o '/.*' || true )" + if [ -n "$configfile_game" ]; then + log "found game configfile: \"$configfile_game\"" + configfile_game_content="$( "${inContainer[@]}" cat "$configfile_game" 2>&1 || true )" + if grep -qE '^steamuser_illegal[^"]*"newSteamUser"' <<< "$configfile_game_content"; then + log "successfully injected GAME_steamuser_illegal" + # remove entries + docker run -it --rm -v "$VOLUME:/home/linuxgsm" alpine sh -c "head -n -3 '$configfile_game' > /tmp/file.test 2>&1; cat /tmp/file.test > '$configfile_game'" + else + log "failed to inject GAME_steamuser_illegal" 29 "$configfile_game_content $(docker logs "$CONTAINER" || true )" + fi + else + log "couldn't determine game config file" 28 + fi + else + log "container didn't start with valid GAME_ env" 27 "$(docker logs "$CONTAINER" || true )" + fi + + # test valid GAME_ entry with modified pattern which isn't already part of the game cfg + removeContainer "$CONTAINER" + ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" \ + -e GAME_steamuser_test="newSteamUser" -e LGSM_CONFIG_PATTERN_GAME="// test-comment !§$%\\&/()%s{\\[]}\\\\%s@€" + if awaitHealthCheck "$CONTAINER"; then + log "container started with valid GAME_ value and custom pattern" + lgsm_details="$(printf "%s\n" "$("${inContainer[@]}" lgsm-details 2>&1 | tr -d '\r' || true )")" + configfile_game="$( grep -Eo 'Config file:.*' <<< "$lgsm_details" | grep -o '/.*' || true )" + if [ -n "$configfile_game" ]; then + log "found game configfile: \"$configfile_game\"" + configfile_game_content="$( "${inContainer[@]}" cat "$configfile_game" 2>&1 || true )" + if [ -z "$configfile_game_content" ]; then + log "extracted configfile is empty, therefore failed to inject GAME_ variable" 33 + elif grep -qE '^!§$%&/()steamuser_illegal{\[]}\newSteamUser' <<< "$configfile_game_content"; then + log "failed to inject GAME_steamuser_illegal" 32 "$configfile_game_content $(docker logs "$CONTAINER" || true )" + else + log "successfully injected GAME_steamuser_illegal with custom pattern" + # remove entries + docker run -it --rm -v "$VOLUME:/home/linuxgsm" alpine sh -c "head -n -2 '$configfile_game' > /tmp/file.test 2>&1; cat /tmp/file.test > '$configfile_game'" + fi + else + log "couldn't determine game config file" 31 + fi + else + log "container didn't start with valid GAME_ env, you probably need to fix this manually" 30 "$(docker logs "$CONTAINER" || true )" + fi + + # test valid GAME_ entry which is already part of the game cfg + hostname="$RANDOM" + removeContainer "$CONTAINER" + ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" \ + -e GAME_hostname="$hostname" + if awaitHealthCheck "$CONTAINER"; then + log "container started with valid GAME_ value which is/was already part of game config" + lgsm_details="$(printf "%s\n" "$("${inContainer[@]}" lgsm-details 2>&1 | tr -d '\r' || true )")" + configfile_game="$( grep -Eo 'Config file:.*' <<< "$lgsm_details" | grep -o '/.*' || true )" + if [ -n "$configfile_game" ]; then + log "found game configfile: \"$configfile_game\"" + configfile_game_content="$("${inContainer[@]}" cat "$configfile_game")" + # only valid for gmodserver and similiar + if ! grep -qE "^hostname\s*\"$hostname\"" <<< "$configfile_game_content"; then + log "failed to inject existing GAME_ config" 35 "$configfile_game_content $(docker logs "$CONTAINER" || true )" + elif [ "1" -ne "$(grep -oE '^hostname' <<< "$configfile_game_content" | wc -l)" ]; then + log "injected GAME_config is injected but not replaced" 36 "$configfile_game_content $(docker logs "$CONTAINER" || true )" + else + log "successfully replaced existing GAME_config" + fi + else + log "couldn't determine game config file" 37 + fi + else + log "container didn't start with valid GAME_ env" 33 "$(docker logs "$CONTAINER" || true )" + fi + + removeContainer "$CONTAINER" +) diff --git a/tests/full.sh b/tests/full.sh index 857b581..0ab3aa9 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -10,6 +10,7 @@ PARRALEL="" PARRALEL="$(lscpu -p | grep -Ev '^#' | sort -u -t, -k 2,4 | wc -l)" ROOT_FOLDER="$(realpath "$(dirname "$0")/..")" RERUN="false" +VOLUMES="false" while [ $# -ge 1 ]; do key="$1" shift @@ -22,6 +23,7 @@ while [ $# -ge 1 ]; do echo "[help][full] options:" echo "[help][full] -c --cpus x run x servers in parralel, default x = physical cores" echo "[help][full] --rerun check results and runs every gameserver which wasn't successful" + echo "[help][full] --volumes use volumes \"linuxgsm-SERVERCODE\"" echo "[help][full] -v --version x use linuxgsm version x e.g. \"v21.4.1\"" echo "[help][full] " echo "[help][full] server:" @@ -33,6 +35,8 @@ while [ $# -ge 1 ]; do shift;; --rerun) RERUN="true";; + --volumes) + VOLUMES="true";; -v|--version) VERSION="$1" shift;; @@ -100,8 +104,15 @@ mkdir -p "$RESULTS" rerunIsFine="$( ( ! "$RERUN" || "$serverDidntStartSuccessful" ) && echo true || echo false )" if "$testThisServercode" && "$rerunIsFine"; then echo "[info][full] testing: $server_code" - ( - if ./tests/quick.sh --logs --version "$VERSION" "$server_code" > "$RESULTS/$server_code.log" 2>&1; then + ( + quick=(./tests/quick.sh --logs --version "$VERSION") + if "$VOLUMES"; then + quick+=(--volume "linuxgsm-$server_code") + fi + quick+=("$server_code") + + echo "${quick[@]}" + if "${quick[@]}" > "$RESULTS/$server_code.log" 2>&1; then mv "$RESULTS/$server_code.log" "$RESULTS/successful.$server_code.log" else mv "$RESULTS/$server_code.log" "$RESULTS/failed.$server_code.log" diff --git a/tests/internal/run.sh b/tests/internal/run.sh index eb423ee..382355f 100644 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -38,7 +38,7 @@ while [ $# -ge 1 ]; do tag="$1" shift;; --quick) - run_image+=(--health-interval=10s);; + run_image+=(--health-interval=10s --health-start-period=60s);; -v|--volume) run_image+=(-v "$1:/home/linuxgsm") shift;; diff --git a/tests/quick.sh b/tests/quick.sh index fdaa040..ce648d6 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -10,6 +10,8 @@ cd "$(dirname "$0")/.." source "$(dirname "$0")/internal/api_docker.sh" # shellcheck source=tests/internal/api_various.sh source "$(dirname "$0")/internal/api_various.sh" +# shellcheck source=tests/steam_test_credentials +source "$(dirname "$0")/steam_test_credentials" GAMESERVER="" @@ -51,15 +53,19 @@ while [ $# -ge 1 ]; do if [ -z "$GAMESERVER" ]; then GAMESERVER="$key" else - echo "[quick.sh] additional argument to docker: \"$key\"" + echo "[info][quick] additional argument to docker: \"$key\"" run+=("$key") fi;; esac done if [ -z "$GAMESERVER" ]; then - echo "ERROR no gameserver provided" + echo "[error][quick] no gameserver provided" exit 1 +elif [ -n "$steam_test_username" ] && [ -n "$steam_test_password" ]; then + run+=(-e "CONFIGFORCED_steamuser=\"$steam_test_username\"" -e "CONFIGFORCED_steampass=\"$steam_test_password\"") +else + echo "[warning][quick] no steam credentials provided, some servers will fail without it" fi CONTAINER="linuxgsm-$GAMESERVER" build+=(--latest "$GAMESERVER") @@ -85,7 +91,9 @@ trap handleInterrupt SIGTERM SIGINT fi stopContainer "$CONTAINER" if "$LOGS"; then - docker logs "$CONTAINER" + printf "[info][quick] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" + elif ! "$successful"; then + printf "[info][quick] logs:\n%s\n" "$(docker logs -n 10 "$CONTAINER" 2>&1 || true)" fi removeContainer "$CONTAINER" diff --git a/tests/shellcheck.sh b/tests/shellcheck.sh index 37ab4b6..fcb48d5 100644 --- a/tests/shellcheck.sh +++ b/tests/shellcheck.sh @@ -7,7 +7,7 @@ set -o nounset cd "$(dirname "$0")/.." files=() - mapfile -d $'\0' files < <( find commands setup tests -type f ! -iname "*.log" -print0 ) + mapfile -d $'\0' files < <( find commands setup tests -type f ! -iname "*.log" ! -iname "*.yml" -print0 ) shellcheck "${files[@]}" ) diff --git a/tests/steam_test_credentials b/tests/steam_test_credentials new file mode 100644 index 0000000..99fbdce --- /dev/null +++ b/tests/steam_test_credentials @@ -0,0 +1,6 @@ +#!/bin/bash + +#shellcheck disable=SC2034 # used elsewhere +steam_test_username="" +#shellcheck disable=SC2034 # used elsewhere +steam_test_password="" From 5302ab1f2c3c3900d499ebb9ce1e6145b21672c2 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 03:53:10 +0100 Subject: [PATCH 045/116] + LGSM_DEBUG --- Dockerfile | 1 + commands/lgsm-cron-init | 3 +++ commands/lgsm-cron-start | 3 +++ commands/lgsm-fix-permission | 3 +++ commands/lgsm-init | 3 +++ commands/lgsm-load-config | 3 +++ commands/lgsm-tmux-attach | 3 +++ commands/lgsm-update-uid-gid | 3 +++ setup/cleanImage.sh | 3 +++ setup/createAlias.sh | 3 +++ setup/entrypoint.sh | 3 +++ setup/installDependencies.sh | 3 +++ setup/installGamedig.sh | 3 +++ setup/installLGSM.sh | 3 +++ setup/installMinimalDependencies.sh | 3 +++ setup/setupUser.sh | 3 +++ 16 files changed, 46 insertions(+) diff --git a/Dockerfile b/Dockerfile index b2040e3..7cd2c93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,7 @@ ENV LGSM_VERSION="${ARG_LGSM_VERSION:?}" \ LGSM_CONFIG_PATTERN_GAME="" \ USER_ID="750" \ GROUP_ID="750" \ + LGSM_DEBUG="false" \ \ USER_NAME="linuxgsm" \ LGSM_PATH="/home/linuxgsm" \ diff --git a/commands/lgsm-cron-init b/commands/lgsm-cron-init index 99203e8..bcd13ed 100644 --- a/commands/lgsm-cron-init +++ b/commands/lgsm-cron-init @@ -2,6 +2,9 @@ set -o errexit set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi LOG="$LGSM_PATH/log/cron.log" gosu "$USER_NAME" mkdir -p "$(dirname "$LOG")" diff --git a/commands/lgsm-cron-start b/commands/lgsm-cron-start index 8fe6440..06be44c 100644 --- a/commands/lgsm-cron-start +++ b/commands/lgsm-cron-start @@ -2,5 +2,8 @@ set -o errexit set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi gosu "$USER_NAME" supercronic -debug "$SUPERCRONIC_CONFIG" diff --git a/commands/lgsm-fix-permission b/commands/lgsm-fix-permission index c4e5669..2c49bf0 100644 --- a/commands/lgsm-fix-permission +++ b/commands/lgsm-fix-permission @@ -2,6 +2,9 @@ set -o errexit set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi # only volume needs to be fixed, everything else can be fixed by recreating the container diff --git a/commands/lgsm-init b/commands/lgsm-init index 1285f89..f786da0 100644 --- a/commands/lgsm-init +++ b/commands/lgsm-init @@ -2,6 +2,9 @@ set -o errexit set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi # is gameserver already installed ? # if linuxgsm.sh is changed = update -> remove lgsm folder diff --git a/commands/lgsm-load-config b/commands/lgsm-load-config index 26b5721..bf4bcdb 100644 --- a/commands/lgsm-load-config +++ b/commands/lgsm-load-config @@ -3,6 +3,9 @@ set -o errexit set -o nounset set -o pipefail +if "$LGSM_DEBUG"; then + set -o xtrace +fi if [ -z "$LGSM_GAMESERVER" ]; then echo "[error][lgsm-load-config] \$LGSM_GAMESERVER is unset but needed for this script, abort" diff --git a/commands/lgsm-tmux-attach b/commands/lgsm-tmux-attach index d61fb91..bd6a3f5 100644 --- a/commands/lgsm-tmux-attach +++ b/commands/lgsm-tmux-attach @@ -2,6 +2,9 @@ set -o errexit set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi gosu "$USER_NAME" tmux set -g status off gosu "$USER_NAME" tmux attach 2> /dev/null diff --git a/commands/lgsm-update-uid-gid b/commands/lgsm-update-uid-gid index 6337982..37c02ba 100644 --- a/commands/lgsm-update-uid-gid +++ b/commands/lgsm-update-uid-gid @@ -2,6 +2,9 @@ set -o errexit set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi GROUP_NAME="$USER_NAME" if [ "$(id --user "$USER_ID" 2> /dev/null)" != "$USER_ID" ] || [ "$(id --group "$USER_ID" 2> /dev/null)" != "$GROUP_ID" ]; then diff --git a/setup/cleanImage.sh b/setup/cleanImage.sh index 8b99f48..c26e4a3 100644 --- a/setup/cleanImage.sh +++ b/setup/cleanImage.sh @@ -2,6 +2,9 @@ set -o errexit set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi echo "[info][cleanImage] cleaning image" apt-get autoremove -y diff --git a/setup/createAlias.sh b/setup/createAlias.sh index ac32de6..f049b95 100644 --- a/setup/createAlias.sh +++ b/setup/createAlias.sh @@ -7,6 +7,9 @@ fi set -o errexit set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi echo "[info][createAlias] creating linuxgsm alias" function createAlias() { diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index d1b9ad2..dc9d4e1 100644 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -3,6 +3,9 @@ set -o errexit set -o pipefail set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi cd "$LGSM_PATH" rm "$LGSM_STARTED" > /dev/null 2>&1 || true diff --git a/setup/installDependencies.sh b/setup/installDependencies.sh index 1b1bead..90d98b0 100644 --- a/setup/installDependencies.sh +++ b/setup/installDependencies.sh @@ -4,6 +4,9 @@ server="$1" set -o errexit set -o pipefail set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi echo "[info][installDependencies] installing $server" cd "$LGSM_PATH" gosu "$USER_NAME" cp -f "$LGSM_SCRIPTS/linuxgsm.sh" . diff --git a/setup/installGamedig.sh b/setup/installGamedig.sh index 2726a04..84f4d2b 100644 --- a/setup/installGamedig.sh +++ b/setup/installGamedig.sh @@ -2,6 +2,9 @@ set -o errexit set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi echo 'tzdata tzdata/Areas select Europe' | debconf-set-selections echo 'tzdata tzdata/Zones/Europe select Berlin' | debconf-set-selections diff --git a/setup/installLGSM.sh b/setup/installLGSM.sh index 503d27f..b75fd47 100644 --- a/setup/installLGSM.sh +++ b/setup/installLGSM.sh @@ -2,6 +2,9 @@ set -o errexit set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi echo "[info][installLGSM] installing LGSM" wget -O "$LGSM_SCRIPTS/linuxgsm.sh" "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/$LGSM_VERSION/linuxgsm.sh" diff --git a/setup/installMinimalDependencies.sh b/setup/installMinimalDependencies.sh index 7270449..41e33bf 100644 --- a/setup/installMinimalDependencies.sh +++ b/setup/installMinimalDependencies.sh @@ -2,6 +2,9 @@ set -o errexit set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi echo "[info][installMinimalDependencies] installing ..." apt-get update diff --git a/setup/setupUser.sh b/setup/setupUser.sh index c3dd11a..7b13330 100644 --- a/setup/setupUser.sh +++ b/setup/setupUser.sh @@ -2,6 +2,9 @@ set -o errexit set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi GROUP_NAME="$USER_NAME" # create it From bca276b57bbd36c6cec81e437b4f724c6f2dd9e8 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 04:17:00 +0100 Subject: [PATCH 046/116] ~ createImages rm existing images before --- tests/createImages.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/createImages.sh b/tests/createImages.sh index e4c29c0..2c1fb16 100644 --- a/tests/createImages.sh +++ b/tests/createImages.sh @@ -12,6 +12,11 @@ source "$(dirname "$0")/internal/api_various.sh" ( cd "$(dirname "$0")" + echo "[info][createImages] removing images before recreating" + for image in $(docker images -q "$IMAGE"); do + docker rmi "$image" + done + mapfile -d $'\n' -t servers < <(getServerCodeList "$VERSION") ./internal/build.sh --no-cache --image "$IMAGE" --version "$VERSION" for server_code in "${servers[@]}"; do From c604896d272399ec0dfdc4d4be81b6dd999c284e Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 04:25:37 +0100 Subject: [PATCH 047/116] ~ mv github templates --- {ISSUE_TEMPLATE => .github/ISSUE_TEMPLATE}/bug-report.md | 0 {ISSUE_TEMPLATE => .github/ISSUE_TEMPLATE}/feature-request.md | 0 pull_request_template.md => .github/pull_request_template.md | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {ISSUE_TEMPLATE => .github/ISSUE_TEMPLATE}/bug-report.md (100%) rename {ISSUE_TEMPLATE => .github/ISSUE_TEMPLATE}/feature-request.md (100%) rename pull_request_template.md => .github/pull_request_template.md (100%) diff --git a/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md similarity index 100% rename from ISSUE_TEMPLATE/bug-report.md rename to .github/ISSUE_TEMPLATE/bug-report.md diff --git a/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md similarity index 100% rename from ISSUE_TEMPLATE/feature-request.md rename to .github/ISSUE_TEMPLATE/feature-request.md diff --git a/pull_request_template.md b/.github/pull_request_template.md similarity index 100% rename from pull_request_template.md rename to .github/pull_request_template.md From 533a0fdb4c06e797a7e16e6ecef388a38b3b6ab5 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 04:50:04 +0100 Subject: [PATCH 048/116] + --slow mode for testing --- tests/features.sh | 2 +- tests/full.sh | 2 +- tests/quick.sh | 22 +++++++++++++++------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/features.sh b/tests/features.sh index dfe4ead..62b7017 100644 --- a/tests/features.sh +++ b/tests/features.sh @@ -15,7 +15,7 @@ VOLUME="linuxgsm-$GAMESERVER-testFeatures" if "$CLEAR"; then docker volume rm "$VOLUME" || true fi - ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./tests/quick.sh --slow --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" ./tests/features/testCron.sh "$VERSION" "$GAMESERVER" "$VOLUME" ./tests/features/testDockerLogs.sh "$VERSION" "$GAMESERVER" "$VOLUME" diff --git a/tests/full.sh b/tests/full.sh index 0ab3aa9..46eaa5a 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -105,7 +105,7 @@ mkdir -p "$RESULTS" if "$testThisServercode" && "$rerunIsFine"; then echo "[info][full] testing: $server_code" ( - quick=(./tests/quick.sh --logs --version "$VERSION") + quick=(./tests/quick.sh --slow --logs --version "$VERSION") if "$VOLUMES"; then quick+=(--volume "linuxgsm-$server_code") fi diff --git a/tests/quick.sh b/tests/quick.sh index ce648d6..39732ba 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -16,9 +16,10 @@ source "$(dirname "$0")/steam_test_credentials" GAMESERVER="" LOGS="false" +QUICK_MODE="true" build=(./internal/build.sh) -run=(./internal/run.sh --quick) +run=(./internal/run.sh) while [ $# -ge 1 ]; do key="$1" shift @@ -29,11 +30,12 @@ while [ $# -ge 1 ]; do echo "[help][quick] quick.sh [option] server" echo "[help][quick] " echo "[help][quick] options:" - echo "[help][quick] -c --no-cache run without docker cache" - echo "[help][quick] -d --debug run gameserver and overwrite entrypoint to bash" - echo "[help][quick] -l --logs print last log lines after run" - echo "[help][quick] --version x use linuxgsm version x e.g. \"v21.4.1\"" - echo "[help][quick] --volume x use volume x e.g. \"lgsm\"" + echo "[help][quick] -c --no-cache run without docker cache" + echo "[help][quick] -d --debug run gameserver and overwrite entrypoint to bash" + echo "[help][quick] -l --logs print last log lines after run" + echo "[help][quick] --slow don't overwrite healthcheck" + echo "[help][quick] --version x use linuxgsm version x e.g. \"v21.4.1\"" + echo "[help][quick] --volume x use volume x e.g. \"lgsm\"" echo "[help][quick] " echo "[help][quick] server e.g. gmodserver" exit 0;; @@ -43,6 +45,8 @@ while [ $# -ge 1 ]; do run+=(--debug);; -l|--logs) LOGS="true";; + --slow) + QUICK_MODE="false";; --version) build+=(--version "$1") shift;; @@ -67,6 +71,10 @@ elif [ -n "$steam_test_username" ] && [ -n "$steam_test_password" ]; then else echo "[warning][quick] no steam credentials provided, some servers will fail without it" fi +if "$QUICK_MODE"; then + run+=(--quick) +fi + CONTAINER="linuxgsm-$GAMESERVER" build+=(--latest "$GAMESERVER") run+=(--container "$CONTAINER" --detach --tag "$GAMESERVER") @@ -93,7 +101,7 @@ trap handleInterrupt SIGTERM SIGINT if "$LOGS"; then printf "[info][quick] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" elif ! "$successful"; then - printf "[info][quick] logs:\n%s\n" "$(docker logs -n 10 "$CONTAINER" 2>&1 || true)" + printf "[info][quick] logs:\n%s\n" "$(docker logs -n 20 "$CONTAINER" 2>&1 || true)" fi removeContainer "$CONTAINER" From ef5a26bf1002ef7c5e5bb69b01b3db0da6ac4bd4 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 14:17:41 +0100 Subject: [PATCH 049/116] + cleanup --- .gitignore | 3 ++- tests/internal/run.sh | 2 +- tests/quick.sh | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 95630d4..5369287 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *~ tests/results -**/*.log \ No newline at end of file +**/*.log +tests/steam_test_credentials diff --git a/tests/internal/run.sh b/tests/internal/run.sh index 382355f..b16a067 100644 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -38,7 +38,7 @@ while [ $# -ge 1 ]; do tag="$1" shift;; --quick) - run_image+=(--health-interval=10s --health-start-period=60s);; + run_image+=("--health-interval=10s" "--health-start-period=60s");; -v|--volume) run_image+=(-v "$1:/home/linuxgsm") shift;; diff --git a/tests/quick.sh b/tests/quick.sh index 39732ba..3b0f8a4 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -37,7 +37,7 @@ while [ $# -ge 1 ]; do echo "[help][quick] --version x use linuxgsm version x e.g. \"v21.4.1\"" echo "[help][quick] --volume x use volume x e.g. \"lgsm\"" echo "[help][quick] " - echo "[help][quick] server e.g. gmodserver" + echo "[help][quick] server e.g. gmodserver" exit 0;; -c|--no-cache) build+=(--no-cache);; From 52838294b8ed07417f7f9a7e1764f4ba0e6a8a75 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 16:40:57 +0100 Subject: [PATCH 050/116] + init dev env script --- init_dev_environment.sh | 15 +++++++++++++++ tests/steam_test_credentials | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 init_dev_environment.sh diff --git a/init_dev_environment.sh b/init_dev_environment.sh new file mode 100644 index 0000000..5349073 --- /dev/null +++ b/init_dev_environment.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +( + cd "$(dirname "$0")" + + # don't accidentally commit credentials + git update-index --skip-worktree tests/steam_test_credentials + + # fix permissions + find tests/ commands/ setup/ -type f -exec chmod u+x "{}" \; +) diff --git a/tests/steam_test_credentials b/tests/steam_test_credentials index 99fbdce..39dc66e 100644 --- a/tests/steam_test_credentials +++ b/tests/steam_test_credentials @@ -1,5 +1,8 @@ #!/bin/bash - +# exclude from git with: +# git update-index --skip-worktree tests/steam_test_credentials +# revert: +# git update-index --no-skip-worktree tests/steam_test_credentials #shellcheck disable=SC2034 # used elsewhere steam_test_username="" #shellcheck disable=SC2034 # used elsewhere From f18b62be8737228f888d71716c56bb6530fd9d78 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 17:42:37 +0100 Subject: [PATCH 051/116] + createImages suffix / help --- tests/createImages.sh | 73 +++++++++++++++++++++++++++++++++++++---- tests/internal/build.sh | 16 ++++++--- 2 files changed, 78 insertions(+), 11 deletions(-) diff --git a/tests/createImages.sh b/tests/createImages.sh index 2c1fb16..145c598 100644 --- a/tests/createImages.sh +++ b/tests/createImages.sh @@ -4,22 +4,83 @@ set -o errexit set -o nounset set -o pipefail -VERSION="$1" +# branch which doesn't get any suffix +MAIN_BRANCH="master" +CURRENT_BRANCH="$(git branch --show-current)" IMAGE="gameservermanagers/linuxgsm-docker" +VERSION="" +SUFFIX="" +DEFAULT_SUFFIX="" +if [ "$MAIN_BRANCH" != "$CURRENT_BRANCH" ]; then + DEFAULT_SUFFIX="${CURRENT_BRANCH//\//_}" +fi + +build_lgsm=(./internal/build.sh --latest) +build_specific=(./internal/build.sh --latest) +while [ $# -ge 1 ]; do + key="$1" + shift + + case "$key" in + -h|--help) + echo "[help][createImages] createImages.sh [option] version" + echo "[help][createImages] " + echo "[help][createImages] options:" + echo "[help][createImages] -c --no-cache disable cache using for initial lgsm creation" + echo "[help][createImages] -i --image x target image, default=$IMAGE" + echo "[help][createImages] --push every image is also pushed" + echo "[help][createImages] --suffix x suffix for docker tag, current default=\"$DEFAULT_SUFFIX\" e.g. \"develop\" will create gmodserver-v21.4.1-develop" + echo "[help][createImages] " + echo "[help][createImages] version:" + echo "[help][createImages] v21.4.1 can be tag / branch / commit" + exit 0;; + -c|--no-cache) + build_lgsm+=(--no-cache);; + -i|--image) + IMAGE="$1" + shift;; + --push) + build_lgsm+=(--push) + build_specific+=(--push);; + --suffix) + SUFFIX="$1" + shift;; + -v|--version) + VERSION="$1" + echo "[info][createImages] using lgsm version $1" + shift;; + *) + VERSION="$key" + echo "[info][createImages] using lgsm version $VERSION";; + esac +done +if [ -z "$VERSION" ]; then + echo "[error][createImages] lgsm version is required" + exit 1 +fi + +if [ -z "$SUFFIX" ]; then + SUFFIX="$DEFAULT_SUFFIX" +fi + +build_lgsm+=( --image "$IMAGE" --version "$VERSION" --suffix "$SUFFIX" ) +build_specific+=( --image "$IMAGE" --version "$VERSION" --suffix "$SUFFIX" ) # shellcheck source=tests/internal/api_various.sh source "$(dirname "$0")/internal/api_various.sh" ( cd "$(dirname "$0")" - echo "[info][createImages] removing images before recreating" - for image in $(docker images -q "$IMAGE"); do - docker rmi "$image" + echo "[info][createImages] removing images with suffix \"$SUFFIX\" before recreating" + for image in $(docker images -q "$IMAGE:*$SUFFIX"); do + docker rmi -f "$image" done mapfile -d $'\n' -t servers < <(getServerCodeList "$VERSION") - ./internal/build.sh --no-cache --image "$IMAGE" --version "$VERSION" + echo "${build_lgsm[@]}" + "${build_lgsm[@]}" for server_code in "${servers[@]}"; do - ./internal/build.sh --image "$IMAGE" --version "$VERSION" --latest "$server_code" + echo "${build_specific[@]}" "$server_code" + "${build_specific[@]}" "$server_code" done ) diff --git a/tests/internal/build.sh b/tests/internal/build.sh index 5bfdd93..63baca6 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -11,9 +11,10 @@ source "$(dirname "$0")/api_various.sh" server="" image="lgsm-test" -tag_lgsm="dev" +tag_lgsm="master" latest="false" push="false" +suffix="" build_lgsm=(docker build) build_specific=(docker build) @@ -30,6 +31,7 @@ while [ $# -ge 1 ]; do echo "[help][build] -i --image x target image, default=lgsm-test" echo "[help][build] --latest every created image is also tagged as latest" echo "[help][build] --push every image is also pushed" + echo "[help][build] --suffix x suffix for docker tag, e.g. \"develop\" will create gmodserver-v21.4.1-develop" echo "[help][build] -v --version x use provided lgsm version where x is branch / tag / commit e.g. --version v21.4.1" echo "[help][build] " echo "[help][build] server:" @@ -44,6 +46,9 @@ while [ $# -ge 1 ]; do latest="true";; --push) push="true";; + --suffix) + suffix="-$1" + shift;; -v|--version) tag_lgsm="$1" build_lgsm+=(--build-arg "ARG_LGSM_VERSION=$1") @@ -60,8 +65,9 @@ while [ $# -ge 1 ]; do fi esac done +tag_lgsm="${tag_lgsm}$suffix" build_lgsm+=(-t "$image:$tag_lgsm" --target linuxgsm .) -build_specific+=(-t "$image:${server}_$tag_lgsm" --build-arg "ARG_LGSM_GAMESERVER=$server" .) +build_specific+=(-t "$image:${server}-$tag_lgsm" --build-arg "ARG_LGSM_GAMESERVER=$server" .) cd "$(dirname "$0")/../.." @@ -85,12 +91,12 @@ if [ -n "$server" ]; then "${build_specific[@]}" if "$push"; then - docker push "$image:${server}_$tag_lgsm" + docker push "$image:${server}-$tag_lgsm" fi if "$latest"; then - docker tag "$image:${server}_$tag_lgsm" "$image:${server}" + docker tag "$image:${server}-$tag_lgsm" "$image:${server}$suffix" if "$push"; then - docker push "$image:${server}" + docker push "$image:${server}$suffix" fi fi fi From 0764a2434616d186c675a05a6964f8ce872d91b9 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 17:57:48 +0100 Subject: [PATCH 052/116] + don't invoke full.sh as root --- init_dev_environment.sh | 4 ++++ tests/full.sh | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/init_dev_environment.sh b/init_dev_environment.sh index 5349073..31715c7 100644 --- a/init_dev_environment.sh +++ b/init_dev_environment.sh @@ -7,6 +7,10 @@ set -o pipefail ( cd "$(dirname "$0")" + if which sudo > /dev/null 2>&1; then + sudo chown -R "$(whoami)" ./* + fi + # don't accidentally commit credentials git update-index --skip-worktree tests/steam_test_credentials diff --git a/tests/full.sh b/tests/full.sh index 46eaa5a..3e820b6 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -44,11 +44,17 @@ while [ $# -ge 1 ]; do if grep -qE '^-' <<< "$key"; then echo "[error][full] unknown option $key" exit 1 + else + echo "[info][full] only testing servercode \"$key\"" fi GAMESERVER+=("$key");; esac done testAllServer="$([ "${#GAMESERVER[@]}" = "0" ] && echo true || echo false )" +if [ "$(whoami)" = "root" ]; then + echo "[error][full] please dont execute me as root, iam invoking linuxgsm.sh directly and this will not work as root" + exit 1 +fi # shellcheck source=tests/internal/api_various.sh source "$(dirname "$0")/internal/api_various.sh" From 2301369c953262d162f15e8631ad82ac03dcc74f Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 18:42:12 +0100 Subject: [PATCH 053/116] + full.sh printing failed statistics --- tests/full.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/full.sh b/tests/full.sh index 3e820b6..82ce03c 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -142,4 +142,13 @@ mkdir -p "$RESULTS" echo "[info][full] successful: $(find "$RESULTS/" -iname "successful.*" | wc -l)" echo "[info][full] failed: $(find "$RESULTS/" -iname "failed.*" | wc -l)" + + mapfile -t failed_credentials_missing < <(grep --include "*failed*" -rlF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) + echo "[info][full] failed - unset steam credentials: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_credentials_missing[@]}" || true)" + # print filenames + very high line number to jump right at eof + printf '%s\n' "${failed_credentials_missing[@]/%/:100000}" + + mapfile -t failed_other < <(grep --include "*failed*" -rLF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) + echo "[info][full] failed - other error: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_other[@]}")" + printf '%s\n' "${failed_other[@]/%/:100000}" ) From 9efe374fcf213ff60d31bb710295fcbb00a2ac28 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 19:24:48 +0100 Subject: [PATCH 054/116] fix quick as default will to early fail --- tests/features.sh | 2 +- tests/features/testDockerLogs.sh | 2 +- tests/features/testFixPermissions.sh | 2 +- tests/features/testLgsmUpdate.sh | 6 +++--- tests/features/testUpdateUidGuid.sh | 4 ++-- tests/full.sh | 2 +- tests/quick.sh | 10 +++------- 7 files changed, 12 insertions(+), 16 deletions(-) diff --git a/tests/features.sh b/tests/features.sh index 62b7017..dfe4ead 100644 --- a/tests/features.sh +++ b/tests/features.sh @@ -15,7 +15,7 @@ VOLUME="linuxgsm-$GAMESERVER-testFeatures" if "$CLEAR"; then docker volume rm "$VOLUME" || true fi - ./tests/quick.sh --slow --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" ./tests/features/testCron.sh "$VERSION" "$GAMESERVER" "$VOLUME" ./tests/features/testDockerLogs.sh "$VERSION" "$GAMESERVER" "$VOLUME" diff --git a/tests/features/testDockerLogs.sh b/tests/features/testDockerLogs.sh index 4a86e85..36d118e 100644 --- a/tests/features/testDockerLogs.sh +++ b/tests/features/testDockerLogs.sh @@ -12,7 +12,7 @@ VOLUME="$3" log="$(realpath "$(dirname "$0")")/testDockerLogs.log" cd "$(dirname "$0")/../.." - ./tests/quick.sh --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" + ./tests/quick.sh --very-fast --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" if grep -qE 'VAC\s*secure\s*mode\s*is\s*activated.' "$log"; then rm "$log" echo "[info][testDockerLogs] successful" diff --git a/tests/features/testFixPermissions.sh b/tests/features/testFixPermissions.sh index 48fe129..2cdeb77 100644 --- a/tests/features/testFixPermissions.sh +++ b/tests/features/testFixPermissions.sh @@ -38,7 +38,7 @@ source "$(dirname "$0")/../internal/api_various.sh" fi } - if ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER"; then + if ./tests/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER"; then permission="$("${dockerRun[@]}" alpine ls -l "$newFile")" owner="$("${dockerRun[@]}" alpine ls -l "$newFile")" if ! grep -qE '^.rw.r..---' <<< "$permission"; then diff --git a/tests/features/testLgsmUpdate.sh b/tests/features/testLgsmUpdate.sh index 6b1cd0f..79881ed 100644 --- a/tests/features/testLgsmUpdate.sh +++ b/tests/features/testLgsmUpdate.sh @@ -11,7 +11,7 @@ VOLUME="$3" ( cd "$(dirname "$0")/../.." - ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./tests/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" log_downgrade="downgrade.log" log_update="upgrade.log" @@ -29,11 +29,11 @@ VOLUME="$3" } # old versions are allowed to fail, as long as log contains the expected entry - ./tests/quick.sh --logs --version "$OLD_VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_downgrade" || true + ./tests/quick.sh --very-fast --logs --version "$OLD_VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_downgrade" || true if ! grep -qF '[lgsm-init] force uninstall lgsm' "$log_downgrade"; then log "downgrading from \"$VERSION\" to \"$OLD_VERSION\" successful but container didn't forcefully uninstalled lgsm" 21 - elif ! ./tests/quick.sh --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_update"; then + elif ! ./tests/quick.sh --very-fast --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_update"; then log "upgrading from \"$OLD_VERSION\" to \"$VERSION\" failed" 22 elif ! grep -qF '[lgsm-init] force uninstall lgsm' "$log_update"; then diff --git a/tests/features/testUpdateUidGuid.sh b/tests/features/testUpdateUidGuid.sh index d3b4fda..3c0e213 100644 --- a/tests/features/testUpdateUidGuid.sh +++ b/tests/features/testUpdateUidGuid.sh @@ -12,7 +12,7 @@ gid="750" ( cd "$(dirname "$0")/../.." - ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./tests/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" function log() { if [ -n "${2:-}" ]; then @@ -35,7 +35,7 @@ gid="750" log "precondition successful" fi - ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" -e "USER_ID=1234" -e "GROUP_ID=5678" + ./tests/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" -e "USER_ID=1234" -e "GROUP_ID=5678" if [ "0" != "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | wc -l )" ]; then log "update failed, there are files in \"$VOLUME\" which aren't owned by user \"1234\"" 22 "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | tail)" diff --git a/tests/full.sh b/tests/full.sh index 82ce03c..e3c63b8 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -111,7 +111,7 @@ mkdir -p "$RESULTS" if "$testThisServercode" && "$rerunIsFine"; then echo "[info][full] testing: $server_code" ( - quick=(./tests/quick.sh --slow --logs --version "$VERSION") + quick=(./tests/quick.sh --logs --version "$VERSION") if "$VOLUMES"; then quick+=(--volume "linuxgsm-$server_code") fi diff --git a/tests/quick.sh b/tests/quick.sh index 3b0f8a4..4eae617 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -16,7 +16,6 @@ source "$(dirname "$0")/steam_test_credentials" GAMESERVER="" LOGS="false" -QUICK_MODE="true" build=(./internal/build.sh) run=(./internal/run.sh) @@ -33,7 +32,7 @@ while [ $# -ge 1 ]; do echo "[help][quick] -c --no-cache run without docker cache" echo "[help][quick] -d --debug run gameserver and overwrite entrypoint to bash" echo "[help][quick] -l --logs print last log lines after run" - echo "[help][quick] --slow don't overwrite healthcheck" + echo "[help][quick] --very-fast overwrite healthcheck, only use it with volumes / lancache because container will else fail pretty fast" echo "[help][quick] --version x use linuxgsm version x e.g. \"v21.4.1\"" echo "[help][quick] --volume x use volume x e.g. \"lgsm\"" echo "[help][quick] " @@ -45,8 +44,8 @@ while [ $# -ge 1 ]; do run+=(--debug);; -l|--logs) LOGS="true";; - --slow) - QUICK_MODE="false";; + --quicker) + run+=(--quick);; --version) build+=(--version "$1") shift;; @@ -71,9 +70,6 @@ elif [ -n "$steam_test_username" ] && [ -n "$steam_test_password" ]; then else echo "[warning][quick] no steam credentials provided, some servers will fail without it" fi -if "$QUICK_MODE"; then - run+=(--quick) -fi CONTAINER="linuxgsm-$GAMESERVER" build+=(--latest "$GAMESERVER") From 95f8871a04dfb7ecb17e09267a1c7f0bb5f3e875 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 19:33:22 +0100 Subject: [PATCH 055/116] fix remove anon volumes after --- tests/internal/api_docker.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/internal/api_docker.sh b/tests/internal/api_docker.sh index eab79e7..f3b83bf 100644 --- a/tests/internal/api_docker.sh +++ b/tests/internal/api_docker.sh @@ -26,7 +26,8 @@ function stopContainer() { function removeContainer() { stopContainer "$1" - docker rm "$1" > /dev/null 2>&1 || true + # remove anonymous volumes as well + docker rm --volumes "$1" > /dev/null 2>&1 || true } function awaitHealthCheck() { From 55742b3362898918481da26eff9bdff2f78cd016 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 20:07:30 +0100 Subject: [PATCH 056/116] fix --very-fast --- tests/quick.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/quick.sh b/tests/quick.sh index 4eae617..04b1409 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -44,7 +44,7 @@ while [ $# -ge 1 ]; do run+=(--debug);; -l|--logs) LOGS="true";; - --quicker) + --very-fast) run+=(--quick);; --version) build+=(--version "$1") From 89542376514173651e3282a5ef9c327d5f1463b9 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 29 Nov 2021 20:59:42 +0100 Subject: [PATCH 057/116] + tests print health log --- init_dev_environment.sh | 9 +++++++++ tests/quick.sh | 2 ++ 2 files changed, 11 insertions(+) diff --git a/init_dev_environment.sh b/init_dev_environment.sh index 31715c7..b53002f 100644 --- a/init_dev_environment.sh +++ b/init_dev_environment.sh @@ -4,6 +4,8 @@ set -o errexit set -o nounset set -o pipefail +tools=(jq) + ( cd "$(dirname "$0")" @@ -11,6 +13,13 @@ set -o pipefail sudo chown -R "$(whoami)" ./* fi + # check tools jq + for tool in "${tools[@]}"; do + if ! which "$tool" > /dev/null 2>&1; then + echo "[warning][init_dev_environment] please install \"$tool\"" + fi + done + # don't accidentally commit credentials git update-index --skip-worktree tests/steam_test_credentials diff --git a/tests/quick.sh b/tests/quick.sh index 04b1409..dc2be1a 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -96,8 +96,10 @@ trap handleInterrupt SIGTERM SIGINT stopContainer "$CONTAINER" if "$LOGS"; then printf "[info][quick] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" + printf "[info][quick] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq || true)" elif ! "$successful"; then printf "[info][quick] logs:\n%s\n" "$(docker logs -n 20 "$CONTAINER" 2>&1 || true)" + printf "[info][quick] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq || true)" fi removeContainer "$CONTAINER" From 326e4a6b26bc257c208a81dc5aae7878bb31fb24 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 1 Dec 2021 00:56:37 +0100 Subject: [PATCH 058/116] + uniform docker layer -> test -> push --- tests/createImages.sh | 86 ---------------------------------------- tests/features.sh | 3 ++ tests/full.sh | 35 +++++++++++----- tests/internal/build.sh | 88 +++++++++++++++++++++++++---------------- tests/internal/run.sh | 23 +++++------ tests/push.sh | 46 +++++++++++++++++++++ tests/quick.sh | 75 ++++++++++++++++++++++------------- tests/shellcheck.sh | 8 +++- 8 files changed, 194 insertions(+), 170 deletions(-) delete mode 100644 tests/createImages.sh create mode 100644 tests/push.sh diff --git a/tests/createImages.sh b/tests/createImages.sh deleted file mode 100644 index 145c598..0000000 --- a/tests/createImages.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset -set -o pipefail - -# branch which doesn't get any suffix -MAIN_BRANCH="master" -CURRENT_BRANCH="$(git branch --show-current)" -IMAGE="gameservermanagers/linuxgsm-docker" -VERSION="" -SUFFIX="" -DEFAULT_SUFFIX="" -if [ "$MAIN_BRANCH" != "$CURRENT_BRANCH" ]; then - DEFAULT_SUFFIX="${CURRENT_BRANCH//\//_}" -fi - -build_lgsm=(./internal/build.sh --latest) -build_specific=(./internal/build.sh --latest) -while [ $# -ge 1 ]; do - key="$1" - shift - - case "$key" in - -h|--help) - echo "[help][createImages] createImages.sh [option] version" - echo "[help][createImages] " - echo "[help][createImages] options:" - echo "[help][createImages] -c --no-cache disable cache using for initial lgsm creation" - echo "[help][createImages] -i --image x target image, default=$IMAGE" - echo "[help][createImages] --push every image is also pushed" - echo "[help][createImages] --suffix x suffix for docker tag, current default=\"$DEFAULT_SUFFIX\" e.g. \"develop\" will create gmodserver-v21.4.1-develop" - echo "[help][createImages] " - echo "[help][createImages] version:" - echo "[help][createImages] v21.4.1 can be tag / branch / commit" - exit 0;; - -c|--no-cache) - build_lgsm+=(--no-cache);; - -i|--image) - IMAGE="$1" - shift;; - --push) - build_lgsm+=(--push) - build_specific+=(--push);; - --suffix) - SUFFIX="$1" - shift;; - -v|--version) - VERSION="$1" - echo "[info][createImages] using lgsm version $1" - shift;; - *) - VERSION="$key" - echo "[info][createImages] using lgsm version $VERSION";; - esac -done -if [ -z "$VERSION" ]; then - echo "[error][createImages] lgsm version is required" - exit 1 -fi - -if [ -z "$SUFFIX" ]; then - SUFFIX="$DEFAULT_SUFFIX" -fi - -build_lgsm+=( --image "$IMAGE" --version "$VERSION" --suffix "$SUFFIX" ) -build_specific+=( --image "$IMAGE" --version "$VERSION" --suffix "$SUFFIX" ) - -# shellcheck source=tests/internal/api_various.sh -source "$(dirname "$0")/internal/api_various.sh" - -( - cd "$(dirname "$0")" - echo "[info][createImages] removing images with suffix \"$SUFFIX\" before recreating" - for image in $(docker images -q "$IMAGE:*$SUFFIX"); do - docker rmi -f "$image" - done - - mapfile -d $'\n' -t servers < <(getServerCodeList "$VERSION") - echo "${build_lgsm[@]}" - "${build_lgsm[@]}" - for server_code in "${servers[@]}"; do - echo "${build_specific[@]}" "$server_code" - "${build_specific[@]}" "$server_code" - done -) diff --git a/tests/features.sh b/tests/features.sh index dfe4ead..008c8b4 100644 --- a/tests/features.sh +++ b/tests/features.sh @@ -5,6 +5,9 @@ set -o nounset set -o pipefail VERSION="$1" +if [ "${1}" = "--version" ] || [ "${1}" = "-v" ]; then + VERSION="$2" +fi CLEAR="$( grep -qE '(-c|--clear)' <<< "$@" && echo true || echo false )" GAMESERVER="gmodserver" VOLUME="linuxgsm-$GAMESERVER-testFeatures" diff --git a/tests/full.sh b/tests/full.sh index e3c63b8..38565fe 100644 --- a/tests/full.sh +++ b/tests/full.sh @@ -4,13 +4,15 @@ set -o errexit set -o pipefail set -o nounset -VERSION="master" -GAMESERVER=() -PARRALEL="" -PARRALEL="$(lscpu -p | grep -Ev '^#' | sort -u -t, -k 2,4 | wc -l)" ROOT_FOLDER="$(realpath "$(dirname "$0")/..")" + +PARRALEL="$(lscpu -p | grep -Ev '^#' | sort -u -t, -k 2,4 | wc -l)" +IMAGE="gameservermanagers/linuxgsm-docker" RERUN="false" +SUFFIX="" VOLUMES="false" +VERSION="master" +GAMESERVER=() while [ $# -ge 1 ]; do key="$1" shift @@ -22,10 +24,13 @@ while [ $# -ge 1 ]; do echo "[help][full] " echo "[help][full] options:" echo "[help][full] -c --cpus x run x servers in parralel, default x = physical cores" + echo "[help][full] --image x set target image" echo "[help][full] --rerun check results and runs every gameserver which wasn't successful" + echo "[help][full] --suffix suffix to add to every image" echo "[help][full] --volumes use volumes \"linuxgsm-SERVERCODE\"" echo "[help][full] -v --version x use linuxgsm version x e.g. \"v21.4.1\"" echo "[help][full] " + echo "[help][full] " echo "[help][full] server:" echo "[help][full] *empty* test every server" echo "[help][full] gmodserver ... run only given servers" @@ -33,8 +38,14 @@ while [ $# -ge 1 ]; do -c|--cpus) PARRALEL="$1" shift;; + --image) + IMAGE="$1" + shift;; --rerun) RERUN="true";; + --suffix) + SUFFIX="$1" + shift;; --volumes) VOLUMES="true";; -v|--version) @@ -76,8 +87,12 @@ fi mkdir -p "$RESULTS" ( - echo "[info][full] building linuxgsm base once" - ./tests/internal/build.sh --version "$VERSION" + if "$RERUN"; then + echo "[info][full] building linuxgsm base once" + ./tests/internal/build.sh --version "$VERSION" --image "$IMAGE" --latest --suffix "$SUFFIX" + else + echo "[info][full] skipping building linuxgsm because rerun" + fi subprocesses=() function handleInterrupt() { @@ -111,7 +126,7 @@ mkdir -p "$RESULTS" if "$testThisServercode" && "$rerunIsFine"; then echo "[info][full] testing: $server_code" ( - quick=(./tests/quick.sh --logs --version "$VERSION") + quick=(./tests/quick.sh --logs --version "$VERSION" --image "$IMAGE" --skip-lgsm --suffix "$SUFFIX") if "$VOLUMES"; then quick+=(--volume "linuxgsm-$server_code") fi @@ -144,11 +159,11 @@ mkdir -p "$RESULTS" echo "[info][full] failed: $(find "$RESULTS/" -iname "failed.*" | wc -l)" mapfile -t failed_credentials_missing < <(grep --include "*failed*" -rlF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) - echo "[info][full] failed - unset steam credentials: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_credentials_missing[@]}" || true)" - # print filenames + very high line number to jump right at eof + echo "[info][full] failed - unset steam credentials: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_credentials_missing[@]}" | tr '\n' ' ' || true)" + # print filenames + very high line number to jump right at eof on click if IDE supports it printf '%s\n' "${failed_credentials_missing[@]/%/:100000}" mapfile -t failed_other < <(grep --include "*failed*" -rLF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) - echo "[info][full] failed - other error: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_other[@]}")" + echo "[info][full] failed - other error: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_other[@]}" | tr '\n' ' ' || true)" printf '%s\n' "${failed_other[@]/%/:100000}" ) diff --git a/tests/internal/build.sh b/tests/internal/build.sh index 63baca6..4d50b46 100644 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -10,11 +10,12 @@ source "$(dirname "$0")/api_docker.sh" source "$(dirname "$0")/api_various.sh" server="" -image="lgsm-test" -tag_lgsm="master" +image="gameservermanagers/linuxgsm-docker" latest="false" -push="false" +skip_lgsm="false" suffix="" +lgsm_version="master" +lgsm_tags_latest=() build_lgsm=(docker build) build_specific=(docker build) @@ -27,12 +28,12 @@ while [ $# -ge 1 ]; do echo "[help][build] build.sh [option] [server]" echo "[help][build] " echo "[help][build] options:" - echo "[help][build] -c --no-cache disable cache using" - echo "[help][build] -i --image x target image, default=lgsm-test" - echo "[help][build] --latest every created image is also tagged as latest" - echo "[help][build] --push every image is also pushed" - echo "[help][build] --suffix x suffix for docker tag, e.g. \"develop\" will create gmodserver-v21.4.1-develop" - echo "[help][build] -v --version x use provided lgsm version where x is branch / tag / commit e.g. --version v21.4.1" + echo "[help][build] -c --no-cache disable cache using" + echo "[help][build] -i --image x target image, default=$image" + echo "[help][build] --latest tag created image also as latest and according to provided version e.g. lgsm:latest :v21.4.1 :v21.4 :v21" + echo "[help][build] --skip-lgsm dont rebuild lgsm" + echo "[help][build] --suffix x suffix for docker tag, e.g. \"develop\" will create gmodserver-v21.4.1-develop" + echo "[help][build] -v --version x use provided lgsm version where x is branch / tag / commit e.g. --version v21.4.1" echo "[help][build] " echo "[help][build] server:" echo "[help][build] gmodserver build linuxgsm image and specific gmodserver" @@ -44,16 +45,25 @@ while [ $# -ge 1 ]; do shift;; --latest) latest="true";; - --push) - push="true";; + --skip-lgsm) + skip_lgsm="true";; --suffix) suffix="-$1" shift;; -v|--version) - tag_lgsm="$1" - build_lgsm+=(--build-arg "ARG_LGSM_VERSION=$1") - build_specific+=(--build-arg "ARG_LGSM_VERSION=$1") - echo "[info][build] using lgsm version $1" + lgsm_version="$1" + if grep -q '^v[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' <<< "$lgsm_version"; then + major="${lgsm_version%%.*}" + minor="${lgsm_version#*.}" + minor="${minor%%.*}" + #patch="${lgsm_version##*.}" + # "$major.$minor.$patch" not added because equal to version + lgsm_tags_latest+=("$major.$minor" "$major") + fi + + build_lgsm+=(--build-arg "ARG_LGSM_VERSION=$lgsm_version") + build_specific+=(--build-arg "ARG_LGSM_VERSION=$lgsm_version") + echo "[info][build] using lgsm version $lgsm_version" shift;; *) if [ -z "$server" ]; then @@ -65,23 +75,32 @@ while [ $# -ge 1 ]; do fi esac done -tag_lgsm="${tag_lgsm}$suffix" -build_lgsm+=(-t "$image:$tag_lgsm" --target linuxgsm .) -build_specific+=(-t "$image:${server}-$tag_lgsm" --build-arg "ARG_LGSM_GAMESERVER=$server" .) + +lgsm_main_tag="$lgsm_version$suffix" +specific_main_tag="$lgsm_version-${server}$suffix" +# BUILDKIT_INLINE_CACHE needed for --cache-from +build_lgsm+=(-t "$image:$lgsm_main_tag" --target linuxgsm --build-arg BUILDKIT_INLINE_CACHE=1 .) +build_specific+=(-t "$image:$specific_main_tag" --target specific --cache-from "$image:$lgsm_main_tag" --build-arg "ARG_LGSM_GAMESERVER=$server" .) cd "$(dirname "$0")/../.." # build lgsm image -echo "${build_lgsm[@]}" -"${build_lgsm[@]}" +if ! "$skip_lgsm"; then + echo "${build_lgsm[@]}" + "${build_lgsm[@]}" + echo "[info][build] created tag: $image:$lgsm_main_tag" # used in results as info for push.sh -if "$push"; then - docker push "$image:$tag_lgsm" -fi -if "$latest"; then - docker tag "$image:$tag_lgsm" "$image:latest" - if "$push"; then - docker push "$image:latest" + if "$latest"; then + latest_tag="latest" + if [ -n "$suffix" ]; then + latest_tag="${suffix:1}" + fi + docker tag "$image:$lgsm_main_tag" "$image:$latest_tag" + echo "[info][build] created tag: $image:${server}$suffix" + for tag in "${lgsm_tags_latest[@]}"; do + docker tag "$image:$lgsm_main_tag" "$image:$tag$suffix" + echo "[info][build] created tag: $image:$tag$suffix" + done fi fi @@ -89,14 +108,13 @@ fi if [ -n "$server" ]; then echo "${build_specific[@]}" "${build_specific[@]}" - - if "$push"; then - docker push "$image:${server}-$tag_lgsm" - fi + echo "[info][build] created tag: $image:$specific_main_tag" if "$latest"; then - docker tag "$image:${server}-$tag_lgsm" "$image:${server}$suffix" - if "$push"; then - docker push "$image:${server}$suffix" - fi + docker tag "$image:$specific_main_tag" "$image:${server}$suffix" + echo "[info][build] created tag: $image:${server}$suffix" + for tag in "${lgsm_tags_latest[@]}"; do + docker tag "$image:$specific_main_tag" "$image:$tag-${server}$suffix" + echo "[info][build] created tag: $image:$tag-${server}$suffix" + done fi fi diff --git a/tests/internal/run.sh b/tests/internal/run.sh index b16a067..58138af 100644 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -1,7 +1,8 @@ #!/bin/bash -tag="" +TAG="" +SUFFIX="" docker_run_mode="-it" -IMAGE="lgsm-test" +IMAGE="gameservermanagers/linuxgsm-docker" container="lgsm-test" run_image=(docker run) @@ -18,7 +19,8 @@ while [ $# -ge 1 ]; do echo "[help][run] -d --debug set entrypoint to bash" echo "[help][run] --detach run in background instead of foreground" echo "[help][run] -i --image x target image, default=lgsm-test" - echo "[help][run] --tag x \"lgsm\" run lgsm image or \"specific\" run last created $IMAGE:$tag" + echo "[help][run] --suffix add to tag provided suffix" + echo "[help][run] --tag x target tag" echo "[help][run] --quick enforce quick monitoring" echo "[help][run] -v --volume x use volume x" echo "[help][run] " @@ -33,9 +35,13 @@ while [ $# -ge 1 ]; do --detach) docker_run_mode="-dt";; -i|--image) - IMAGE="$key";; + IMAGE="$1" + shift;; + --suffix) + SUFFIX="-$1" + shift;; -t|--tag) - tag="$1" + TAG="$1" shift;; --quick) run_image+=("--health-interval=10s" "--health-start-period=60s");; @@ -50,12 +56,7 @@ while [ $# -ge 1 ]; do ;; esac done -run_image+=("$docker_run_mode" --name "$container" "$IMAGE:$tag") - -if [ -z "$tag" ]; then - echo "please provide the tag to execute as first argument lgsm or specific" - exit 1 -fi +run_image+=("$docker_run_mode" --name "$container" "$IMAGE:$TAG$SUFFIX") echo "${run_image[@]}" "${run_image[@]}" diff --git a/tests/push.sh b/tests/push.sh new file mode 100644 index 0000000..12f9392 --- /dev/null +++ b/tests/push.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -o errexit +set -o pipefail +set -o nounset + +ONLY_SUCCESFUL="true" +while [ $# -ge 1 ]; do + key="$1" + shift + + case "$key" in + -h|--help) + echo "[help][push] pushing successful images from previous full run" + echo "[help][push] push.sh [option]" + echo "[help][push] " + echo "[help][push] options:" + echo "[help][push] -a --all push also images which aren't succesful " + exit 0;; + -a|--all) + ONLY_SUCCESFUL="false";; + *) + echo "[error][push] unknown argument \"$key\"";; + esac +done + +( + cd "$(dirname "$0")" + mapfile -t results < <(find "results" -type f) + echo "[info][push] found ${#results[@]} from full.sh" + push=() + for result in "${results[@]}"; do + if ! "$ONLY_SUCCESFUL" || grep -q 'successful' <<< "$result"; then + mapfile -t images < <(grep -oP -e "(?<=\[info\]\[build\] created tag: ).+" "$result") + for image in "${images[@]}"; do + push+=("$image") + echo "[info][push] $image" + done + fi + done + + sleep 10s + for image in "${push[@]}"; do + docker push "$image" + done +) diff --git a/tests/quick.sh b/tests/quick.sh index dc2be1a..9f859af 100644 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -14,8 +14,11 @@ source "$(dirname "$0")/internal/api_various.sh" source "$(dirname "$0")/steam_test_credentials" -GAMESERVER="" + LOGS="false" +IMAGE="gameservermanagers/linuxgsm-docker" +RETRY="1" +GAMESERVER="" build=(./internal/build.sh) run=(./internal/run.sh) @@ -29,12 +32,15 @@ while [ $# -ge 1 ]; do echo "[help][quick] quick.sh [option] server" echo "[help][quick] " echo "[help][quick] options:" - echo "[help][quick] -c --no-cache run without docker cache" - echo "[help][quick] -d --debug run gameserver and overwrite entrypoint to bash" - echo "[help][quick] -l --logs print last log lines after run" - echo "[help][quick] --very-fast overwrite healthcheck, only use it with volumes / lancache because container will else fail pretty fast" - echo "[help][quick] --version x use linuxgsm version x e.g. \"v21.4.1\"" - echo "[help][quick] --volume x use volume x e.g. \"lgsm\"" + echo "[help][quick] -c --no-cache run without docker cache" + echo "[help][quick] -d --debug run gameserver and overwrite entrypoint to bash" + echo "[help][quick] --image x target image" + echo "[help][quick] -l --logs print last log lines after run" + echo "[help][quick] --retry if run failed, rebuild and rerun up to 3 times" + echo "[help][quick] --skip-lgsm skip build lgsm" + echo "[help][quick] --very-fast overwrite healthcheck, only use it with volumes / lancache because container will else fail pretty fast" + echo "[help][quick] --version x use linuxgsm version x e.g. \"v21.4.1\"" + echo "[help][quick] --volume x use volume x e.g. \"lgsm\"" echo "[help][quick] " echo "[help][quick] server e.g. gmodserver" exit 0;; @@ -42,8 +48,19 @@ while [ $# -ge 1 ]; do build+=(--no-cache);; -d|--debug) run+=(--debug);; + --image) + IMAGE="$1" + shift;; -l|--logs) LOGS="true";; + --retry) + RETRY="3";; + --skip-lgsm) + build+=(--skip-lgsm);; + --suffix) + build+=(--suffix "$1") + run+=(--suffix "$1" ) + shift;; --very-fast) run+=(--quick);; --version) @@ -72,8 +89,8 @@ else fi CONTAINER="linuxgsm-$GAMESERVER" -build+=(--latest "$GAMESERVER") -run+=(--container "$CONTAINER" --detach --tag "$GAMESERVER") +build+=(--image "$IMAGE" --latest "$GAMESERVER") +run+=(--image "$IMAGE" --tag "$GAMESERVER" --container "$CONTAINER" --detach) function handleInterrupt() { removeContainer "$CONTAINER" @@ -82,25 +99,29 @@ trap handleInterrupt SIGTERM SIGINT ( cd "$(dirname "$0")" - removeContainer "$CONTAINER" - - echo "${build[@]}" - "${build[@]}" - echo "${run[@]}" - "${run[@]}" - successful="false" - if awaitHealthCheck "$CONTAINER"; then - successful="true" - fi - stopContainer "$CONTAINER" - if "$LOGS"; then - printf "[info][quick] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" - printf "[info][quick] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq || true)" - elif ! "$successful"; then - printf "[info][quick] logs:\n%s\n" "$(docker logs -n 20 "$CONTAINER" 2>&1 || true)" - printf "[info][quick] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq || true)" - fi + try="1" + while [ "$try" -le "$RETRY" ] && ! "$successful"; do + echo "[info][quick] try $try" + try="$(( try+1 ))" + removeContainer "$CONTAINER" + echo "${build[@]}" + "${build[@]}" + echo "${run[@]}" + "${run[@]}" + + if awaitHealthCheck "$CONTAINER"; then + successful="true" + fi + stopContainer "$CONTAINER" + if "$LOGS"; then + printf "[info][quick] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" + printf "[info][quick] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq || true)" + elif ! "$successful"; then + printf "[info][quick] logs:\n%s\n" "$(docker logs -n 20 "$CONTAINER" 2>&1 || true)" + printf "[info][quick] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq || true)" + fi + done removeContainer "$CONTAINER" if "$successful"; then diff --git a/tests/shellcheck.sh b/tests/shellcheck.sh index fcb48d5..cbab9a0 100644 --- a/tests/shellcheck.sh +++ b/tests/shellcheck.sh @@ -9,5 +9,11 @@ set -o nounset files=() mapfile -d $'\0' files < <( find commands setup tests -type f ! -iname "*.log" ! -iname "*.yml" -print0 ) - shellcheck "${files[@]}" + echo "[info][shellcheck] testing on ${#files[@]} files" + + if shellcheck "${files[@]}"; then + echo "[info][shellcheck] successful" + else + echo "[info][shellcheck] failed" + fi ) From 3fbf4268c0818ac118a9fc559b34c6abe96c1b28 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 1 Dec 2021 02:01:57 +0100 Subject: [PATCH 059/116] + chmod +x for files --- commands/lgsm-cron-init | 0 commands/lgsm-cron-start | 0 commands/lgsm-fix-permission | 0 commands/lgsm-init | 0 commands/lgsm-load-config | 0 commands/lgsm-tmux-attach | 0 commands/lgsm-update-uid-gid | 0 setup/cleanImage.sh | 0 setup/createAlias.sh | 0 setup/entrypoint.sh | 0 setup/installDependencies.sh | 0 setup/installGamedig.sh | 0 setup/installGosu.sh | 0 setup/installLGSM.sh | 0 setup/installMinimalDependencies.sh | 0 setup/installSupercronic.sh | 0 setup/setupUser.sh | 0 tests/features.sh | 0 tests/features/testCron.sh | 0 tests/features/testDockerLogs.sh | 0 tests/features/testFixPermissions.sh | 0 tests/features/testLgsmUpdate.sh | 0 tests/features/testLoadConfig.sh | 0 tests/features/testUpdateUidGuid.sh | 0 tests/full.sh | 0 tests/internal/api_docker.sh | 0 tests/internal/api_various.sh | 0 tests/internal/build.sh | 0 tests/internal/run.sh | 0 tests/push.sh | 0 tests/quick.sh | 0 tests/shellcheck.sh | 0 32 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 commands/lgsm-cron-init mode change 100644 => 100755 commands/lgsm-cron-start mode change 100644 => 100755 commands/lgsm-fix-permission mode change 100644 => 100755 commands/lgsm-init mode change 100644 => 100755 commands/lgsm-load-config mode change 100644 => 100755 commands/lgsm-tmux-attach mode change 100644 => 100755 commands/lgsm-update-uid-gid mode change 100644 => 100755 setup/cleanImage.sh mode change 100644 => 100755 setup/createAlias.sh mode change 100644 => 100755 setup/entrypoint.sh mode change 100644 => 100755 setup/installDependencies.sh mode change 100644 => 100755 setup/installGamedig.sh mode change 100644 => 100755 setup/installGosu.sh mode change 100644 => 100755 setup/installLGSM.sh mode change 100644 => 100755 setup/installMinimalDependencies.sh mode change 100644 => 100755 setup/installSupercronic.sh mode change 100644 => 100755 setup/setupUser.sh mode change 100644 => 100755 tests/features.sh mode change 100644 => 100755 tests/features/testCron.sh mode change 100644 => 100755 tests/features/testDockerLogs.sh mode change 100644 => 100755 tests/features/testFixPermissions.sh mode change 100644 => 100755 tests/features/testLgsmUpdate.sh mode change 100644 => 100755 tests/features/testLoadConfig.sh mode change 100644 => 100755 tests/features/testUpdateUidGuid.sh mode change 100644 => 100755 tests/full.sh mode change 100644 => 100755 tests/internal/api_docker.sh mode change 100644 => 100755 tests/internal/api_various.sh mode change 100644 => 100755 tests/internal/build.sh mode change 100644 => 100755 tests/internal/run.sh mode change 100644 => 100755 tests/push.sh mode change 100644 => 100755 tests/quick.sh mode change 100644 => 100755 tests/shellcheck.sh diff --git a/commands/lgsm-cron-init b/commands/lgsm-cron-init old mode 100644 new mode 100755 diff --git a/commands/lgsm-cron-start b/commands/lgsm-cron-start old mode 100644 new mode 100755 diff --git a/commands/lgsm-fix-permission b/commands/lgsm-fix-permission old mode 100644 new mode 100755 diff --git a/commands/lgsm-init b/commands/lgsm-init old mode 100644 new mode 100755 diff --git a/commands/lgsm-load-config b/commands/lgsm-load-config old mode 100644 new mode 100755 diff --git a/commands/lgsm-tmux-attach b/commands/lgsm-tmux-attach old mode 100644 new mode 100755 diff --git a/commands/lgsm-update-uid-gid b/commands/lgsm-update-uid-gid old mode 100644 new mode 100755 diff --git a/setup/cleanImage.sh b/setup/cleanImage.sh old mode 100644 new mode 100755 diff --git a/setup/createAlias.sh b/setup/createAlias.sh old mode 100644 new mode 100755 diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh old mode 100644 new mode 100755 diff --git a/setup/installDependencies.sh b/setup/installDependencies.sh old mode 100644 new mode 100755 diff --git a/setup/installGamedig.sh b/setup/installGamedig.sh old mode 100644 new mode 100755 diff --git a/setup/installGosu.sh b/setup/installGosu.sh old mode 100644 new mode 100755 diff --git a/setup/installLGSM.sh b/setup/installLGSM.sh old mode 100644 new mode 100755 diff --git a/setup/installMinimalDependencies.sh b/setup/installMinimalDependencies.sh old mode 100644 new mode 100755 diff --git a/setup/installSupercronic.sh b/setup/installSupercronic.sh old mode 100644 new mode 100755 diff --git a/setup/setupUser.sh b/setup/setupUser.sh old mode 100644 new mode 100755 diff --git a/tests/features.sh b/tests/features.sh old mode 100644 new mode 100755 diff --git a/tests/features/testCron.sh b/tests/features/testCron.sh old mode 100644 new mode 100755 diff --git a/tests/features/testDockerLogs.sh b/tests/features/testDockerLogs.sh old mode 100644 new mode 100755 diff --git a/tests/features/testFixPermissions.sh b/tests/features/testFixPermissions.sh old mode 100644 new mode 100755 diff --git a/tests/features/testLgsmUpdate.sh b/tests/features/testLgsmUpdate.sh old mode 100644 new mode 100755 diff --git a/tests/features/testLoadConfig.sh b/tests/features/testLoadConfig.sh old mode 100644 new mode 100755 diff --git a/tests/features/testUpdateUidGuid.sh b/tests/features/testUpdateUidGuid.sh old mode 100644 new mode 100755 diff --git a/tests/full.sh b/tests/full.sh old mode 100644 new mode 100755 diff --git a/tests/internal/api_docker.sh b/tests/internal/api_docker.sh old mode 100644 new mode 100755 diff --git a/tests/internal/api_various.sh b/tests/internal/api_various.sh old mode 100644 new mode 100755 diff --git a/tests/internal/build.sh b/tests/internal/build.sh old mode 100644 new mode 100755 diff --git a/tests/internal/run.sh b/tests/internal/run.sh old mode 100644 new mode 100755 diff --git a/tests/push.sh b/tests/push.sh old mode 100644 new mode 100755 diff --git a/tests/quick.sh b/tests/quick.sh old mode 100644 new mode 100755 diff --git a/tests/shellcheck.sh b/tests/shellcheck.sh old mode 100644 new mode 100755 From 1d45b6c35424b281bd72aa9eb2eae68bdf475c9c Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 2 Dec 2021 00:43:52 +0100 Subject: [PATCH 060/116] 21.04 -> 20.04 --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7cd2c93..2b86c8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # download / build / verify dependencies # own stage = additional deps needed which are only here used -FROM ubuntu:21.04 as dependencyStage +FROM ubuntu:20.04 as dependencyStage COPY setup/installGosu.sh \ setup/installSupercronic.sh \ @@ -11,7 +11,7 @@ RUN set -eux; \ # create linuxgsm image # this stage should be usable by existing developers -FROM ubuntu:21.04 as linuxgsm +FROM ubuntu:20.04 as linuxgsm ARG ARG_LGSM_VERSION="master" ENV LGSM_VERSION="${ARG_LGSM_VERSION:?}" \ From d61b56b4bacc97a2d3623a0113b5d8d0acd75982 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Thu, 2 Dec 2021 23:15:31 +0000 Subject: [PATCH 061/116] fix line endings --- .editorconfig | 13 +++++++++++++ Dockerfile | 5 +++-- commands/lgsm-init | 2 +- commands/lgsm-load-config | 6 +++--- setup/entrypoint.sh | 2 +- tests/features/testCron.sh | 10 +++++----- tests/features/testDockerLogs.sh | 2 +- tests/features/testLoadConfig.sh | 16 ++++++++-------- tests/features/testUpdateUidGuid.sh | 4 ++-- tests/internal/api_docker.sh | 4 ++-- tests/internal/api_various.sh | 4 ++-- tests/internal/build.sh | 2 +- 12 files changed, 42 insertions(+), 28 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ef3ef8b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. +# Atom: Please assure your Atom's config setting Tab Type is set to auto, otherwise Atom-EditorConfig may not work as expected. Also disable whitespace package. +# http://editorconfig.org/ + +root = true + +[*] +charset = utf-8 +indent_style = tab +indent_size = 4 +trim_trailing_whitespace = true +end_of_line = lf +insert_final_newline = true diff --git a/Dockerfile b/Dockerfile index 2b86c8c..53e5b65 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ # download / build / verify dependencies # own stage = additional deps needed which are only here used FROM ubuntu:20.04 as dependencyStage - +SHELL ["/bin/bash", "-c"] COPY setup/installGosu.sh \ setup/installSupercronic.sh \ / +RUN chmod +x installGosu.sh RUN set -eux; \ ./installGosu.sh 1.14; \ ./installSupercronic.sh v0.1.12 8d3a575654a6c93524c410ae06f681a3507ca5913627fa92c7086fd140fa12ce @@ -66,7 +67,7 @@ WORKDIR "$LGSM_PATH" # install server specific dependencies FROM linuxgsm as specific -ARG ARG_LGSM_GAMESERVER="" +ARG ARG_LGSM_GAMESERVER="gmodserver" ENV LGSM_GAMESERVER="${ARG_LGSM_GAMESERVER:?}" RUN set -eux; \ installDependencies.sh "$LGSM_GAMESERVER"; \ diff --git a/commands/lgsm-init b/commands/lgsm-init index f786da0..4c89b15 100755 --- a/commands/lgsm-init +++ b/commands/lgsm-init @@ -13,7 +13,7 @@ if ! echo "$(sha256sum "$LGSM_SCRIPTS/linuxgsm.sh" | grep -Eo '^[^ ]*') linuxgs echo "[info][lgsm-init] force uninstall lgsm, either linuxgsm changed or file to determine installed version is removed" rm -rf "lgsm" || true fi -# remove gameserver executable to not install 2nd one +# remove gameserver executable to not install 2nd one rm "$LGSM_GAMESERVER" > /dev/null 2>&1 || true gosu "$USER_NAME" cp -f "$LGSM_SCRIPTS/linuxgsm.sh" . diff --git a/commands/lgsm-load-config b/commands/lgsm-load-config index bf4bcdb..9602bf8 100755 --- a/commands/lgsm-load-config +++ b/commands/lgsm-load-config @@ -23,7 +23,7 @@ fi function fgrep_ignore_leading_whitespaces() { local find="$1" local file="$2" - + mapfile -d $'\n' -t lines < <(cat "$file") for line in "${lines[@]}"; do trimmed_line="$(grep -E -e '\S.*\S|\S' <<< "$line" || true)" @@ -108,7 +108,7 @@ function handleEnvironmentVariablePrefix() { if grep -Eq "^$key" "$check_file"; then echo "[info][lgsm-load-config] $key is part of $check_file" addConfigToFile "$target_file" "$pattern" "$key" "$value" - + else echo "[error][lgsm-load-config] provided environment variable $config is a non-default variable for current gameserver $LGSM_GAMESERVER, if you are sure you want it added use CONFIGFORCED_ as prefix." exit 12 @@ -127,7 +127,7 @@ function handleEnvironmentVariablePrefix() { rm -f "$configfile_common" # CONFIG options should be safe to use => fail if not correct because we can verify they are part of _default.cfg handleEnvironmentVariablePrefix "CONFIG_" "$configfile_common" "%s=\"%s\"" "$configfile_default" -# CONFIGFORCED_ -> skip check, e.g. +# CONFIGFORCED_ -> skip check, e.g. handleEnvironmentVariablePrefix "CONFIGFORCED_" "$configfile_common" "%s=\"%s\"" # GAME_ is added to game specific config file diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index dc9d4e1..d4b8031 100755 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -38,7 +38,7 @@ touch "$LGSM_STARTED" # alternative solution: lgsm-tmux-attach | tee /dev/tty & rm tmux.pipe > /dev/null 2>&1 || true mkfifo tmux.pipe -lgsm-tmux-attach | tee tmux.pipe & +lgsm-tmux-attach | tee tmux.pipe & while read -r line; do echo "$line" done < tmux.pipe diff --git a/tests/features/testCron.sh b/tests/features/testCron.sh index 4e8ab4a..611c291 100755 --- a/tests/features/testCron.sh +++ b/tests/features/testCron.sh @@ -15,7 +15,7 @@ source "$(dirname "$0")/../internal/api_docker.sh" cd "$(dirname "$0")/../.." DOCKERFILE_CRONLOCATION="$(grep -Po '(?<=SUPERCRONIC_CONFIG=")[^"]*' Dockerfile)" - + function fn_exit() { removeContainer "$CONTAINER" exit "${1:-1}" @@ -39,7 +39,7 @@ source "$(dirname "$0")/../internal/api_docker.sh" log "successful no cron job found" else log "container shouldn't have a cronjob" 20 - fi + fi else log "container is unhealthy" 10 fi @@ -53,10 +53,10 @@ source "$(dirname "$0")/../internal/api_docker.sh" if [ "2" != "$(echo "$crontab" | wc -l)" ]; then log "expected two cron lines, found $(echo "$crontab" | wc -l)" 21 elif ! grep -qE "^$CRON_TEST1" <<< "$crontab"; then - log "provided crontab isn't part of container but should be" 22 + log "provided crontab isn't part of container but should be" 22 else log "successfully tested one cronjob" - fi + fi else log "container is unhealthy" 11 fi @@ -76,7 +76,7 @@ source "$(dirname "$0")/../internal/api_docker.sh" else log "successfully tested two cronjobs" log "$crontab" - fi + fi else log "container is unhealthy" 12 fi diff --git a/tests/features/testDockerLogs.sh b/tests/features/testDockerLogs.sh index 36d118e..22c4292 100755 --- a/tests/features/testDockerLogs.sh +++ b/tests/features/testDockerLogs.sh @@ -11,7 +11,7 @@ VOLUME="$3" ( log="$(realpath "$(dirname "$0")")/testDockerLogs.log" cd "$(dirname "$0")/../.." - + ./tests/quick.sh --very-fast --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" if grep -qE 'VAC\s*secure\s*mode\s*is\s*activated.' "$log"; then rm "$log" diff --git a/tests/features/testLoadConfig.sh b/tests/features/testLoadConfig.sh index 1c6300c..e1901f4 100755 --- a/tests/features/testLoadConfig.sh +++ b/tests/features/testLoadConfig.sh @@ -26,7 +26,7 @@ configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" echo "[info][testLoadConfig] $1" fi } - + inContainer=(docker exec -it "$CONTAINER") # test valid CONFIG_ -> common.cfg @@ -42,7 +42,7 @@ configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" else log "maxbackups successfully added!" fi - else + else log "container didn't start with steamcredentials" 20 "$(docker logs "$CONTAINER")" fi @@ -61,7 +61,7 @@ configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" else log "steamuser and steampass successfully added!" fi - else + else log "container didn't start with steamcredentials" 20 "$(docker logs "$CONTAINER")" fi @@ -78,7 +78,7 @@ configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" else log "common.cfg successfully overwritten on startup!" fi - else + else log "container didn't start, cant check if common.cfg is overwritten " 23 "$(docker logs "$CONTAINER" || true )" fi @@ -88,7 +88,7 @@ configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" -e CONFIG_steamuser_illegal="newSteamUser" if ! awaitHealthCheck "$CONTAINER"; then log "container didn't start with illegal CONFIG value \"steamuser_illegal\"" - else + else log "illegal CONFIG option didn't break the container" 26 "$(docker logs "$CONTAINER" || true)" fi @@ -113,7 +113,7 @@ configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" else log "couldn't determine game config file" 28 fi - else + else log "container didn't start with valid GAME_ env" 27 "$(docker logs "$CONTAINER" || true )" fi @@ -140,7 +140,7 @@ configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" else log "couldn't determine game config file" 31 fi - else + else log "container didn't start with valid GAME_ env, you probably need to fix this manually" 30 "$(docker logs "$CONTAINER" || true )" fi @@ -167,7 +167,7 @@ configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" else log "couldn't determine game config file" 37 fi - else + else log "container didn't start with valid GAME_ env" 33 "$(docker logs "$CONTAINER" || true )" fi diff --git a/tests/features/testUpdateUidGuid.sh b/tests/features/testUpdateUidGuid.sh index 3c0e213..6942023 100755 --- a/tests/features/testUpdateUidGuid.sh +++ b/tests/features/testUpdateUidGuid.sh @@ -30,7 +30,7 @@ gid="750" elif [ "0" != "$("${dockerRun[@]}" alpine find . ! -group "$gid" ! -iname "tmux.pipe" | wc -l )" ]; then log "precondition failed, there are files in \"$VOLUME\" which aren't owned by group \"$gid\"" 21 "$("${dockerRun[@]}" alpine find . ! -group "$gid" ! -iname "tmux.pipe" | tail)" - + else log "precondition successful" fi @@ -41,7 +41,7 @@ gid="750" elif [ "0" != "$("${dockerRun[@]}" alpine find . ! -group "5678" ! -iname "tmux.pipe" | wc -l )" ]; then log "update failed, there are files in \"$VOLUME\" which aren't owned by group \"5678\"" 23 "$("${dockerRun[@]}" alpine find . ! -group "5678" ! -iname "tmux.pipe" | tail)" - + else log "update successful" fi diff --git a/tests/internal/api_docker.sh b/tests/internal/api_docker.sh index f3b83bf..e3a4120 100755 --- a/tests/internal/api_docker.sh +++ b/tests/internal/api_docker.sh @@ -32,7 +32,7 @@ function removeContainer() { function awaitHealthCheck() { container="$1" - + if existsContainer "$container" || ! hasContainerHealthCheak "$container"; then return 1 fi @@ -48,4 +48,4 @@ function awaitHealthCheck() { echo "[info][awaitHealthCheck] \"$container\" health check startup time $seconds" isContainerHealthHealthy "$container" -} \ No newline at end of file +} diff --git a/tests/internal/api_various.sh b/tests/internal/api_various.sh index f8c4279..aa4b038 100755 --- a/tests/internal/api_various.sh +++ b/tests/internal/api_various.sh @@ -5,7 +5,7 @@ function isEmpty() { } function contains() { - echo "$1" | grep -qF "$2" + echo "$1" | grep -qF "$2" } function getServerList() { @@ -22,4 +22,4 @@ function getServerList() { function getServerCodeList() { getServerList "$1" | grep -oE '^\S*' -} \ No newline at end of file +} diff --git a/tests/internal/build.sh b/tests/internal/build.sh index 4d50b46..9f39a59 100755 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -57,7 +57,7 @@ while [ $# -ge 1 ]; do minor="${lgsm_version#*.}" minor="${minor%%.*}" #patch="${lgsm_version##*.}" - # "$major.$minor.$patch" not added because equal to version + # "$major.$minor.$patch" not added because equal to version lgsm_tags_latest+=("$major.$minor" "$major") fi From 02f9a7a289806f6fe08488c25cd19b07b0358ac6 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 10 Feb 2022 20:23:26 +0100 Subject: [PATCH 062/116] fix steam credentials in log --- commands/lgsm-load-config | 2 +- tests/internal/run.sh | 4 ++-- tests/quick.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/lgsm-load-config b/commands/lgsm-load-config index 9602bf8..78133c6 100755 --- a/commands/lgsm-load-config +++ b/commands/lgsm-load-config @@ -49,7 +49,7 @@ function addConfigToFile() { # IMPORTANT: currently exactly two %s are allowed! pattern="${2:-}" key="$3" - value="$4" + value="$4" # dont print value, could contain secrets # determine pattern for given file, if not provided if [ -z "$pattern" ]; then diff --git a/tests/internal/run.sh b/tests/internal/run.sh index 58138af..1251ee6 100755 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -50,7 +50,7 @@ while [ $# -ge 1 ]; do shift;; *) if [ -n "$key" ]; then - echo "[info][run] additional argument to docker: $key" + echo "[info][run] additional argument to docker: $key" | sed -E 's/(steamuser|steampass)="[^"]*"/\1="xxx"/g' run_image+=("$key") fi ;; @@ -58,6 +58,6 @@ while [ $# -ge 1 ]; do done run_image+=("$docker_run_mode" --name "$container" "$IMAGE:$TAG$SUFFIX") -echo "${run_image[@]}" +echo "${run_image[@]}" | sed -E 's/(steamuser|steampass)="[^"]*"/\1="xxx"/g' "${run_image[@]}" diff --git a/tests/quick.sh b/tests/quick.sh index 9f859af..4db56d8 100755 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -107,7 +107,7 @@ trap handleInterrupt SIGTERM SIGINT removeContainer "$CONTAINER" echo "${build[@]}" "${build[@]}" - echo "${run[@]}" + echo "${run[@]}" | sed -E 's/(steamuser|steampass)="[^"]*"/\1="xxx"/g' "${run[@]}" if awaitHealthCheck "$CONTAINER"; then From 1b9b2f59dd6c3de2eef5edf4e2a490cd7461aa76 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 10 Feb 2022 23:21:43 +0100 Subject: [PATCH 063/116] fix --debug, credentials usage, config load before install --- setup/entrypoint.sh | 3 ++- tests/internal/run.sh | 4 ++-- tests/quick.sh | 15 ++++++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index d4b8031..8491892 100755 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -17,6 +17,7 @@ lgsm-cron-init # check if wished server is provided if [ ! -e "$LGSM_GAMESERVER" ]; then lgsm-init + lgsm-load-config lgsm-auto-install else lgsm-init @@ -26,9 +27,9 @@ else echo "[error][entrypoint] docker run --rm -v VOLUME_NAME:/home alpine:3.15 rm -vf /home/$LGSM_GAMESERVER" exit 1 fi + lgsm-load-config fi -lgsm-load-config lgsm-start trap lgsm-stop SIGTERM SIGINT lgsm-cron-start > /dev/null 2>&1 & diff --git a/tests/internal/run.sh b/tests/internal/run.sh index 1251ee6..3286ad8 100755 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -50,7 +50,7 @@ while [ $# -ge 1 ]; do shift;; *) if [ -n "$key" ]; then - echo "[info][run] additional argument to docker: $key" | sed -E 's/(steamuser|steampass)="[^"]*"/\1="xxx"/g' + echo "[info][run] additional argument to docker: $key" | sed -E 's/(steamuser|steampass)=\S+/\1="xxx"/g' run_image+=("$key") fi ;; @@ -58,6 +58,6 @@ while [ $# -ge 1 ]; do done run_image+=("$docker_run_mode" --name "$container" "$IMAGE:$TAG$SUFFIX") -echo "${run_image[@]}" | sed -E 's/(steamuser|steampass)="[^"]*"/\1="xxx"/g' +echo "${run_image[@]}" | sed -E 's/(steamuser|steampass)=\S+/\1="xxx"/g' "${run_image[@]}" diff --git a/tests/quick.sh b/tests/quick.sh index 4db56d8..3d51563 100755 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -16,6 +16,7 @@ source "$(dirname "$0")/steam_test_credentials" LOGS="false" +DEBUG="false" IMAGE="gameservermanagers/linuxgsm-docker" RETRY="1" GAMESERVER="" @@ -47,7 +48,8 @@ while [ $# -ge 1 ]; do -c|--no-cache) build+=(--no-cache);; -d|--debug) - run+=(--debug);; + run+=(--debug) + DEBUG="true";; --image) IMAGE="$1" shift;; @@ -83,14 +85,17 @@ if [ -z "$GAMESERVER" ]; then echo "[error][quick] no gameserver provided" exit 1 elif [ -n "$steam_test_username" ] && [ -n "$steam_test_password" ]; then - run+=(-e "CONFIGFORCED_steamuser=\"$steam_test_username\"" -e "CONFIGFORCED_steampass=\"$steam_test_password\"") + run+=(-e CONFIGFORCED_steamuser="$steam_test_username" -e CONFIGFORCED_steampass="$steam_test_password") else echo "[warning][quick] no steam credentials provided, some servers will fail without it" fi CONTAINER="linuxgsm-$GAMESERVER" build+=(--image "$IMAGE" --latest "$GAMESERVER") -run+=(--image "$IMAGE" --tag "$GAMESERVER" --container "$CONTAINER" --detach) +run+=(--image "$IMAGE" --tag "$GAMESERVER" --container "$CONTAINER") +if ! "$DEBUG"; then + run+=(--detach) +fi function handleInterrupt() { removeContainer "$CONTAINER" @@ -107,10 +112,10 @@ trap handleInterrupt SIGTERM SIGINT removeContainer "$CONTAINER" echo "${build[@]}" "${build[@]}" - echo "${run[@]}" | sed -E 's/(steamuser|steampass)="[^"]*"/\1="xxx"/g' + echo "${run[@]}" | sed -E 's/(steamuser|steampass)=\S+/\1="xxx"/g' "${run[@]}" - if awaitHealthCheck "$CONTAINER"; then + if "$DEBUG" || awaitHealthCheck "$CONTAINER"; then successful="true" fi stopContainer "$CONTAINER" From 6ad1ddb00ee5737c7400b089ab74875b964cd771 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 10 Feb 2022 23:22:20 +0100 Subject: [PATCH 064/116] fix empty suffix for tag creation --- tests/internal/build.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/internal/build.sh b/tests/internal/build.sh index 9f39a59..7a538ce 100755 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -48,7 +48,11 @@ while [ $# -ge 1 ]; do --skip-lgsm) skip_lgsm="true";; --suffix) - suffix="-$1" + if [ -n "$1" ]; then + suffix="-$1" + else + echo "[warning][build] you provided an empty suffix, skipping" + fi shift;; -v|--version) lgsm_version="$1" From 2fb23ea71f478fe6fbb1ed104f434ead8306c43a Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 10 Feb 2022 23:41:57 +0100 Subject: [PATCH 065/116] fix empty suffix in run command --- tests/internal/run.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/internal/run.sh b/tests/internal/run.sh index 3286ad8..15bf6c0 100755 --- a/tests/internal/run.sh +++ b/tests/internal/run.sh @@ -38,8 +38,12 @@ while [ $# -ge 1 ]; do IMAGE="$1" shift;; --suffix) - SUFFIX="-$1" - shift;; + if [ -n "$1" ]; then + SUFFIX="-$1" + else + echo "[warning][run] skipping suffix because its empty" + fi + shift;; -t|--tag) TAG="$1" shift;; From acba19e3761d90d04826279ba0abf7f806c822e8 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 10 Feb 2022 23:49:03 +0100 Subject: [PATCH 066/116] cleanup We dont need to use SHELL because we execute the scripts directly and the shebang of each script is used. The docker build arg for specific gameserver should be empty, because if unset the following line will throw a good error message. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 53e5b65..e7d031c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # download / build / verify dependencies # own stage = additional deps needed which are only here used FROM ubuntu:20.04 as dependencyStage -SHELL ["/bin/bash", "-c"] + COPY setup/installGosu.sh \ setup/installSupercronic.sh \ / @@ -67,7 +67,7 @@ WORKDIR "$LGSM_PATH" # install server specific dependencies FROM linuxgsm as specific -ARG ARG_LGSM_GAMESERVER="gmodserver" +ARG ARG_LGSM_GAMESERVER="" ENV LGSM_GAMESERVER="${ARG_LGSM_GAMESERVER:?}" RUN set -eux; \ installDependencies.sh "$LGSM_GAMESERVER"; \ From 1ea92f6648e0a9b1d70155adbf5394dacd78f584 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Fri, 11 Feb 2022 00:03:32 +0100 Subject: [PATCH 067/116] fix whitelist for steam credential usage --- tests/quick.sh | 10 ++++++++-- tests/steam_test_credentials | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/quick.sh b/tests/quick.sh index 3d51563..88601d0 100755 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -84,8 +84,14 @@ done if [ -z "$GAMESERVER" ]; then echo "[error][quick] no gameserver provided" exit 1 -elif [ -n "$steam_test_username" ] && [ -n "$steam_test_password" ]; then - run+=(-e CONFIGFORCED_steamuser="$steam_test_username" -e CONFIGFORCED_steampass="$steam_test_password") +elif grep -qEe "(^|\s)$GAMESERVER(\s|$)" <<< "${credentials_enabled[@]}"; then + echo "[info][quick] $GAMESERVER can only be tested with steam credential" + if [ -n "$steam_test_username" ] && [ -n "$steam_test_password" ]; then + run+=(-e CONFIGFORCED_steamuser="$steam_test_username" -e CONFIGFORCED_steampass="$steam_test_password") + else + echo "[error][quick] $GAMESERVER can only be tested with steam credentials, please fill $(realpath "$(dirname "$0")/steam_test_credentials")" + exit 2 + fi else echo "[warning][quick] no steam credentials provided, some servers will fail without it" fi diff --git a/tests/steam_test_credentials b/tests/steam_test_credentials index 39dc66e..79dda78 100644 --- a/tests/steam_test_credentials +++ b/tests/steam_test_credentials @@ -7,3 +7,5 @@ steam_test_username="" #shellcheck disable=SC2034 # used elsewhere steam_test_password="" +#shellcheck disable=SC2034 # used elsewhere +credentials_enabled=(ahl2server arma3server bsserver jk2server kfserver ns2server roserver sbserver terrariaserver twserver) From e2b9bfd4d152babf8e46e21bb9c53f8b94785f04 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 12 Feb 2022 11:26:58 +0100 Subject: [PATCH 068/116] + Flaky Test --- tests/compareMultipleResultFolders.sh | 25 +++ tests/full.sh | 235 +++++++++++++++----------- 2 files changed, 164 insertions(+), 96 deletions(-) create mode 100644 tests/compareMultipleResultFolders.sh diff --git a/tests/compareMultipleResultFolders.sh b/tests/compareMultipleResultFolders.sh new file mode 100644 index 0000000..3044c4e --- /dev/null +++ b/tests/compareMultipleResultFolders.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +mapfile -t results_folder < <(find . -type d -iname "results*") + +mapfile -t servercodes < <(find ./${results_folder[0]}/ -type f -iname "*.log" | grep -Poe '(?<=.)[^./]+(?=.log)' | sort) +for servercode in "${servercodes[@]}"; do + successful=() + failed=() + + for result_folder in "${results_folder[@]}"; do + if [ -f "$result_folder/successful.$servercode.log" ]; then + successful+=("$result_folder/successful.$servercode.log") + elif [ -f "$result_folder/failed.$servercode.log" ]; then + failed+=("$result_folder/failed.$servercode.log") + fi + done + + if [ "${#successful[@]}" -gt "0" ] && [ "${#failed[@]}" -gt "0" ]; then + echo "" + echo "$servercode flaky result" + for result in "${successful[@]}" "${failed[@]}"; do + echo "./tests/$result:10000" + done + fi +done diff --git a/tests/full.sh b/tests/full.sh index 38565fe..e54d628 100755 --- a/tests/full.sh +++ b/tests/full.sh @@ -8,6 +8,7 @@ ROOT_FOLDER="$(realpath "$(dirname "$0")/..")" PARRALEL="$(lscpu -p | grep -Ev '^#' | sort -u -t, -k 2,4 | wc -l)" IMAGE="gameservermanagers/linuxgsm-docker" +FLAKY="1" RERUN="false" SUFFIX="" VOLUMES="false" @@ -25,6 +26,7 @@ while [ $# -ge 1 ]; do echo "[help][full] options:" echo "[help][full] -c --cpus x run x servers in parralel, default x = physical cores" echo "[help][full] --image x set target image" + echo "[help][full] --flaky x test for flaky results x times, x should be greater as 1" echo "[help][full] --rerun check results and runs every gameserver which wasn't successful" echo "[help][full] --suffix suffix to add to every image" echo "[help][full] --volumes use volumes \"linuxgsm-SERVERCODE\"" @@ -41,6 +43,9 @@ while [ $# -ge 1 ]; do --image) IMAGE="$1" shift;; + --flaky) + FLAKY="$1" + shift;; --rerun) RERUN="true";; --suffix) @@ -70,100 +75,138 @@ fi # shellcheck source=tests/internal/api_various.sh source "$(dirname "$0")/internal/api_various.sh" -# prepare results folder -RESULTS="$ROOT_FOLDER/tests/results" -if [ "${#GAMESERVER[@]}" = "0" ]; then - if "$RERUN"; then - find "$RESULTS" -type f ! -name "successful.*" -exec rm -f "{}" \; - else - rm -rf "$RESULTS" - fi -else - # rerun only remove specific log - for servercode in "${GAMESERVER[@]}"; do - rm -rf "${RESULTS:?}/"*".$servercode.log" - done +for run in $(seq 1 "$FLAKY"); do + # prepare results folder + RESULTS="$ROOT_FOLDER/tests/results" + # for multiple runs move previous results folder + if [ "$FLAKY" != "1" ] && [ "$run" -gt "1" ]; then + rm -rf "$RESULTS.$((run-1))" > /dev/null 2>&1 + mv -f "$RESULTS" "$RESULTS.$((run-1))" + fi + if [ "${#GAMESERVER[@]}" = "0" ]; then + if "$RERUN"; then + find "$RESULTS" -type f ! -name "successful.*" -exec rm -f "{}" \; + else + rm -rf "$RESULTS" + fi + else + # rerun only remove specific log + for servercode in "${GAMESERVER[@]}"; do + rm -rf "${RESULTS:?}/"*".$servercode.log" + done + fi + mkdir -p "$RESULTS" + + ( + if "$RERUN"; then + echo "[info][full] building linuxgsm base once" + ./tests/internal/build.sh --version "$VERSION" --image "$IMAGE" --latest --suffix "$SUFFIX" + else + echo "[info][full] skipping building linuxgsm because rerun" + fi + + subprocesses=() + function handleInterrupt() { + for pid in "${subprocesses[@]}"; do + kill -s SIGINT "$pid" || true + done + } + trap handleInterrupt SIGTERM SIGINT + + mapfile -d $'\n' -t servers < <(getServerCodeList "$VERSION") + for server_code in "${servers[@]}"; do + cd "$ROOT_FOLDER" + + # only start $PARRALEL amount of tests + while [ "${#subprocesses[@]}" -ge "$PARRALEL" ]; do + sleep 1s + temp=() + for pid in "${subprocesses[@]}"; do + if ps -p "$pid" -o pid= > /dev/null 2>&1; then + temp+=("$pid") + fi + done + subprocesses=("${temp[@]}") + done + + + isServercodeInServerlist="$(grep -qF "$server_code" <<< "${GAMESERVER[@]}" && echo true || echo false )" + serverDidntStartSuccessful="$([ ! -f "$RESULTS/successful.$server_code.log" ] && echo true || echo false )" + testThisServercode="$( ("$testAllServer" || "$isServercodeInServerlist") && echo true || echo false )" + rerunIsFine="$( ( ! "$RERUN" || "$serverDidntStartSuccessful" ) && echo true || echo false )" + if "$testThisServercode" && "$rerunIsFine"; then + echo "[info][full] testing: $server_code" + ( + quick=(./tests/quick.sh --logs --version "$VERSION" --image "$IMAGE" --skip-lgsm --suffix "$SUFFIX") + if "$VOLUMES"; then + quick+=(--volume "linuxgsm-$server_code") + fi + quick+=("$server_code") + + echo "${quick[@]}" + if "${quick[@]}" > "$RESULTS/$server_code.log" 2>&1; then + mv "$RESULTS/$server_code.log" "$RESULTS/successful.$server_code.log" + else + mv "$RESULTS/$server_code.log" "$RESULTS/failed.$server_code.log" + fi + ) | tee /dev/tty > /dev/null 2>&1 & + subprocesses+=("$!") + fi + done + + # await every job is done + while [ "${#subprocesses[@]}" -gt "0" ]; do + sleep 1s + temp=() + for pid in "${subprocesses[@]}"; do + if ps -p "$pid" -o pid= > /dev/null 2>&1; then + temp+=("$pid") + fi + done + subprocesses=("${temp[@]}") + done + + echo "[info][full] successful: $(find "$RESULTS/" -iname "successful.*" | wc -l)" + echo "[info][full] failed: $(find "$RESULTS/" -iname "failed.*" | wc -l)" + + mapfile -t failed_credentials_missing < <(grep --include "*failed*" -rlF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) + echo "[info][full] failed - unset steam credentials: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_credentials_missing[@]}" | tr '\n' ' ' || true)" + # print filenames + very high line number to jump right at eof on click if IDE supports it + printf '%s\n' "${failed_credentials_missing[@]/%/:100000}" + + mapfile -t failed_other < <(grep --include "*failed*" -rLF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) + echo "[info][full] failed - other error: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_other[@]}" | tr '\n' ' ' || true)" + printf '%s\n' "${failed_other[@]/%/:100000}" + ) +done + +if [ "$FLAKY" != "1" ]; then + mapfile -t results_folder < <(find "$ROOT_FOLDER" -type d -iname "results.*") + + mapfile -t servercodes < <(find "$RESULTS" -type f -iname "*.log" | grep -Poe '(?<=.)[^./]+(?=.log)' | sort) + for servercode in "${servercodes[@]}"; do + successful=() + failed=() + if [ -f "$RESULTS/failed.$servercode.log" ]; then + failed=("$RESULTS/failed.$servercode.log") + elif [ -f "$RESULTS/successful.$servercode.log" ]; then + successful+=("$RESULTS/successful.$servercode.log") + fi + + for result_folder in "${results_folder[@]}"; do + if [ -f "$result_folder/successful.$servercode.log" ]; then + successful+=("$result_folder/successful.$servercode.log") + elif [ -f "$result_folder/failed.$servercode.log" ]; then + failed+=("$result_folder/failed.$servercode.log") + fi + done + + if [ "${#successful[@]}" -gt "0" ] && [ "${#failed[@]}" -gt "0" ]; then + echo "" + echo "$servercode flaky result" + for result in "${successful[@]}" "${failed[@]}"; do + echo "$result:10000" + done + fi + done fi -mkdir -p "$RESULTS" - -( - if "$RERUN"; then - echo "[info][full] building linuxgsm base once" - ./tests/internal/build.sh --version "$VERSION" --image "$IMAGE" --latest --suffix "$SUFFIX" - else - echo "[info][full] skipping building linuxgsm because rerun" - fi - - subprocesses=() - function handleInterrupt() { - for pid in "${subprocesses[@]}"; do - kill -s SIGINT "$pid" || true - done - } - trap handleInterrupt SIGTERM SIGINT - - mapfile -d $'\n' -t servers < <(getServerCodeList "$VERSION") - for server_code in "${servers[@]}"; do - cd "$ROOT_FOLDER" - - # only start $PARRALEL amount of tests - while [ "${#subprocesses[@]}" -ge "$PARRALEL" ]; do - sleep 1s - temp=() - for pid in "${subprocesses[@]}"; do - if ps -p "$pid" -o pid= > /dev/null 2>&1; then - temp+=("$pid") - fi - done - subprocesses=("${temp[@]}") - done - - - isServercodeInServerlist="$(grep -qF "$server_code" <<< "${GAMESERVER[@]}" && echo true || echo false )" - serverDidntStartSuccessful="$([ ! -f "$RESULTS/successful.$server_code.log" ] && echo true || echo false )" - testThisServercode="$( ("$testAllServer" || "$isServercodeInServerlist") && echo true || echo false )" - rerunIsFine="$( ( ! "$RERUN" || "$serverDidntStartSuccessful" ) && echo true || echo false )" - if "$testThisServercode" && "$rerunIsFine"; then - echo "[info][full] testing: $server_code" - ( - quick=(./tests/quick.sh --logs --version "$VERSION" --image "$IMAGE" --skip-lgsm --suffix "$SUFFIX") - if "$VOLUMES"; then - quick+=(--volume "linuxgsm-$server_code") - fi - quick+=("$server_code") - - echo "${quick[@]}" - if "${quick[@]}" > "$RESULTS/$server_code.log" 2>&1; then - mv "$RESULTS/$server_code.log" "$RESULTS/successful.$server_code.log" - else - mv "$RESULTS/$server_code.log" "$RESULTS/failed.$server_code.log" - fi - ) | tee /dev/tty > /dev/null 2>&1 & - subprocesses+=("$!") - fi - done - - # await every job is done - while [ "${#subprocesses[@]}" -gt "0" ]; do - sleep 1s - temp=() - for pid in "${subprocesses[@]}"; do - if ps -p "$pid" -o pid= > /dev/null 2>&1; then - temp+=("$pid") - fi - done - subprocesses=("${temp[@]}") - done - - echo "[info][full] successful: $(find "$RESULTS/" -iname "successful.*" | wc -l)" - echo "[info][full] failed: $(find "$RESULTS/" -iname "failed.*" | wc -l)" - - mapfile -t failed_credentials_missing < <(grep --include "*failed*" -rlF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) - echo "[info][full] failed - unset steam credentials: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_credentials_missing[@]}" | tr '\n' ' ' || true)" - # print filenames + very high line number to jump right at eof on click if IDE supports it - printf '%s\n' "${failed_credentials_missing[@]/%/:100000}" - - mapfile -t failed_other < <(grep --include "*failed*" -rLF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) - echo "[info][full] failed - other error: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_other[@]}" | tr '\n' ' ' || true)" - printf '%s\n' "${failed_other[@]/%/:100000}" -) From 8fa83eff9fb81257db2d3cca6e7bd723e374fd4f Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 12 Feb 2022 16:47:55 +0100 Subject: [PATCH 069/116] fix gamedig, nodejs 12+ --- Dockerfile | 1 + setup/entrypoint.sh | 4 ++++ setup/installGamedig.sh | 17 +++++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e7d031c..5d9e367 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ FROM ubuntu:20.04 as linuxgsm ARG ARG_LGSM_VERSION="master" ENV LGSM_VERSION="${ARG_LGSM_VERSION:?}" \ LGSM_GAMESERVER="" \ + LGSM_USE_GAMEDIG="true" \ LGSM_CONFIG_PATTERN_GAME="" \ USER_ID="750" \ GROUP_ID="750" \ diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index 8491892..8e78f16 100755 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -7,6 +7,10 @@ if "$LGSM_DEBUG"; then set -o xtrace fi +if ! "$LGSM_USE_GAMEDIG"; then + npm uninstall -g gamedig +fi + cd "$LGSM_PATH" rm "$LGSM_STARTED" > /dev/null 2>&1 || true diff --git a/setup/installGamedig.sh b/setup/installGamedig.sh index 84f4d2b..69f8440 100755 --- a/setup/installGamedig.sh +++ b/setup/installGamedig.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o nounset @@ -8,6 +8,19 @@ fi echo 'tzdata tzdata/Areas select Europe' | debconf-set-selections echo 'tzdata tzdata/Zones/Europe select Berlin' | debconf-set-selections + apt-get update -DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends npm +DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends xz-utils + +NODE_VERSION=v16.14.0 +wget "https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.xz" +mkdir -p "/usr/local/lib/nodejs" +tar -xJvf "node-$NODE_VERSION-linux-x64.tar.xz" -C "/usr/local/lib/nodejs" +printf '\nexport PATH="%s:/usr/local/lib/nodejs/node-%s-linux-x64/bin"\n' "$PATH" "$NODE_VERSION" > ~/.bashrc + +. ~/.profile + +node -v +npm version +npx -v npm install -g gamedig From b705a7a4d237a5aa1f38b06c678544dcea8bfb15 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 13 Feb 2022 03:08:15 +0100 Subject: [PATCH 070/116] fix executable not found --- setup/installDependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/installDependencies.sh b/setup/installDependencies.sh index 90d98b0..85a2bd8 100755 --- a/setup/installDependencies.sh +++ b/setup/installDependencies.sh @@ -17,7 +17,7 @@ gosu "$USER_NAME" ./linuxgsm.sh "$server" # maybe add a "./linuxgsm.sh installDependencies" gosu "$USER_NAME" ./"$server" auto-install 2>&1 | tee auto-install.log || true # if not probably dependencies are missing -mapfile -d ";" cmds < <( grep 'sudo\s*dpkg' auto-install.log | sed -E 's/\s*sudo\s*//g' | sed 's/install/install -y /g' ) +mapfile -d ";" cmds < <( grep -Ee 'sudo\s\s*(dpkg|apt)' auto-install.log | sed -E 's/\s*sudo\s*//g' | sed 's/install/install -y /g' ) if [ "${#cmds[@]}" -gt "0" ]; then # preselect answers for steam echo steam steam/question select "I AGREE" | debconf-set-selections #"# ide fix From 13cd17becf3fc7a177072a8ec43aa554ff125183 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 14 Feb 2022 00:34:47 +0100 Subject: [PATCH 071/116] ~ improved dependency installation --- .gitignore | 2 +- setup/installDependencies.sh | 24 +++++++++++---- tests/compareMultipleResultFolders.sh | 42 +++++++++++++++------------ tests/full.sh | 2 +- 4 files changed, 44 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 5369287..20b27e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ *~ -tests/results +tests/*results* **/*.log tests/steam_test_credentials diff --git a/setup/installDependencies.sh b/setup/installDependencies.sh index 85a2bd8..b9010b7 100755 --- a/setup/installDependencies.sh +++ b/setup/installDependencies.sh @@ -25,11 +25,25 @@ if [ "${#cmds[@]}" -gt "0" ]; then # install dependencies echo "[info][installDependencies] installing dependencies:" + apt-get update for cmd in "${cmds[@]}"; do - echo "$cmd" - eval "DEBIAN_FRONTEND=noninteractive $cmd" || ( - apt-get update - eval "DEBIAN_FRONTEND=noninteractive $cmd" - ) + echo "[info][installDependencies] $cmd" + if eval "DEBIAN_FRONTEND=noninteractive $cmd"; then + echo "[info][installDependencies] successful!" + elif grep -qe ':i386' <<< "$cmd"; then + echo "[info][installDependencies] retry" + dpkg --add-architecture i386 + apt-get update + eval "DEBIAN_FRONTEND=noninteractive $cmd" + else + echo "[error][installDependencies] failed" + exit 10 + fi + apt-get update done +else + echo "[error][installDependencies] Couldn't extract missing dependencies, its very unlikely that everything is already installed. Printing debug information:" + echo "${cmds[@]}" + cat auto-install.log + exit 10 fi diff --git a/tests/compareMultipleResultFolders.sh b/tests/compareMultipleResultFolders.sh index 3044c4e..45f5b09 100644 --- a/tests/compareMultipleResultFolders.sh +++ b/tests/compareMultipleResultFolders.sh @@ -1,25 +1,29 @@ #!/bin/bash -mapfile -t results_folder < <(find . -type d -iname "results*") +( + cd "$(dirname "$0")" -mapfile -t servercodes < <(find ./${results_folder[0]}/ -type f -iname "*.log" | grep -Poe '(?<=.)[^./]+(?=.log)' | sort) -for servercode in "${servercodes[@]}"; do - successful=() - failed=() + mapfile -t results_folder < <(find . -maxdepth 1 -type d -iname "results*") - for result_folder in "${results_folder[@]}"; do - if [ -f "$result_folder/successful.$servercode.log" ]; then - successful+=("$result_folder/successful.$servercode.log") - elif [ -f "$result_folder/failed.$servercode.log" ]; then - failed+=("$result_folder/failed.$servercode.log") - fi - done + mapfile -t servercodes < <(find ./${results_folder[0]}/ -type f -iname "*.log" | grep -Poe '(?<=.)[^./]+(?=.log)' | sort) + for servercode in "${servercodes[@]}"; do + successful=() + failed=() - if [ "${#successful[@]}" -gt "0" ] && [ "${#failed[@]}" -gt "0" ]; then - echo "" - echo "$servercode flaky result" - for result in "${successful[@]}" "${failed[@]}"; do - echo "./tests/$result:10000" + for result_folder in "${results_folder[@]}"; do + if [ -f "$result_folder/successful.$servercode.log" ]; then + successful+=("$result_folder/successful.$servercode.log") + elif [ -f "$result_folder/failed.$servercode.log" ]; then + failed+=("$result_folder/failed.$servercode.log") + fi done - fi -done + + if [ "${#successful[@]}" -gt "0" ] && [ "${#failed[@]}" -gt "0" ]; then + echo "" + echo "$servercode flaky result" + for result in "${successful[@]}" "${failed[@]}"; do + echo "./tests/${result//.\//}:10000" + done + fi + done +) diff --git a/tests/full.sh b/tests/full.sh index e54d628..50dab98 100755 --- a/tests/full.sh +++ b/tests/full.sh @@ -81,7 +81,7 @@ for run in $(seq 1 "$FLAKY"); do # for multiple runs move previous results folder if [ "$FLAKY" != "1" ] && [ "$run" -gt "1" ]; then rm -rf "$RESULTS.$((run-1))" > /dev/null 2>&1 - mv -f "$RESULTS" "$RESULTS.$((run-1))" + cp -rf "$RESULTS/" "$RESULTS.$((run-1))/" fi if [ "${#GAMESERVER[@]}" = "0" ]; then if "$RERUN"; then From 6296020d9f77ea77b928bab58b290bac197e5329 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Fri, 18 Feb 2022 18:26:50 +0100 Subject: [PATCH 072/116] ~ more automated output for tests --- tests/compareMultipleResultFolders.sh | 6 ++++++ tests/full.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/compareMultipleResultFolders.sh b/tests/compareMultipleResultFolders.sh index 45f5b09..efa6fda 100644 --- a/tests/compareMultipleResultFolders.sh +++ b/tests/compareMultipleResultFolders.sh @@ -24,6 +24,12 @@ for result in "${successful[@]}" "${failed[@]}"; do echo "./tests/${result//.\//}:10000" done + elif [ "${#successful[@]}" -eq "0" ]; then + echo "" + echo "$servercode always failing" + for result in "${successful[@]}" "${failed[@]}"; do + echo "./tests/${result//.\//}:10000" + done fi done ) diff --git a/tests/full.sh b/tests/full.sh index 50dab98..5f48ec9 100755 --- a/tests/full.sh +++ b/tests/full.sh @@ -181,7 +181,7 @@ for run in $(seq 1 "$FLAKY"); do done if [ "$FLAKY" != "1" ]; then - mapfile -t results_folder < <(find "$ROOT_FOLDER" -type d -iname "results.*") + mapfile -t results_folder < <(find "$ROOT_FOLDER" -maxdepth 1 -type d -iname "results.*") mapfile -t servercodes < <(find "$RESULTS" -type f -iname "*.log" | grep -Poe '(?<=.)[^./]+(?=.log)' | sort) for servercode in "${servercodes[@]}"; do From f483d1038ade3fc54d1edafed6f3afa13200bba1 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 20 Feb 2022 13:18:33 +0100 Subject: [PATCH 073/116] ~ improved --- setup/installMinimalDependencies.sh | 15 ++++++--- tests/compareMultipleResultFolders.sh | 2 +- tests/full.sh | 46 +++++++++------------------ 3 files changed, 26 insertions(+), 37 deletions(-) diff --git a/setup/installMinimalDependencies.sh b/setup/installMinimalDependencies.sh index 41e33bf..a2f6135 100755 --- a/setup/installMinimalDependencies.sh +++ b/setup/installMinimalDependencies.sh @@ -8,10 +8,15 @@ fi echo "[info][installMinimalDependencies] installing ..." apt-get update -# curl / wget needed for lgsm # iproute2, fix "-o: command not found", fix "ss: command not found" -DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates wget locales curl iproute2 +# XXX it would be better to install minimal deps to download and parse all section +DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + file \ + iproute2 \ + jq \ + locales \ + unzip \ + wget localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 - -# verify gosu is working -gosu nobody true diff --git a/tests/compareMultipleResultFolders.sh b/tests/compareMultipleResultFolders.sh index efa6fda..7ca9590 100644 --- a/tests/compareMultipleResultFolders.sh +++ b/tests/compareMultipleResultFolders.sh @@ -3,7 +3,7 @@ ( cd "$(dirname "$0")" - mapfile -t results_folder < <(find . -maxdepth 1 -type d -iname "results*") + mapfile -t results_folder < <(find "." -maxdepth 1 -type d -iname "results*") mapfile -t servercodes < <(find ./${results_folder[0]}/ -type f -iname "*.log" | grep -Poe '(?<=.)[^./]+(?=.log)' | sort) for servercode in "${servercodes[@]}"; do diff --git a/tests/full.sh b/tests/full.sh index 5f48ec9..e261170 100755 --- a/tests/full.sh +++ b/tests/full.sh @@ -98,11 +98,11 @@ for run in $(seq 1 "$FLAKY"); do mkdir -p "$RESULTS" ( - if "$RERUN"; then + if "$RERUN" || [ "$run" -gt "1" ]; then + echo "[info][full] skipping building linuxgsm because rerun" + else echo "[info][full] building linuxgsm base once" ./tests/internal/build.sh --version "$VERSION" --image "$IMAGE" --latest --suffix "$SUFFIX" - else - echo "[info][full] skipping building linuxgsm because rerun" fi subprocesses=() @@ -177,36 +177,20 @@ for run in $(seq 1 "$FLAKY"); do mapfile -t failed_other < <(grep --include "*failed*" -rLF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) echo "[info][full] failed - other error: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_other[@]}" | tr '\n' ' ' || true)" printf '%s\n' "${failed_other[@]/%/:100000}" + + echo "" + echo "[info][full] searching in log for command errors \"command not found\" please add this as minimal dependency!" + grep -rnF 'command not found' "$RESULTS" + + echo "" + echo "[info][full] searching in log for errors where health check got SIGKILL" + grep -rnF '"ExitCode": 137' "$RESULTS" ) done if [ "$FLAKY" != "1" ]; then - mapfile -t results_folder < <(find "$ROOT_FOLDER" -maxdepth 1 -type d -iname "results.*") - - mapfile -t servercodes < <(find "$RESULTS" -type f -iname "*.log" | grep -Poe '(?<=.)[^./]+(?=.log)' | sort) - for servercode in "${servercodes[@]}"; do - successful=() - failed=() - if [ -f "$RESULTS/failed.$servercode.log" ]; then - failed=("$RESULTS/failed.$servercode.log") - elif [ -f "$RESULTS/successful.$servercode.log" ]; then - successful+=("$RESULTS/successful.$servercode.log") - fi - - for result_folder in "${results_folder[@]}"; do - if [ -f "$result_folder/successful.$servercode.log" ]; then - successful+=("$result_folder/successful.$servercode.log") - elif [ -f "$result_folder/failed.$servercode.log" ]; then - failed+=("$result_folder/failed.$servercode.log") - fi - done - - if [ "${#successful[@]}" -gt "0" ] && [ "${#failed[@]}" -gt "0" ]; then - echo "" - echo "$servercode flaky result" - for result in "${successful[@]}" "${failed[@]}"; do - echo "$result:10000" - done - fi - done + ( + cd "$ROOT_FOLDER" + ./compareMultipleResultFolders.sh + ) fi From ea1015a61083af9a24f1657d51e795e2e4ce10c6 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 21 Feb 2022 02:13:33 +0100 Subject: [PATCH 074/116] fix restart / update exiting container --- Dockerfile | 5 +++-- setup/createAlias.sh | 4 +++- setup/entrypoint.sh | 30 +++++++++++++++++++++--------- tests/full.sh | 8 ++++++-- tests/internal/build.sh | 5 ++--- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5d9e367..e64d62a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,8 @@ ENV LGSM_VERSION="${ARG_LGSM_VERSION:?}" \ LC_ALL="en_US.UTF-8" \ TERM="xterm" \ SUPERCRONIC_CONFIG="/home/linuxgsm-scripts/cron.config" \ - LGSM_STARTED="/home/linuxgsm/server.started" + LGSM_STARTED="/home/linuxgsm/server.started" \ + LGSM_CURRENT_COMMAND="/home/linuxgsm/lgsm-cmd.currently" COPY --from=dependencyStage \ /usr/local/bin/gosu \ @@ -75,7 +76,7 @@ RUN set -eux; \ createAlias.sh "$LGSM_GAMESERVER"; \ cleanImage.sh -HEALTHCHECK --start-period=3600s --interval=60s --timeout=900s --retries=3 \ +HEALTHCHECK --start-period=3600s --interval=90s --timeout=900s --retries=3 \ CMD [ -f "$LGSM_STARTED" ] && lgsm-monitor || exit 1 ENTRYPOINT ["./../linuxgsm-scripts/entrypoint.sh"] diff --git a/setup/createAlias.sh b/setup/createAlias.sh index f049b95..90ed280 100755 --- a/setup/createAlias.sh +++ b/setup/createAlias.sh @@ -13,7 +13,7 @@ fi echo "[info][createAlias] creating linuxgsm alias" function createAlias() { - name="$1" + name="$(tr '[:upper:]' '[:lower:]' <<< "$1")" command="$LGSM_PATH/$LGSM_GAMESERVER" file="$LGSM_SCRIPTS/$name" @@ -23,7 +23,9 @@ function createAlias() { echo "[info][createAlias.sh] $command $name" cat > "$file" <<- EOM #!/bin/sh + echo '$name' >> "\$LGSM_CURRENT_COMMAND" gosu "\$USER_NAME" "$command" "$name" "\$@" + sed -i '/^$name$/d' "\$LGSM_CURRENT_COMMAND" EOM chmod a=rx "$file" # create 2nd link for better script readability diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index 8e78f16..0744ade 100755 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -39,14 +39,26 @@ trap lgsm-stop SIGTERM SIGINT lgsm-cron-start > /dev/null 2>&1 & touch "$LGSM_STARTED" -# tmux in background with log usable for docker -# alternative solution: lgsm-tmux-attach | tee /dev/tty & -rm tmux.pipe > /dev/null 2>&1 || true -mkfifo tmux.pipe -lgsm-tmux-attach | tee tmux.pipe & -while read -r line; do - echo "$line" -done < tmux.pipe +is_running="true" +while "$is_running"; do + # tmux in background with log usable for docker + # alternative solution: lgsm-tmux-attach | tee /dev/tty & + rm tmux.pipe > /dev/null 2>&1 || true + mkfifo tmux.pipe + lgsm-tmux-attach | tee tmux.pipe & + while read -r line; do + echo "$line" + done < tmux.pipe + + echo "[info][entrypoint] server stopped" + is_running="false" + current_running_lgsm_alias="$(< "$LGSM_CURRENT_COMMAND")" + for lgsm_cmd in monitor update restart force-update validate; do + if grep -qe "$lgsm_cmd" <<< "$current_running_lgsm_alias"; then + echo "[info][entrypoint] lgsm command \"$lgsm_cmd\" is being executed and is permitted to stop the server, reattaching to tmux" + is_running="true" + fi + done +done rm "$LGSM_STARTED" > /dev/null 2>&1 || true echo "[info][entrypoint] entrypoint ended" - diff --git a/tests/full.sh b/tests/full.sh index e261170..fc4f975 100755 --- a/tests/full.sh +++ b/tests/full.sh @@ -180,11 +180,15 @@ for run in $(seq 1 "$FLAKY"); do echo "" echo "[info][full] searching in log for command errors \"command not found\" please add this as minimal dependency!" - grep -rnF 'command not found' "$RESULTS" + grep -rnF 'command not found' "$RESULTS" || true echo "" echo "[info][full] searching in log for errors where health check got SIGKILL" - grep -rnF '"ExitCode": 137' "$RESULTS" + grep -rnF '"ExitCode": 137' "$RESULTS" || true + + echo "" + echo "[info][full] log contains message \"provide content log to LinuxGSM developers\"" + grep -rnF 'LinuxGSM developers' "$RESULTS" || true ) done diff --git a/tests/internal/build.sh b/tests/internal/build.sh index 7a538ce..8050961 100755 --- a/tests/internal/build.sh +++ b/tests/internal/build.sh @@ -82,9 +82,8 @@ done lgsm_main_tag="$lgsm_version$suffix" specific_main_tag="$lgsm_version-${server}$suffix" -# BUILDKIT_INLINE_CACHE needed for --cache-from -build_lgsm+=(-t "$image:$lgsm_main_tag" --target linuxgsm --build-arg BUILDKIT_INLINE_CACHE=1 .) -build_specific+=(-t "$image:$specific_main_tag" --target specific --cache-from "$image:$lgsm_main_tag" --build-arg "ARG_LGSM_GAMESERVER=$server" .) +build_lgsm+=(-t "$image:$lgsm_main_tag" --target linuxgsm .) +build_specific+=(-t "$image:$specific_main_tag" --target specific --build-arg "ARG_LGSM_GAMESERVER=$server" .) cd "$(dirname "$0")/../.." From 2f9f66b3a4173a72c7e83c3847449d715b527625 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 21 Feb 2022 17:44:24 +0100 Subject: [PATCH 075/116] fix gamedig not found --- setup/installGamedig.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/setup/installGamedig.sh b/setup/installGamedig.sh index 69f8440..86ab4dd 100755 --- a/setup/installGamedig.sh +++ b/setup/installGamedig.sh @@ -10,17 +10,24 @@ echo 'tzdata tzdata/Areas select Europe' | debconf-set-selections echo 'tzdata tzdata/Zones/Europe select Berlin' | debconf-set-selections apt-get update -DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends xz-utils +DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends xz-utils jq -NODE_VERSION=v16.14.0 +NODE_VERSION="v16.14.0" wget "https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.xz" mkdir -p "/usr/local/lib/nodejs" tar -xJvf "node-$NODE_VERSION-linux-x64.tar.xz" -C "/usr/local/lib/nodejs" -printf '\nexport PATH="%s:/usr/local/lib/nodejs/node-%s-linux-x64/bin"\n' "$PATH" "$NODE_VERSION" > ~/.bashrc +rm "node-$NODE_VERSION-linux-x64.tar.xz" -. ~/.profile +mapfile -t npm_bin < <(find "/usr/local/lib/nodejs/node-$NODE_VERSION-linux-x64/bin/" ! -type d -exec basename "{}" \;) +for bin in "${npm_bin[@]}"; do + ln -vs "/usr/local/lib/nodejs/node-$NODE_VERSION-linux-x64/bin/$bin" "/usr/local/bin/$bin" +done node -v npm version npx -v npm install -g gamedig +ln -vs "/usr/local/lib/nodejs/node-$NODE_VERSION-linux-x64/bin/gamedig" "/usr/local/bin/gamedig" + +command -v gamedig +command -v jq \ No newline at end of file From ce4af3b8d744797d313f96c0d654170eb1f9e7b6 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 21 Feb 2022 17:44:50 +0100 Subject: [PATCH 076/116] fix full.sh not comparing at the end --- tests/full.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/full.sh b/tests/full.sh index fc4f975..345aff0 100755 --- a/tests/full.sh +++ b/tests/full.sh @@ -195,6 +195,6 @@ done if [ "$FLAKY" != "1" ]; then ( cd "$ROOT_FOLDER" - ./compareMultipleResultFolders.sh + ./tests/compareMultipleResultFolders.sh ) fi From b55506178a5ddfa82b45853d425ac10d9f4bb6b5 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 23 Feb 2022 00:49:29 +0100 Subject: [PATCH 077/116] + clean volume folder --- setup/cleanImage.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup/cleanImage.sh b/setup/cleanImage.sh index c26e4a3..dc99c78 100755 --- a/setup/cleanImage.sh +++ b/setup/cleanImage.sh @@ -14,4 +14,5 @@ rm -rf "${LGSM_PATH:?}"/* /tmp/* /var/tmp/* || true rm "$LGSM_SCRIPTS/installMinimalDependencies.sh" \ "$LGSM_SCRIPTS/installLGSM.sh" \ "$LGSM_SCRIPTS/installGamedig.sh" \ - "$LGSM_SCRIPTS/setupUser.sh" >> /dev/null 2>&1 || true + "$LGSM_SCRIPTS/setupUser.sh" \ + "$LGSM_PATH"/* >> /dev/null 2>&1 || true From 73ddbcfa6bb58df9d33b26171529894a6f6434b8 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 26 Feb 2022 13:01:26 +0100 Subject: [PATCH 078/116] update --- commands/lgsm-load-config | 1 + setup/entrypoint.sh | 15 +++++++++++++-- tests/full.sh | 15 +++++++++++++++ tests/internal/api_various.sh | 11 +++++++++++ tests/quick.sh | 13 ++++++++++--- 5 files changed, 50 insertions(+), 5 deletions(-) diff --git a/commands/lgsm-load-config b/commands/lgsm-load-config index 78133c6..2063010 100755 --- a/commands/lgsm-load-config +++ b/commands/lgsm-load-config @@ -40,6 +40,7 @@ function sed_sanitize() { #local sanitized="${sanitized//\{/\\\\{}" # { need to be escaped local sanitized="${sanitized//[/\\[}" # [ need to be escaped local sanitized="${sanitized//&/\\&}" # & need to be escaped + local sanitized="${sanitized//*/\\*}" # * need to be escaped echo "$sanitized" } diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index 0744ade..5444511 100755 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -5,6 +5,10 @@ set -o pipefail set -o nounset if "$LGSM_DEBUG"; then set -o xtrace + touch ".dev-debug" + rm dev-debug*.log || true # remove from last execution +else + rm ".dev-debug" || true fi if ! "$LGSM_USE_GAMEDIG"; then @@ -31,8 +35,8 @@ else echo "[error][entrypoint] docker run --rm -v VOLUME_NAME:/home alpine:3.15 rm -vf /home/$LGSM_GAMESERVER" exit 1 fi - lgsm-load-config fi +lgsm-load-config lgsm-start trap lgsm-stop SIGTERM SIGINT @@ -40,6 +44,7 @@ lgsm-cron-start > /dev/null 2>&1 & touch "$LGSM_STARTED" is_running="true" +first_start="$(date +'%s')" while "$is_running"; do # tmux in background with log usable for docker # alternative solution: lgsm-tmux-attach | tee /dev/tty & @@ -49,8 +54,8 @@ while "$is_running"; do while read -r line; do echo "$line" done < tmux.pipe - echo "[info][entrypoint] server stopped" + is_running="false" current_running_lgsm_alias="$(< "$LGSM_CURRENT_COMMAND")" for lgsm_cmd in monitor update restart force-update validate; do @@ -59,6 +64,12 @@ while "$is_running"; do is_running="true" fi done + + # e.g. cod4server will fail on first start + current_time="$(date +'%s')" + if ! "$is_running" && [ "$((current_time - first_start))" -lt "60" ]; then + echo "[warning][entrypoint] server crashed within 60 seconds, restarting" + fi done rm "$LGSM_STARTED" > /dev/null 2>&1 || true echo "[info][entrypoint] entrypoint ended" diff --git a/tests/full.sh b/tests/full.sh index 345aff0..b690972 100755 --- a/tests/full.sh +++ b/tests/full.sh @@ -74,6 +74,8 @@ fi # shellcheck source=tests/internal/api_various.sh source "$(dirname "$0")/internal/api_various.sh" +# shellcheck source=tests/steam_test_credentials +source "$(dirname "$0")/steam_test_credentials" for run in $(seq 1 "$FLAKY"); do # prepare results folder @@ -144,7 +146,20 @@ for run in $(seq 1 "$FLAKY"); do quick+=("$server_code") echo "${quick[@]}" + is_successful="false" if "${quick[@]}" > "$RESULTS/$server_code.log" 2>&1; then + is_successful="true" + fi + + # sanitize secrets in log like used steamuser / steampass + if [ -n "$steam_test_username" ]; then + sed -i "s/$(sed_sanitize "$steam_test_username")/SECRET_USERNAME/g" "$RESULTS/$server_code.log" + fi + if [ -n "$steam_test_password" ]; then + sed -i "s/$(sed_sanitize "$steam_test_password")/SECRET_PASSWORD/g" "$RESULTS/$server_code.log" + fi + + if "$is_successful"; then mv "$RESULTS/$server_code.log" "$RESULTS/successful.$server_code.log" else mv "$RESULTS/$server_code.log" "$RESULTS/failed.$server_code.log" diff --git a/tests/internal/api_various.sh b/tests/internal/api_various.sh index aa4b038..754061a 100755 --- a/tests/internal/api_various.sh +++ b/tests/internal/api_various.sh @@ -23,3 +23,14 @@ function getServerList() { function getServerCodeList() { getServerList "$1" | grep -oE '^\S*' } + +function sed_sanitize() { + local sanitized="$1" + local sanitized="${sanitized//\\/\\\\}" # \ need to be escaped e.g. 's/\//' + local sanitized="${sanitized//\//\\/}" # / need to be escaped e.g. 's///' + #local sanitized="${sanitized//\{/\\\\{}" # { need to be escaped + local sanitized="${sanitized//[/\\[}" # [ need to be escaped + local sanitized="${sanitized//&/\\&}" # & need to be escaped + local sanitized="${sanitized//*/\\*}" # * need to be escaped + echo "$sanitized" +} \ No newline at end of file diff --git a/tests/quick.sh b/tests/quick.sh index 88601d0..ec8d98d 100755 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -98,7 +98,7 @@ fi CONTAINER="linuxgsm-$GAMESERVER" build+=(--image "$IMAGE" --latest "$GAMESERVER") -run+=(--image "$IMAGE" --tag "$GAMESERVER" --container "$CONTAINER") +run+=(--image "$IMAGE" --tag "$GAMESERVER" --container "$CONTAINER" -e LGSM_DEBUG="true") if ! "$DEBUG"; then run+=(--detach) fi @@ -124,14 +124,21 @@ trap handleInterrupt SIGTERM SIGINT if "$DEBUG" || awaitHealthCheck "$CONTAINER"; then successful="true" fi + echo "" + echo "[info][quick] printing dev-debug-function-order.log" + docker exec -it "$CONTAINER" cat "dev-debug-function-order.log" || true + echo "" + echo "[info][quick] printing dev-debug.log" + docker exec -it "$CONTAINER" cat "dev-debug.log" || true + echo "" stopContainer "$CONTAINER" if "$LOGS"; then printf "[info][quick] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" - printf "[info][quick] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq || true)" elif ! "$successful"; then printf "[info][quick] logs:\n%s\n" "$(docker logs -n 20 "$CONTAINER" 2>&1 || true)" - printf "[info][quick] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq || true)" fi + printf "[info][quick] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq | sed 's/\\r/\n/g' | sed 's/\\n/\n/g' || true)" + done removeContainer "$CONTAINER" From fcc54402dd2300d4d6762e291ac28220b63c8df9 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 27 Feb 2022 00:22:49 +0100 Subject: [PATCH 079/116] fix exit code, dependency installation --- commands/lgsm-load-config | 2 +- commands/lgsm-set-steam-credentials | 0 setup/createAlias.sh | 2 ++ setup/entrypoint.sh | 14 +++++++++++--- setup/installDependencies.sh | 14 ++++++-------- setup/installMinimalDependencies.sh | 1 + tests/full.sh | 29 ++++++++++++++++++----------- tests/internal/api_various.sh | 2 +- tests/quick.sh | 15 +++++++++++++-- 9 files changed, 53 insertions(+), 26 deletions(-) create mode 100644 commands/lgsm-set-steam-credentials diff --git a/commands/lgsm-load-config b/commands/lgsm-load-config index 2063010..01163e5 100755 --- a/commands/lgsm-load-config +++ b/commands/lgsm-load-config @@ -40,7 +40,7 @@ function sed_sanitize() { #local sanitized="${sanitized//\{/\\\\{}" # { need to be escaped local sanitized="${sanitized//[/\\[}" # [ need to be escaped local sanitized="${sanitized//&/\\&}" # & need to be escaped - local sanitized="${sanitized//*/\\*}" # * need to be escaped + local sanitized="${sanitized//\*/\\\*}" # * need to be escaped echo "$sanitized" } diff --git a/commands/lgsm-set-steam-credentials b/commands/lgsm-set-steam-credentials new file mode 100644 index 0000000..e69de29 diff --git a/setup/createAlias.sh b/setup/createAlias.sh index 90ed280..453e628 100755 --- a/setup/createAlias.sh +++ b/setup/createAlias.sh @@ -25,7 +25,9 @@ function createAlias() { #!/bin/sh echo '$name' >> "\$LGSM_CURRENT_COMMAND" gosu "\$USER_NAME" "$command" "$name" "\$@" + exitcode="\$?" sed -i '/^$name$/d' "\$LGSM_CURRENT_COMMAND" + exit "\$exitcode" EOM chmod a=rx "$file" # create 2nd link for better script readability diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index 5444511..de02bba 100755 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -55,21 +55,29 @@ while "$is_running"; do echo "$line" done < tmux.pipe echo "[info][entrypoint] server stopped" - + errorcode="1" is_running="false" + + # check if server is stopped on purpose current_running_lgsm_alias="$(< "$LGSM_CURRENT_COMMAND")" for lgsm_cmd in monitor update restart force-update validate; do if grep -qe "$lgsm_cmd" <<< "$current_running_lgsm_alias"; then echo "[info][entrypoint] lgsm command \"$lgsm_cmd\" is being executed and is permitted to stop the server, reattaching to tmux" + errorcode="0" is_running="true" + lgsm-start fi done - # e.g. cod4server will fail on first start + # retry in first 60s, e.g. cod4server needs a second try current_time="$(date +'%s')" if ! "$is_running" && [ "$((current_time - first_start))" -lt "60" ]; then echo "[warning][entrypoint] server crashed within 60 seconds, restarting" + errorcode="0" + is_running="true" + lgsm-start fi done rm "$LGSM_STARTED" > /dev/null 2>&1 || true -echo "[info][entrypoint] entrypoint ended" +echo "[info][entrypoint] entrypoint ended with exitcode=$errorcode" +exit "$errorcode" diff --git a/setup/installDependencies.sh b/setup/installDependencies.sh index b9010b7..d679bc0 100755 --- a/setup/installDependencies.sh +++ b/setup/installDependencies.sh @@ -17,7 +17,7 @@ gosu "$USER_NAME" ./linuxgsm.sh "$server" # maybe add a "./linuxgsm.sh installDependencies" gosu "$USER_NAME" ./"$server" auto-install 2>&1 | tee auto-install.log || true # if not probably dependencies are missing -mapfile -d ";" cmds < <( grep -Ee 'sudo\s\s*(dpkg|apt)' auto-install.log | sed -E 's/\s*sudo\s*//g' | sed 's/install/install -y /g' ) +mapfile -t cmds < <( grep -Eoe 'sudo\s\s*apt\S*\s\s*install.*' auto-install.log | sed -E 's/\s*sudo\s*//g' | sed 's/install/install -y /g' | tr ';' '\n' ) if [ "${#cmds[@]}" -gt "0" ]; then # preselect answers for steam echo steam steam/question select "I AGREE" | debconf-set-selections #"# ide fix @@ -25,21 +25,19 @@ if [ "${#cmds[@]}" -gt "0" ]; then # install dependencies echo "[info][installDependencies] installing dependencies:" + if grep -qe ':i386' <<< "${cmds[@]}"; then + dpkg --add-architecture i386 + fi apt-get update + set -x for cmd in "${cmds[@]}"; do - echo "[info][installDependencies] $cmd" + echo "[info][installDependencies] >$cmd<" if eval "DEBIAN_FRONTEND=noninteractive $cmd"; then echo "[info][installDependencies] successful!" - elif grep -qe ':i386' <<< "$cmd"; then - echo "[info][installDependencies] retry" - dpkg --add-architecture i386 - apt-get update - eval "DEBIAN_FRONTEND=noninteractive $cmd" else echo "[error][installDependencies] failed" exit 10 fi - apt-get update done else echo "[error][installDependencies] Couldn't extract missing dependencies, its very unlikely that everything is already installed. Printing debug information:" diff --git a/setup/installMinimalDependencies.sh b/setup/installMinimalDependencies.sh index a2f6135..531b353 100755 --- a/setup/installMinimalDependencies.sh +++ b/setup/installMinimalDependencies.sh @@ -17,6 +17,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ iproute2 \ jq \ locales \ + tmux \ unzip \ wget localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 diff --git a/tests/full.sh b/tests/full.sh index b690972..5ac85ba 100755 --- a/tests/full.sh +++ b/tests/full.sh @@ -9,6 +9,7 @@ ROOT_FOLDER="$(realpath "$(dirname "$0")/..")" PARRALEL="$(lscpu -p | grep -Ev '^#' | sort -u -t, -k 2,4 | wc -l)" IMAGE="gameservermanagers/linuxgsm-docker" FLAKY="1" +LOG_DEBUG="false" RERUN="false" SUFFIX="" VOLUMES="false" @@ -24,13 +25,14 @@ while [ $# -ge 1 ]; do echo "[help][full] full.sh [option] [server]" echo "[help][full] " echo "[help][full] options:" - echo "[help][full] -c --cpus x run x servers in parralel, default x = physical cores" - echo "[help][full] --image x set target image" - echo "[help][full] --flaky x test for flaky results x times, x should be greater as 1" - echo "[help][full] --rerun check results and runs every gameserver which wasn't successful" - echo "[help][full] --suffix suffix to add to every image" - echo "[help][full] --volumes use volumes \"linuxgsm-SERVERCODE\"" - echo "[help][full] -v --version x use linuxgsm version x e.g. \"v21.4.1\"" + echo "[help][full] -c --cpus x run x servers in parralel, default x = physical cores" + echo "[help][full] -d --log-debug IMPORTANT: logs will leak your steam credentials!" + echo "[help][full] --image x set target image" + echo "[help][full] --flaky x test for flaky results x times, x should be greater as 1" + echo "[help][full] --rerun check results and runs every gameserver which wasn't successful" + echo "[help][full] --suffix suffix to add to every image" + echo "[help][full] --volumes use volumes \"linuxgsm-SERVERCODE\"" + echo "[help][full] -v --version x use linuxgsm version x e.g. \"v21.4.1\"" echo "[help][full] " echo "[help][full] " echo "[help][full] server:" @@ -40,6 +42,8 @@ while [ $# -ge 1 ]; do -c|--cpus) PARRALEL="$1" shift;; + -d|--log-debug) + LOG_DEBUG="true";; --image) IMAGE="$1" shift;; @@ -143,6 +147,9 @@ for run in $(seq 1 "$FLAKY"); do if "$VOLUMES"; then quick+=(--volume "linuxgsm-$server_code") fi + if "$LOG_DEBUG"; then + quick+=(--log-debug) + fi quick+=("$server_code") echo "${quick[@]}" @@ -152,11 +159,11 @@ for run in $(seq 1 "$FLAKY"); do fi # sanitize secrets in log like used steamuser / steampass - if [ -n "$steam_test_username" ]; then - sed -i "s/$(sed_sanitize "$steam_test_username")/SECRET_USERNAME/g" "$RESULTS/$server_code.log" - fi if [ -n "$steam_test_password" ]; then - sed -i "s/$(sed_sanitize "$steam_test_password")/SECRET_PASSWORD/g" "$RESULTS/$server_code.log" + sed -i "s/$(sed_sanitize "$steam_test_password")/SECRET_PASSWORD/g" "$RESULTS/$server_code.log" > /dev/null 2>&1 || true + fi + if [ -n "$steam_test_username" ]; then + sed -i "s/$(sed_sanitize "$steam_test_username")/SECRET_USERNAME/g" "$RESULTS/$server_code.log" > /dev/null 2>&1 || true fi if "$is_successful"; then diff --git a/tests/internal/api_various.sh b/tests/internal/api_various.sh index 754061a..5c50d19 100755 --- a/tests/internal/api_various.sh +++ b/tests/internal/api_various.sh @@ -31,6 +31,6 @@ function sed_sanitize() { #local sanitized="${sanitized//\{/\\\\{}" # { need to be escaped local sanitized="${sanitized//[/\\[}" # [ need to be escaped local sanitized="${sanitized//&/\\&}" # & need to be escaped - local sanitized="${sanitized//*/\\*}" # * need to be escaped + local sanitized="${sanitized//\*/\\\*}" # * need to be escaped echo "$sanitized" } \ No newline at end of file diff --git a/tests/quick.sh b/tests/quick.sh index ec8d98d..f912075 100755 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -16,6 +16,7 @@ source "$(dirname "$0")/steam_test_credentials" LOGS="false" +LOG_DEBUG="false" DEBUG="false" IMAGE="gameservermanagers/linuxgsm-docker" RETRY="1" @@ -36,7 +37,8 @@ while [ $# -ge 1 ]; do echo "[help][quick] -c --no-cache run without docker cache" echo "[help][quick] -d --debug run gameserver and overwrite entrypoint to bash" echo "[help][quick] --image x target image" - echo "[help][quick] -l --logs print last log lines after run" + echo "[help][quick] -l --logs print complete docker log afterwards" + echo "[help][quick] --log-debug enables LGSM_DEBUG, log can contain your steam credentials, dont share it!" echo "[help][quick] --retry if run failed, rebuild and rerun up to 3 times" echo "[help][quick] --skip-lgsm skip build lgsm" echo "[help][quick] --very-fast overwrite healthcheck, only use it with volumes / lancache because container will else fail pretty fast" @@ -55,6 +57,8 @@ while [ $# -ge 1 ]; do shift;; -l|--logs) LOGS="true";; + --log-debug) + LOG_DEBUG="true";; --retry) RETRY="3";; --skip-lgsm) @@ -98,10 +102,13 @@ fi CONTAINER="linuxgsm-$GAMESERVER" build+=(--image "$IMAGE" --latest "$GAMESERVER") -run+=(--image "$IMAGE" --tag "$GAMESERVER" --container "$CONTAINER" -e LGSM_DEBUG="true") +run+=(--image "$IMAGE" --tag "$GAMESERVER" --container "$CONTAINER") if ! "$DEBUG"; then run+=(--detach) fi +if "$LOG_DEBUG"; then + run+=(-e LGSM_DEBUG="true") +fi function handleInterrupt() { removeContainer "$CONTAINER" @@ -124,13 +131,17 @@ trap handleInterrupt SIGTERM SIGINT if "$DEBUG" || awaitHealthCheck "$CONTAINER"; then successful="true" fi + echo "" echo "[info][quick] printing dev-debug-function-order.log" docker exec -it "$CONTAINER" cat "dev-debug-function-order.log" || true + stty sane echo "" echo "[info][quick] printing dev-debug.log" docker exec -it "$CONTAINER" cat "dev-debug.log" || true echo "" + stty sane + stopContainer "$CONTAINER" if "$LOGS"; then printf "[info][quick] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" From 07603afab453ac468cca0a53f460bc19dcc5a503 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 4 Apr 2022 22:56:01 +0200 Subject: [PATCH 080/116] feat: ubuntu 22.04 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e64d62a..67cc99a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # download / build / verify dependencies # own stage = additional deps needed which are only here used -FROM ubuntu:20.04 as dependencyStage +FROM ubuntu:22.04 as dependencyStage COPY setup/installGosu.sh \ setup/installSupercronic.sh \ From 93d0c4f7dd1588a290ba8a465b74fc91587bae60 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Fri, 8 Apr 2022 22:12:59 +0200 Subject: [PATCH 081/116] doc: build arg error message + rustserver compose --- Dockerfile | 2 +- docker-compose.yaml | 28 ++++++++++++++++++---------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 67cc99a..70e1149 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,7 +70,7 @@ WORKDIR "$LGSM_PATH" # install server specific dependencies FROM linuxgsm as specific ARG ARG_LGSM_GAMESERVER="" -ENV LGSM_GAMESERVER="${ARG_LGSM_GAMESERVER:?}" +ENV LGSM_GAMESERVER="${ARG_LGSM_GAMESERVER:? To build the container by hand you need to set build argument ARG_LGSM_GAMESERVER to your desired servercode}" RUN set -eux; \ installDependencies.sh "$LGSM_GAMESERVER"; \ createAlias.sh "$LGSM_GAMESERVER"; \ diff --git a/docker-compose.yaml b/docker-compose.yaml index 69f793d..a728c3e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,13 +2,21 @@ volumes: server: services: - linuxgsm: - build: - context: . - args: - LGSM_GAMESERVER: gmodserver - volumes: - - server:/home/linuxgsm - - /etc/localtime:/etc/localtime:ro - restart: always - tty: true + linuxgsm: + build: + context: . + args: + ARG_LGSM_GAMESERVER: rustserver + volumes: + - server:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + tty: true + environment: + - USER_ID=${PUID:-1000} + - GROUP_ID=${PGID:-1000} + ports: + - "28010:28010/tcp" + - "28010:28010/udp" + - "28011:28011/udp" + - "28082:28082/udp" + restart: unless-stopped From 610a1d41bf3260ed9a6074c287da7c0ce3d2a260 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 9 Apr 2022 17:34:25 +0200 Subject: [PATCH 082/116] fix: ubuntu 22.04 only set on one stage --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 70e1149..259e084 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN set -eux; \ # create linuxgsm image # this stage should be usable by existing developers -FROM ubuntu:20.04 as linuxgsm +FROM ubuntu:22.04 as linuxgsm ARG ARG_LGSM_VERSION="master" ENV LGSM_VERSION="${ARG_LGSM_VERSION:?}" \ From aeb01924bc1deab6951346c41fefa126dff04dd9 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 10 Apr 2022 00:08:42 +0200 Subject: [PATCH 083/116] feat: print console.log if initial start fails --- setup/entrypoint.sh | 9 +++++++-- tests/quick.sh | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh index de02bba..ada103d 100755 --- a/setup/entrypoint.sh +++ b/setup/entrypoint.sh @@ -6,7 +6,7 @@ set -o nounset if "$LGSM_DEBUG"; then set -o xtrace touch ".dev-debug" - rm dev-debug*.log || true # remove from last execution + rm dev-debug*.log > /dev/null 2>&1 || true # remove from last execution else rm ".dev-debug" || true fi @@ -38,7 +38,12 @@ else fi lgsm-load-config -lgsm-start +lgsm-start || ( + exitcode="$?" + echo "[error][entrypoint] initial start failed, printing console.log" + cat "$LGSM_PATH/log/console/$LGSM_GAMESERVER-console.log" || true + exit "$exitcode" +) trap lgsm-stop SIGTERM SIGINT lgsm-cron-start > /dev/null 2>&1 & touch "$LGSM_STARTED" diff --git a/tests/quick.sh b/tests/quick.sh index f912075..e70e59e 100755 --- a/tests/quick.sh +++ b/tests/quick.sh @@ -56,7 +56,8 @@ while [ $# -ge 1 ]; do IMAGE="$1" shift;; -l|--logs) - LOGS="true";; + LOGS="true" + LOG_DEBUG="true";; --log-debug) LOG_DEBUG="true";; --retry) From 046dbdccc1a557b0ad464f8c487ed860e3954d1c Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 10 Apr 2022 00:09:04 +0200 Subject: [PATCH 084/116] fix: openssl 1.1n missing --- Dockerfile | 7 ++++++- setup/installOpenSSL_1.1n.sh | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 setup/installOpenSSL_1.1n.sh diff --git a/Dockerfile b/Dockerfile index 259e084..3bfc20e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,12 +3,14 @@ FROM ubuntu:22.04 as dependencyStage COPY setup/installGosu.sh \ + setup/installOpenSSL_1.1n.sh \ setup/installSupercronic.sh \ / RUN chmod +x installGosu.sh RUN set -eux; \ ./installGosu.sh 1.14; \ - ./installSupercronic.sh v0.1.12 8d3a575654a6c93524c410ae06f681a3507ca5913627fa92c7086fd140fa12ce + ./installSupercronic.sh v0.1.12 8d3a575654a6c93524c410ae06f681a3507ca5913627fa92c7086fd140fa12ce; \ + ./installOpenSSL_1.1n.sh # create linuxgsm image # this stage should be usable by existing developers @@ -39,6 +41,9 @@ COPY --from=dependencyStage \ /usr/local/bin/gosu \ /usr/local/bin/supercronic \ /usr/local/bin/ +COPY --from=dependencyStage \ + /usr/local/lib \ + /usr/local/lib/ COPY setup/installMinimalDependencies.sh \ setup/setupUser.sh \ setup/installLGSM.sh \ diff --git a/setup/installOpenSSL_1.1n.sh b/setup/installOpenSSL_1.1n.sh new file mode 100644 index 0000000..b3a0686 --- /dev/null +++ b/setup/installOpenSSL_1.1n.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -euo pipefail +version="1.1.1n" +package="1748639999ed79b998e4fe4a6d292ed8e874736a" + +apt-get update +apt-get install -y python3-pip +pip3 install conan +conan profile new default --detect +conan profile update settings.compiler.libcxx=libstdc++11 default +conan download -p "$package" "openssl/$version@_/_" + +( + cd ~/".conan/data/openssl/$version/_/_/package/$package/lib/" + cp *.so "/usr/local/lib" + cd "/usr/local/lib" + for file in *.so; do + mv "$file" "$file.1.1" + done +) +# reindex with: ldconfig /usr/local/lib +# ldd *.so should be fine and ldconfig -p should list the so From c3660d72f211b21eb7a3f01cbd62085a659c88b3 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 10 Apr 2022 03:38:14 +0200 Subject: [PATCH 085/116] fix: openssl x86 instead of x64 for svenserver --- setup/installOpenSSL_1.1n.sh | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/setup/installOpenSSL_1.1n.sh b/setup/installOpenSSL_1.1n.sh index b3a0686..e9957cc 100644 --- a/setup/installOpenSSL_1.1n.sh +++ b/setup/installOpenSSL_1.1n.sh @@ -2,22 +2,13 @@ set -euo pipefail version="1.1.1n" -package="1748639999ed79b998e4fe4a6d292ed8e874736a" apt-get update -apt-get install -y python3-pip -pip3 install conan +apt-get install -y python3-pip gcc-multilib +pip3 install --force-reinstall conan conan profile new default --detect conan profile update settings.compiler.libcxx=libstdc++11 default -conan download -p "$package" "openssl/$version@_/_" - -( - cd ~/".conan/data/openssl/$version/_/_/package/$package/lib/" - cp *.so "/usr/local/lib" - cd "/usr/local/lib" - for file in *.so; do - mv "$file" "$file.1.1" - done -) +conan install -if "$(mktemp -d)" -s arch=x86 -s arch_build=x86 --build=missing -o openssl:shared=True "openssl/$version@_/_" +cp -vf ~/.conan/data/openssl/"$version"/_/_/package/*/lib/*.so.1.1 "/usr/local/lib" # reindex with: ldconfig /usr/local/lib # ldd *.so should be fine and ldconfig -p should list the so From 0d063f437f9aeb7b432c33ecfb472d50719c8c1c Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 10 Apr 2022 16:02:02 +0200 Subject: [PATCH 086/116] doc: docker-compose update --- docker-compose.yaml | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index a728c3e..f4e7d5f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,22 +1,45 @@ -volumes: - server: - +# usage: +# docker-compose up -d csgo +# docker-compose up -d rust +# +# VERSION: +# current pull request: 4b399fa6c5b735eb6b8207f7ba40b476fa667987 # https://github.com/GameServerManagers/LinuxGSM/pull/3836/commits +# jusito/develop fork for lgsm: 33285c77caad5af04a5f374c078e1040e69518c3 +# official: master services: - linuxgsm: + rust: build: context: . args: + ARG_LGSM_VERSION: 33285c77caad5af04a5f374c078e1040e69518c3 ARG_LGSM_GAMESERVER: rustserver - volumes: - - server:/home/linuxgsm - - /etc/localtime:/etc/localtime:ro tty: true - environment: - - USER_ID=${PUID:-1000} - - GROUP_ID=${PGID:-1000} + restart: unless-stopped ports: - "28010:28010/tcp" - "28010:28010/udp" - "28011:28011/udp" - "28082:28082/udp" + volumes: + - server:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + + csgo: + build: + context: . + args: + ARG_LGSM_VERSION: 33285c77caad5af04a5f374c078e1040e69518c3 + ARG_LGSM_GAMESERVER: csgoserver + tty: true restart: unless-stopped + ports: + - "27015:27015/udp" + - "27015:27015/tcp" + - "27020:27020/udp" + - "27005:27005/udp" + volumes: + - server:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + +volumes: + server: From 5680475988862984dbb0e016f8f723dbf8afe717 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 30 Apr 2022 19:00:24 +0200 Subject: [PATCH 087/116] renaming --- tests/{full.sh => multiple.sh} | 0 tests/{quick.sh => single.sh} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename tests/{full.sh => multiple.sh} (100%) rename tests/{quick.sh => single.sh} (100%) diff --git a/tests/full.sh b/tests/multiple.sh similarity index 100% rename from tests/full.sh rename to tests/multiple.sh diff --git a/tests/quick.sh b/tests/single.sh similarity index 100% rename from tests/quick.sh rename to tests/single.sh From 0dce0f0be3e2e881c592d726d0c11fc100a4a829 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 4 Jun 2022 00:56:18 +0200 Subject: [PATCH 088/116] fix logging --- tests/multiple.sh | 60 +++++++++++++++++++++++------------------------ tests/single.sh | 58 ++++++++++++++++++++++----------------------- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/tests/multiple.sh b/tests/multiple.sh index 5ac85ba..b6b94f3 100755 --- a/tests/multiple.sh +++ b/tests/multiple.sh @@ -21,23 +21,23 @@ while [ $# -ge 1 ]; do case "$key" in -h|--help) - echo "[help][full] testing every feature of specified server" - echo "[help][full] full.sh [option] [server]" - echo "[help][full] " - echo "[help][full] options:" - echo "[help][full] -c --cpus x run x servers in parralel, default x = physical cores" - echo "[help][full] -d --log-debug IMPORTANT: logs will leak your steam credentials!" - echo "[help][full] --image x set target image" - echo "[help][full] --flaky x test for flaky results x times, x should be greater as 1" - echo "[help][full] --rerun check results and runs every gameserver which wasn't successful" - echo "[help][full] --suffix suffix to add to every image" - echo "[help][full] --volumes use volumes \"linuxgsm-SERVERCODE\"" - echo "[help][full] -v --version x use linuxgsm version x e.g. \"v21.4.1\"" - echo "[help][full] " - echo "[help][full] " - echo "[help][full] server:" - echo "[help][full] *empty* test every server" - echo "[help][full] gmodserver ... run only given servers" + echo "[help][multiple] testing every feature of specified server" + echo "[help][multiple] full.sh [option] [server]" + echo "[help][multiple] " + echo "[help][multiple] options:" + echo "[help][multiple] -c --cpus x run x servers in parralel, default x = physical cores" + echo "[help][multiple] -d --log-debug IMPORTANT: logs will leak your steam credentials!" + echo "[help][multiple] --image x set target image" + echo "[help][multiple] --flaky x test for flaky results x times, x should be greater as 1" + echo "[help][multiple] --rerun check results and runs every gameserver which wasn't successful" + echo "[help][multiple] --suffix suffix to add to every image" + echo "[help][multiple] --volumes use volumes \"linuxgsm-SERVERCODE\"" + echo "[help][multiple] -v --version x use linuxgsm version x e.g. \"v21.4.1\"" + echo "[help][multiple] " + echo "[help][multiple] " + echo "[help][multiple] server:" + echo "[help][multiple] *empty* test every server" + echo "[help][multiple] gmodserver ... run only given servers" exit 0;; -c|--cpus) PARRALEL="$1" @@ -62,17 +62,17 @@ while [ $# -ge 1 ]; do shift;; *) if grep -qE '^-' <<< "$key"; then - echo "[error][full] unknown option $key" + echo "[error][multiple] unknown option $key" exit 1 else - echo "[info][full] only testing servercode \"$key\"" + echo "[info][multiple] only testing servercode \"$key\"" fi GAMESERVER+=("$key");; esac done testAllServer="$([ "${#GAMESERVER[@]}" = "0" ] && echo true || echo false )" if [ "$(whoami)" = "root" ]; then - echo "[error][full] please dont execute me as root, iam invoking linuxgsm.sh directly and this will not work as root" + echo "[error][multiple] please dont execute me as root, iam invoking linuxgsm.sh directly and this will not work as root" exit 1 fi @@ -105,9 +105,9 @@ for run in $(seq 1 "$FLAKY"); do ( if "$RERUN" || [ "$run" -gt "1" ]; then - echo "[info][full] skipping building linuxgsm because rerun" + echo "[info][multiple] skipping building linuxgsm because rerun" else - echo "[info][full] building linuxgsm base once" + echo "[info][multiple] building linuxgsm base once" ./tests/internal/build.sh --version "$VERSION" --image "$IMAGE" --latest --suffix "$SUFFIX" fi @@ -141,7 +141,7 @@ for run in $(seq 1 "$FLAKY"); do testThisServercode="$( ("$testAllServer" || "$isServercodeInServerlist") && echo true || echo false )" rerunIsFine="$( ( ! "$RERUN" || "$serverDidntStartSuccessful" ) && echo true || echo false )" if "$testThisServercode" && "$rerunIsFine"; then - echo "[info][full] testing: $server_code" + echo "[info][multiple] testing: $server_code" ( quick=(./tests/quick.sh --logs --version "$VERSION" --image "$IMAGE" --skip-lgsm --suffix "$SUFFIX") if "$VOLUMES"; then @@ -188,28 +188,28 @@ for run in $(seq 1 "$FLAKY"); do subprocesses=("${temp[@]}") done - echo "[info][full] successful: $(find "$RESULTS/" -iname "successful.*" | wc -l)" - echo "[info][full] failed: $(find "$RESULTS/" -iname "failed.*" | wc -l)" + echo "[info][multiple] successful: $(find "$RESULTS/" -iname "successful.*" | wc -l)" + echo "[info][multiple] failed: $(find "$RESULTS/" -iname "failed.*" | wc -l)" mapfile -t failed_credentials_missing < <(grep --include "*failed*" -rlF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) - echo "[info][full] failed - unset steam credentials: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_credentials_missing[@]}" | tr '\n' ' ' || true)" + echo "[info][multiple] failed - unset steam credentials: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_credentials_missing[@]}" | tr '\n' ' ' || true)" # print filenames + very high line number to jump right at eof on click if IDE supports it printf '%s\n' "${failed_credentials_missing[@]/%/:100000}" mapfile -t failed_other < <(grep --include "*failed*" -rLF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) - echo "[info][full] failed - other error: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_other[@]}" | tr '\n' ' ' || true)" + echo "[info][multiple] failed - other error: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_other[@]}" | tr '\n' ' ' || true)" printf '%s\n' "${failed_other[@]/%/:100000}" echo "" - echo "[info][full] searching in log for command errors \"command not found\" please add this as minimal dependency!" + echo "[info][multiple] searching in log for command errors \"command not found\" please add this as minimal dependency!" grep -rnF 'command not found' "$RESULTS" || true echo "" - echo "[info][full] searching in log for errors where health check got SIGKILL" + echo "[info][multiple] searching in log for errors where health check got SIGKILL" grep -rnF '"ExitCode": 137' "$RESULTS" || true echo "" - echo "[info][full] log contains message \"provide content log to LinuxGSM developers\"" + echo "[info][multiple] log contains message \"provide content log to LinuxGSM developers\"" grep -rnF 'LinuxGSM developers' "$RESULTS" || true ) done diff --git a/tests/single.sh b/tests/single.sh index e70e59e..7a3b9cd 100755 --- a/tests/single.sh +++ b/tests/single.sh @@ -30,22 +30,22 @@ while [ $# -ge 1 ]; do case "$key" in -h|--help) - echo "[help][quick] quick testing of provided gameserver" - echo "[help][quick] quick.sh [option] server" - echo "[help][quick] " - echo "[help][quick] options:" - echo "[help][quick] -c --no-cache run without docker cache" - echo "[help][quick] -d --debug run gameserver and overwrite entrypoint to bash" - echo "[help][quick] --image x target image" - echo "[help][quick] -l --logs print complete docker log afterwards" - echo "[help][quick] --log-debug enables LGSM_DEBUG, log can contain your steam credentials, dont share it!" - echo "[help][quick] --retry if run failed, rebuild and rerun up to 3 times" - echo "[help][quick] --skip-lgsm skip build lgsm" - echo "[help][quick] --very-fast overwrite healthcheck, only use it with volumes / lancache because container will else fail pretty fast" - echo "[help][quick] --version x use linuxgsm version x e.g. \"v21.4.1\"" - echo "[help][quick] --volume x use volume x e.g. \"lgsm\"" - echo "[help][quick] " - echo "[help][quick] server e.g. gmodserver" + echo "[help][single] quick testing of provided gameserver" + echo "[help][single] quick.sh [option] server" + echo "[help][single] " + echo "[help][single] options:" + echo "[help][single] -c --no-cache run without docker cache" + echo "[help][single] -d --debug run gameserver and overwrite entrypoint to bash" + echo "[help][single] --image x target image" + echo "[help][single] -l --logs print complete docker log afterwards" + echo "[help][single] --log-debug enables LGSM_DEBUG, log can contain your steam credentials, dont share it!" + echo "[help][single] --retry if run failed, rebuild and rerun up to 3 times" + echo "[help][single] --skip-lgsm skip build lgsm" + echo "[help][single] --very-fast overwrite healthcheck, only use it with volumes / lancache because container will else fail pretty fast" + echo "[help][single] --version x use linuxgsm version x e.g. \"v21.4.1\"" + echo "[help][single] --volume x use volume x e.g. \"lgsm\"" + echo "[help][single] " + echo "[help][single] server e.g. gmodserver" exit 0;; -c|--no-cache) build+=(--no-cache);; @@ -80,25 +80,25 @@ while [ $# -ge 1 ]; do if [ -z "$GAMESERVER" ]; then GAMESERVER="$key" else - echo "[info][quick] additional argument to docker: \"$key\"" + echo "[info][single] additional argument to docker: \"$key\"" run+=("$key") fi;; esac done if [ -z "$GAMESERVER" ]; then - echo "[error][quick] no gameserver provided" + echo "[error][single] no gameserver provided" exit 1 elif grep -qEe "(^|\s)$GAMESERVER(\s|$)" <<< "${credentials_enabled[@]}"; then - echo "[info][quick] $GAMESERVER can only be tested with steam credential" + echo "[info][single] $GAMESERVER can only be tested with steam credential" if [ -n "$steam_test_username" ] && [ -n "$steam_test_password" ]; then run+=(-e CONFIGFORCED_steamuser="$steam_test_username" -e CONFIGFORCED_steampass="$steam_test_password") else - echo "[error][quick] $GAMESERVER can only be tested with steam credentials, please fill $(realpath "$(dirname "$0")/steam_test_credentials")" + echo "[error][single] $GAMESERVER can only be tested with steam credentials, please fill $(realpath "$(dirname "$0")/steam_test_credentials")" exit 2 fi else - echo "[warning][quick] no steam credentials provided, some servers will fail without it" + echo "[warning][single] no steam credentials provided, some servers will fail without it" fi CONTAINER="linuxgsm-$GAMESERVER" @@ -121,7 +121,7 @@ trap handleInterrupt SIGTERM SIGINT successful="false" try="1" while [ "$try" -le "$RETRY" ] && ! "$successful"; do - echo "[info][quick] try $try" + echo "[info][single] try $try" try="$(( try+1 ))" removeContainer "$CONTAINER" echo "${build[@]}" @@ -134,31 +134,31 @@ trap handleInterrupt SIGTERM SIGINT fi echo "" - echo "[info][quick] printing dev-debug-function-order.log" + echo "[info][single] printing dev-debug-function-order.log" docker exec -it "$CONTAINER" cat "dev-debug-function-order.log" || true stty sane echo "" - echo "[info][quick] printing dev-debug.log" + echo "[info][single] printing dev-debug.log" docker exec -it "$CONTAINER" cat "dev-debug.log" || true echo "" stty sane stopContainer "$CONTAINER" if "$LOGS"; then - printf "[info][quick] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" + printf "[info][single] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" elif ! "$successful"; then - printf "[info][quick] logs:\n%s\n" "$(docker logs -n 20 "$CONTAINER" 2>&1 || true)" + printf "[info][single] logs:\n%s\n" "$(docker logs -n 20 "$CONTAINER" 2>&1 || true)" fi - printf "[info][quick] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq | sed 's/\\r/\n/g' | sed 's/\\n/\n/g' || true)" + printf "[info][single] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq | sed 's/\\r/\n/g' | sed 's/\\n/\n/g' || true)" done removeContainer "$CONTAINER" if "$successful"; then - echo "[info][quick] successful" + echo "[info][single] successful" exit 0 else - echo "[error][quick] failed" + echo "[error][single] failed" exit 1 fi ) From 12aef0a29ea213d48e49c25d0de4843d68cb3f35 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 16 Jul 2022 16:55:46 +0200 Subject: [PATCH 089/116] fix(dependencies): supercronic v0.2.1 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3bfc20e..d223ad0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ COPY setup/installGosu.sh \ RUN chmod +x installGosu.sh RUN set -eux; \ ./installGosu.sh 1.14; \ - ./installSupercronic.sh v0.1.12 8d3a575654a6c93524c410ae06f681a3507ca5913627fa92c7086fd140fa12ce; \ + ./installSupercronic.sh v0.2.1 5eb5e2533fe75acffa63e437c0d8c4cb1f0c96891b84ae10ef4e53d602505f60; \ ./installOpenSSL_1.1n.sh # create linuxgsm image From 1d0b360efcb65d074703aba252f09eb2ad957a7d Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 16 Jul 2022 17:00:38 +0200 Subject: [PATCH 090/116] refactor(structure): clear naming --- .dockerignore | 7 +- .gitignore | 5 +- Dockerfile => build/Dockerfile | 36 ++-- {setup => build}/cleanImage.sh | 0 {setup => build}/createAlias.sh | 0 {setup => build}/entrypoint.sh | 0 {setup => build}/installDependencies.sh | 0 {setup => build}/installGamedig.sh | 0 {setup => build}/installGosu.sh | 0 {setup => build}/installLGSM.sh | 0 .../installMinimalDependencies.sh | 0 {setup => build}/installOpenSSL_1.1n.sh | 0 {setup => build}/installSupercronic.sh | 0 {setup => build}/setupUser.sh | 0 .../docker-compose.yaml | 0 init_dev_environment.sh | 4 +- linuxgsm-docker-build.sh | 4 - linuxgsm-docker.sh | 160 ------------------ {commands => runtime}/lgsm-cron-init | 0 {commands => runtime}/lgsm-cron-start | 0 {commands => runtime}/lgsm-fix-permission | 0 {commands => runtime}/lgsm-init | 0 {commands => runtime}/lgsm-load-config | 0 .../lgsm-set-steam-credentials | 0 {commands => runtime}/lgsm-tmux-attach | 0 {commands => runtime}/lgsm-update-uid-gid | 0 .../compareMultipleResultFolders.sh | 4 +- {tests => test}/features.sh | 0 {tests => test}/features/testCron.sh | 10 +- {tests => test}/features/testDockerLogs.sh | 2 +- .../features/testFixPermissions.sh | 6 +- {tests => test}/features/testLgsmUpdate.sh | 6 +- {tests => test}/features/testLoadConfig.sh | 10 +- {tests => test}/features/testUpdateUidGuid.sh | 4 +- {tests => test}/internal/api_docker.sh | 0 {tests => test}/internal/api_various.sh | 0 {tests => test}/internal/build.sh | 8 +- {tests => test}/internal/run.sh | 0 {tests => test}/multiple.sh | 12 +- {tests => test}/push.sh | 0 {tests => test}/shellcheck.sh | 2 +- {tests => test}/single.sh | 6 +- {tests => test}/steam_test_credentials | 4 +- 43 files changed, 64 insertions(+), 226 deletions(-) rename Dockerfile => build/Dockerfile (78%) rename {setup => build}/cleanImage.sh (100%) rename {setup => build}/createAlias.sh (100%) rename {setup => build}/entrypoint.sh (100%) rename {setup => build}/installDependencies.sh (100%) rename {setup => build}/installGamedig.sh (100%) rename {setup => build}/installGosu.sh (100%) rename {setup => build}/installLGSM.sh (100%) rename {setup => build}/installMinimalDependencies.sh (100%) rename {setup => build}/installOpenSSL_1.1n.sh (100%) rename {setup => build}/installSupercronic.sh (100%) rename {setup => build}/setupUser.sh (100%) rename docker-compose.yaml => examples/docker-compose.yaml (100%) delete mode 100644 linuxgsm-docker-build.sh delete mode 100644 linuxgsm-docker.sh rename {commands => runtime}/lgsm-cron-init (100%) rename {commands => runtime}/lgsm-cron-start (100%) rename {commands => runtime}/lgsm-fix-permission (100%) rename {commands => runtime}/lgsm-init (100%) rename {commands => runtime}/lgsm-load-config (100%) rename {commands => runtime}/lgsm-set-steam-credentials (100%) rename {commands => runtime}/lgsm-tmux-attach (100%) rename {commands => runtime}/lgsm-update-uid-gid (100%) rename {tests => test}/compareMultipleResultFolders.sh (92%) rename {tests => test}/features.sh (100%) rename {tests => test}/features/testCron.sh (82%) rename {tests => test}/features/testDockerLogs.sh (81%) rename {tests => test}/features/testFixPermissions.sh (93%) rename {tests => test}/features/testLgsmUpdate.sh (78%) rename {tests => test}/features/testLoadConfig.sh (94%) rename {tests => test}/features/testUpdateUidGuid.sh (89%) rename {tests => test}/internal/api_docker.sh (100%) rename {tests => test}/internal/api_various.sh (100%) rename {tests => test}/internal/build.sh (96%) rename {tests => test}/internal/run.sh (100%) rename {tests => test}/multiple.sh (95%) rename {tests => test}/push.sh (100%) rename {tests => test}/shellcheck.sh (72%) rename {tests => test}/single.sh (97%) rename {tests => test}/steam_test_credentials (72%) diff --git a/.dockerignore b/.dockerignore index 47a7789..5dcedf5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,8 @@ -tests/ +test/ .gitignore -docker-compose.yml +.editorconfig +examples/ LICENSE linuxgsm-docker.sh -README.md +*.md diff --git a/.gitignore b/.gitignore index 20b27e3..89051c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *~ -tests/*results* +test/*results* **/*.log -tests/steam_test_credentials +test/steam_test_credentials +*.patch \ No newline at end of file diff --git a/Dockerfile b/build/Dockerfile similarity index 78% rename from Dockerfile rename to build/Dockerfile index d223ad0..440fcc1 100644 --- a/Dockerfile +++ b/build/Dockerfile @@ -2,9 +2,9 @@ # own stage = additional deps needed which are only here used FROM ubuntu:22.04 as dependencyStage -COPY setup/installGosu.sh \ - setup/installOpenSSL_1.1n.sh \ - setup/installSupercronic.sh \ +COPY build/installGosu.sh \ + build/installOpenSSL_1.1n.sh \ + build/installSupercronic.sh \ / RUN chmod +x installGosu.sh RUN set -eux; \ @@ -44,22 +44,22 @@ COPY --from=dependencyStage \ COPY --from=dependencyStage \ /usr/local/lib \ /usr/local/lib/ -COPY setup/installMinimalDependencies.sh \ - setup/setupUser.sh \ - setup/installLGSM.sh \ - setup/installGamedig.sh \ - setup/cleanImage.sh \ - setup/installDependencies.sh \ - setup/createAlias.sh \ - setup/entrypoint.sh \ +COPY build/installMinimalDependencies.sh \ + build/setupUser.sh \ + build/installLGSM.sh \ + build/installGamedig.sh \ + build/cleanImage.sh \ + build/installDependencies.sh \ + build/createAlias.sh \ + build/entrypoint.sh \ \ - commands/lgsm-cron-init \ - commands/lgsm-cron-start \ - commands/lgsm-init \ - commands/lgsm-fix-permission \ - commands/lgsm-load-config \ - commands/lgsm-tmux-attach \ - commands/lgsm-update-uid-gid \ + runtime/lgsm-cron-init \ + runtime/lgsm-cron-start \ + runtime/lgsm-init \ + runtime/lgsm-fix-permission \ + runtime/lgsm-load-config \ + runtime/lgsm-tmux-attach \ + runtime/lgsm-update-uid-gid \ "$LGSM_SCRIPTS"/ RUN set -eux; \ diff --git a/setup/cleanImage.sh b/build/cleanImage.sh similarity index 100% rename from setup/cleanImage.sh rename to build/cleanImage.sh diff --git a/setup/createAlias.sh b/build/createAlias.sh similarity index 100% rename from setup/createAlias.sh rename to build/createAlias.sh diff --git a/setup/entrypoint.sh b/build/entrypoint.sh similarity index 100% rename from setup/entrypoint.sh rename to build/entrypoint.sh diff --git a/setup/installDependencies.sh b/build/installDependencies.sh similarity index 100% rename from setup/installDependencies.sh rename to build/installDependencies.sh diff --git a/setup/installGamedig.sh b/build/installGamedig.sh similarity index 100% rename from setup/installGamedig.sh rename to build/installGamedig.sh diff --git a/setup/installGosu.sh b/build/installGosu.sh similarity index 100% rename from setup/installGosu.sh rename to build/installGosu.sh diff --git a/setup/installLGSM.sh b/build/installLGSM.sh similarity index 100% rename from setup/installLGSM.sh rename to build/installLGSM.sh diff --git a/setup/installMinimalDependencies.sh b/build/installMinimalDependencies.sh similarity index 100% rename from setup/installMinimalDependencies.sh rename to build/installMinimalDependencies.sh diff --git a/setup/installOpenSSL_1.1n.sh b/build/installOpenSSL_1.1n.sh similarity index 100% rename from setup/installOpenSSL_1.1n.sh rename to build/installOpenSSL_1.1n.sh diff --git a/setup/installSupercronic.sh b/build/installSupercronic.sh similarity index 100% rename from setup/installSupercronic.sh rename to build/installSupercronic.sh diff --git a/setup/setupUser.sh b/build/setupUser.sh similarity index 100% rename from setup/setupUser.sh rename to build/setupUser.sh diff --git a/docker-compose.yaml b/examples/docker-compose.yaml similarity index 100% rename from docker-compose.yaml rename to examples/docker-compose.yaml diff --git a/init_dev_environment.sh b/init_dev_environment.sh index b53002f..71109a7 100644 --- a/init_dev_environment.sh +++ b/init_dev_environment.sh @@ -21,8 +21,8 @@ tools=(jq) done # don't accidentally commit credentials - git update-index --skip-worktree tests/steam_test_credentials + git update-index --skip-worktree test/steam_test_credentials # fix permissions - find tests/ commands/ setup/ -type f -exec chmod u+x "{}" \; + find test/ runtime/ build/ -type f -exec chmod u+x "{}" \; ) diff --git a/linuxgsm-docker-build.sh b/linuxgsm-docker-build.sh deleted file mode 100644 index 32e458f..0000000 --- a/linuxgsm-docker-build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -## simple building script to create the image/container -sudo docker build -t lgsm-docker . diff --git a/linuxgsm-docker.sh b/linuxgsm-docker.sh deleted file mode 100644 index a62a97f..0000000 --- a/linuxgsm-docker.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/bash - -## can be simplified. - -## name of the docker container -InstanceName='arkserver' -## arkserver for me (it's the script name in the server directory) -# for you need to be the server type name of the LinuxGSM script. -ServerType='arkserver' -## Image name to run (i have build with the lgsm-build.sh) -Img='lgsm-docker' -## current path; plz execute this script from it's folder -Path=$(pwd) -## Set the Network Used by docker -Network='host' -## Set the hostname for the docker container -Hostname='LGSM' -## Set it to False if you don't have a discord custom script like me -DiscordNotifier="false" - -## check if the container already running; return (true or '') -status=$(sudo docker inspect --format="{{.State.Running}}" $InstanceName 2> /dev/null) - -fn_discord_custom_sender(){ - if [ "${DiscordNotifier}" == "true" ] - then - sleep 2 - sudo docker exec ${InstanceName} alert_discord.sh "${cmd}" - fi -} - -## need to be test -fn_exec_cmd_sender(){ - if [ "${1}" == "exec" ] - then - if [ "${2}" == "install" ] - then - sudo docker "${1}" ${InstanceName} bash /home/lgsm/linuxgsm.sh "${3}" - else - sudo docker "${1}" ${InstanceName} ${ServerType} "${2}" "${3}" - fi - else - sudo docker "${1}" ${InstanceName} - fi -} - -fn_command_support(){ - - case ${cmd} in - "install") - if [ "${3}" != "" ] - then - fn_exec_cmd_sender exec install "${3}" - else - # Get List of game server name for install - sudo docker exec ${InstanceName} bash /home/lgsm/linuxgsm.sh install - echo "enter the server name; ctrl+c to cancel" - read -ra type - fn_exec_cmd_sender exec install "${type}" - fi - ;; - - "start") - fn_exec_cmd_sender exec start - fn_discord_custom_sender "${cmd}" - ;; - - "stop") - if [ "$status" == "true" ] - then - fn_exec_cmd_sender exec stop - fn_discord_custom_sender "${cmd}" - sudo docker kill ${InstanceName} - fi - ;; - - "restart") - fn_exec_cmd_sender exec restart - fn_discord_custom_sender "${cmd}" - ;; - - "update") ## update stop the server if is already running(lgsm script). - fn_exec_cmd_sender exec update - fn_discord_custom_sender "${cmd}" - ;; - - "console") - fn_exec_cmd_sender exec console - ;; - - "monitor") - fn_exec_cmd_sender exec monitor - ;; - - "validate") - fn_exec_cmd_sender exec validate - ;; - - "backup") - fn_exec_cmd_sender exec backup - ;; - - "details") - fn_exec_cmd_sender exec details - ;; - - "alerts") - fn_exec_cmd_sender exec alerts - ;; - - "conjob") - crontab -l > CronTemp - echo "* */3 * * * bash ${Path}/linuxgsm-docker.sh command bash check_version.sh >/dev/null 2>&1" >> CronTemp - crontab CronTemp - rm CronTemp - ;; - - "attach") - echo "dettach with ctrl+p & ctrl+q" - fn_exec_cmd_sender attach - ;; - - "command") - ## Need to be test (take all parameter after the first one) - sudo docker exec -it ${InstanceName} "${@:2}" - ;; - - *) - echo "Parameter invalid, exit." - exit 1 - esac - -} - - -## check if the the container already running; if not start it if command is not Stop; -if [ "${status}" != "true" ] && [ "$1" != "stop" ] -then - echo "docker container was not running. start it for you." - sudo docker rm ${InstanceName} 2> /dev/null - sudo docker run --name ${InstanceName} --restart always --net=${Network} --hostname ${Hostname} -it -d -v "/home/lgsm/:/home/lgsm" ${Img} bash 2> /dev/null -elif [ "${status}" == "true" ] -then - echo "docker container already running, append command." -else - echo "docker container not running." -fi - -## check if we have a parameter -if [ "${#}" -gt 0 ] -then - cmd=${1} - fn_command_support "${cmd}" "${2}" -else - echo $"Usage: $0 {start|stop|restart|console|monitor|update|backup|details|alerts|cronjob|attach|command|install}" - read -ra cmd - fn_command_support "${cmd}" "${2}" -fi - -#sudo docker run --name arkserver --rm -it -d -v "/home/lgsm/:/home/lgsm" lgsm-docker bash $@ diff --git a/commands/lgsm-cron-init b/runtime/lgsm-cron-init similarity index 100% rename from commands/lgsm-cron-init rename to runtime/lgsm-cron-init diff --git a/commands/lgsm-cron-start b/runtime/lgsm-cron-start similarity index 100% rename from commands/lgsm-cron-start rename to runtime/lgsm-cron-start diff --git a/commands/lgsm-fix-permission b/runtime/lgsm-fix-permission similarity index 100% rename from commands/lgsm-fix-permission rename to runtime/lgsm-fix-permission diff --git a/commands/lgsm-init b/runtime/lgsm-init similarity index 100% rename from commands/lgsm-init rename to runtime/lgsm-init diff --git a/commands/lgsm-load-config b/runtime/lgsm-load-config similarity index 100% rename from commands/lgsm-load-config rename to runtime/lgsm-load-config diff --git a/commands/lgsm-set-steam-credentials b/runtime/lgsm-set-steam-credentials similarity index 100% rename from commands/lgsm-set-steam-credentials rename to runtime/lgsm-set-steam-credentials diff --git a/commands/lgsm-tmux-attach b/runtime/lgsm-tmux-attach similarity index 100% rename from commands/lgsm-tmux-attach rename to runtime/lgsm-tmux-attach diff --git a/commands/lgsm-update-uid-gid b/runtime/lgsm-update-uid-gid similarity index 100% rename from commands/lgsm-update-uid-gid rename to runtime/lgsm-update-uid-gid diff --git a/tests/compareMultipleResultFolders.sh b/test/compareMultipleResultFolders.sh similarity index 92% rename from tests/compareMultipleResultFolders.sh rename to test/compareMultipleResultFolders.sh index 7ca9590..d814981 100644 --- a/tests/compareMultipleResultFolders.sh +++ b/test/compareMultipleResultFolders.sh @@ -22,13 +22,13 @@ echo "" echo "$servercode flaky result" for result in "${successful[@]}" "${failed[@]}"; do - echo "./tests/${result//.\//}:10000" + echo "./test/${result//.\//}:10000" done elif [ "${#successful[@]}" -eq "0" ]; then echo "" echo "$servercode always failing" for result in "${successful[@]}" "${failed[@]}"; do - echo "./tests/${result//.\//}:10000" + echo "./test/${result//.\//}:10000" done fi done diff --git a/tests/features.sh b/test/features.sh similarity index 100% rename from tests/features.sh rename to test/features.sh diff --git a/tests/features/testCron.sh b/test/features/testCron.sh similarity index 82% rename from tests/features/testCron.sh rename to test/features/testCron.sh index 611c291..9da83d5 100755 --- a/tests/features/testCron.sh +++ b/test/features/testCron.sh @@ -8,7 +8,7 @@ set -o pipefail GAMESERVER="$2" VOLUME="$3" CONTAINER="linuxgsm-$GAMESERVER-testCron" -# shellcheck source=tests/internal/api_docker.sh +# shellcheck source=test/internal/api_docker.sh source "$(dirname "$0")/../internal/api_docker.sh" ( @@ -33,7 +33,7 @@ source "$(dirname "$0")/../internal/api_docker.sh" # initial run = no cron removeContainer "$CONTAINER" - ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" + ./test/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" if awaitHealthCheck "$CONTAINER"; then if [ "0" != "$(docker exec -it "$CONTAINER" cat "$DOCKERFILE_CRONLOCATION" | wc -l)" ]; then log "successful no cron job found" @@ -47,7 +47,7 @@ source "$(dirname "$0")/../internal/api_docker.sh" # inject one cron CRON_TEST1="* * * * * echo \"hello world1\"" removeContainer "$CONTAINER" - ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_test1=$CRON_TEST1" + ./test/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_test1=$CRON_TEST1" if awaitHealthCheck "$CONTAINER"; then crontab="$(docker exec -it "$CONTAINER" cat "$DOCKERFILE_CRONLOCATION")" if [ "2" != "$(echo "$crontab" | wc -l)" ]; then @@ -64,7 +64,7 @@ source "$(dirname "$0")/../internal/api_docker.sh" # inject multiple cron CRON_TEST2="* * * * * echo \"hello world2\"" removeContainer "$CONTAINER" - ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_test1=$CRON_TEST1" "-e" "CRON_test2=$CRON_TEST2" + ./test/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_test1=$CRON_TEST1" "-e" "CRON_test2=$CRON_TEST2" if awaitHealthCheck "$CONTAINER"; then crontab="$(docker exec -it "$CONTAINER" cat "$DOCKERFILE_CRONLOCATION")" if [ "3" != "$(echo "$crontab" | wc -l)" ]; then @@ -90,7 +90,7 @@ source "$(dirname "$0")/../internal/api_docker.sh" # fail for illegal cron job removeContainer "$CONTAINER" - ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_illegal=* * * * echo \"hello illegal\"" + ./test/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" "-e" "CRON_illegal=* * * * echo \"hello illegal\"" if ! awaitHealthCheck "$CONTAINER"; then log "successfully tested illegal cronjob" else diff --git a/tests/features/testDockerLogs.sh b/test/features/testDockerLogs.sh similarity index 81% rename from tests/features/testDockerLogs.sh rename to test/features/testDockerLogs.sh index 22c4292..ede6d9d 100755 --- a/tests/features/testDockerLogs.sh +++ b/test/features/testDockerLogs.sh @@ -12,7 +12,7 @@ VOLUME="$3" log="$(realpath "$(dirname "$0")")/testDockerLogs.log" cd "$(dirname "$0")/../.." - ./tests/quick.sh --very-fast --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" + ./test/quick.sh --very-fast --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" if grep -qE 'VAC\s*secure\s*mode\s*is\s*activated.' "$log"; then rm "$log" echo "[info][testDockerLogs] successful" diff --git a/tests/features/testFixPermissions.sh b/test/features/testFixPermissions.sh similarity index 93% rename from tests/features/testFixPermissions.sh rename to test/features/testFixPermissions.sh index 2cdeb77..8329a19 100755 --- a/tests/features/testFixPermissions.sh +++ b/test/features/testFixPermissions.sh @@ -10,9 +10,9 @@ GAMESERVER="$2" VOLUME="$3" uid="750" gid="750" -# shellcheck source=tests/internal/api_docker.sh +# shellcheck source=test/internal/api_docker.sh source "$(dirname "$0")/../internal/api_docker.sh" -# shellcheck source=tests/internal/api_various.sh +# shellcheck source=test/internal/api_various.sh source "$(dirname "$0")/../internal/api_various.sh" ( @@ -38,7 +38,7 @@ source "$(dirname "$0")/../internal/api_various.sh" fi } - if ./tests/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER"; then + if ./test/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER"; then permission="$("${dockerRun[@]}" alpine ls -l "$newFile")" owner="$("${dockerRun[@]}" alpine ls -l "$newFile")" if ! grep -qE '^.rw.r..---' <<< "$permission"; then diff --git a/tests/features/testLgsmUpdate.sh b/test/features/testLgsmUpdate.sh similarity index 78% rename from tests/features/testLgsmUpdate.sh rename to test/features/testLgsmUpdate.sh index 79881ed..d7bb304 100755 --- a/tests/features/testLgsmUpdate.sh +++ b/test/features/testLgsmUpdate.sh @@ -11,7 +11,7 @@ VOLUME="$3" ( cd "$(dirname "$0")/../.." - ./tests/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./test/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" log_downgrade="downgrade.log" log_update="upgrade.log" @@ -29,11 +29,11 @@ VOLUME="$3" } # old versions are allowed to fail, as long as log contains the expected entry - ./tests/quick.sh --very-fast --logs --version "$OLD_VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_downgrade" || true + ./test/quick.sh --very-fast --logs --version "$OLD_VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_downgrade" || true if ! grep -qF '[lgsm-init] force uninstall lgsm' "$log_downgrade"; then log "downgrading from \"$VERSION\" to \"$OLD_VERSION\" successful but container didn't forcefully uninstalled lgsm" 21 - elif ! ./tests/quick.sh --very-fast --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_update"; then + elif ! ./test/quick.sh --very-fast --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_update"; then log "upgrading from \"$OLD_VERSION\" to \"$VERSION\" failed" 22 elif ! grep -qF '[lgsm-init] force uninstall lgsm' "$log_update"; then diff --git a/tests/features/testLoadConfig.sh b/test/features/testLoadConfig.sh similarity index 94% rename from tests/features/testLoadConfig.sh rename to test/features/testLoadConfig.sh index e1901f4..e463fc2 100755 --- a/tests/features/testLoadConfig.sh +++ b/test/features/testLoadConfig.sh @@ -4,7 +4,7 @@ set -o errexit set -o nounset set -o pipefail -# shellcheck source=tests/internal/api_docker.sh +# shellcheck source=test/internal/api_docker.sh source "$(dirname "$0")/../internal/api_docker.sh" #VERSION="$1" @@ -32,7 +32,7 @@ configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" # test valid CONFIG_ -> common.cfg maxbackups="$RANDOM" removeContainer "$CONTAINER" - ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" \ + ./test/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" \ -e CONFIG_maxbackups="$maxbackups" if awaitHealthCheck "$CONTAINER"; then log "container started with maxbackups injected" @@ -49,7 +49,7 @@ configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" # test steam credentials with CONFIGFORCED_ -> common.cfg (two different usages) # using slightly different keys because illegal credentials will break the container removeContainer "$CONTAINER" - ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" \ + ./test/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" \ -e CONFIGFORCED_steamuser_test="new Steam User" -e "CONFIGFORCED_steampass_test=new Steam Password" if awaitHealthCheck "$CONTAINER"; then log "container started with steam credentials injected" @@ -67,7 +67,7 @@ configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" # test overwriting lgsm common.cfg on every start removeContainer "$CONTAINER" - ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" + ./test/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" if awaitHealthCheck "$CONTAINER"; then log "container started, checking if common.cfg is overwritten" common_cfg="$("${inContainer[@]}" cat "$configfile_common" || true)" @@ -84,7 +84,7 @@ configfile_common="/home/linuxgsm/lgsm/config-lgsm/$GAMESERVER/common.cfg" # test illegal CONFIG_ value which isn't part of _default.cfg -> expecting crash removeContainer "$CONTAINER" - ./tests/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" \ + ./test/internal/run.sh --container "$CONTAINER" --detach --quick --volume "$VOLUME" --tag "$GAMESERVER" \ -e CONFIG_steamuser_illegal="newSteamUser" if ! awaitHealthCheck "$CONTAINER"; then log "container didn't start with illegal CONFIG value \"steamuser_illegal\"" diff --git a/tests/features/testUpdateUidGuid.sh b/test/features/testUpdateUidGuid.sh similarity index 89% rename from tests/features/testUpdateUidGuid.sh rename to test/features/testUpdateUidGuid.sh index 6942023..27740c9 100755 --- a/tests/features/testUpdateUidGuid.sh +++ b/test/features/testUpdateUidGuid.sh @@ -12,7 +12,7 @@ gid="750" ( cd "$(dirname "$0")/../.." - ./tests/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./test/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" function log() { if [ -n "${2:-}" ]; then @@ -35,7 +35,7 @@ gid="750" log "precondition successful" fi - ./tests/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" -e "USER_ID=1234" -e "GROUP_ID=5678" + ./test/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" -e "USER_ID=1234" -e "GROUP_ID=5678" if [ "0" != "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | wc -l )" ]; then log "update failed, there are files in \"$VOLUME\" which aren't owned by user \"1234\"" 22 "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | tail)" diff --git a/tests/internal/api_docker.sh b/test/internal/api_docker.sh similarity index 100% rename from tests/internal/api_docker.sh rename to test/internal/api_docker.sh diff --git a/tests/internal/api_various.sh b/test/internal/api_various.sh similarity index 100% rename from tests/internal/api_various.sh rename to test/internal/api_various.sh diff --git a/tests/internal/build.sh b/test/internal/build.sh similarity index 96% rename from tests/internal/build.sh rename to test/internal/build.sh index 8050961..ef26752 100755 --- a/tests/internal/build.sh +++ b/test/internal/build.sh @@ -4,9 +4,9 @@ set -o errexit set -o pipefail set -o nounset -# shellcheck source=tests/internal/api_docker.sh +# shellcheck source=test/internal/api_docker.sh source "$(dirname "$0")/api_docker.sh" -# shellcheck source=tests/internal/api_various.sh +# shellcheck source=test/internal/api_various.sh source "$(dirname "$0")/api_various.sh" server="" @@ -17,8 +17,8 @@ suffix="" lgsm_version="master" lgsm_tags_latest=() -build_lgsm=(docker build) -build_specific=(docker build) +build_lgsm=(docker build -f build/Dockerfile) +build_specific=("${build_lgsm[@]}") while [ $# -ge 1 ]; do key="$1" shift diff --git a/tests/internal/run.sh b/test/internal/run.sh similarity index 100% rename from tests/internal/run.sh rename to test/internal/run.sh diff --git a/tests/multiple.sh b/test/multiple.sh similarity index 95% rename from tests/multiple.sh rename to test/multiple.sh index b6b94f3..03977d5 100755 --- a/tests/multiple.sh +++ b/test/multiple.sh @@ -76,14 +76,14 @@ if [ "$(whoami)" = "root" ]; then exit 1 fi -# shellcheck source=tests/internal/api_various.sh +# shellcheck source=test/internal/api_various.sh source "$(dirname "$0")/internal/api_various.sh" -# shellcheck source=tests/steam_test_credentials +# shellcheck source=test/steam_test_credentials source "$(dirname "$0")/steam_test_credentials" for run in $(seq 1 "$FLAKY"); do # prepare results folder - RESULTS="$ROOT_FOLDER/tests/results" + RESULTS="$ROOT_FOLDER/test/results" # for multiple runs move previous results folder if [ "$FLAKY" != "1" ] && [ "$run" -gt "1" ]; then rm -rf "$RESULTS.$((run-1))" > /dev/null 2>&1 @@ -108,7 +108,7 @@ for run in $(seq 1 "$FLAKY"); do echo "[info][multiple] skipping building linuxgsm because rerun" else echo "[info][multiple] building linuxgsm base once" - ./tests/internal/build.sh --version "$VERSION" --image "$IMAGE" --latest --suffix "$SUFFIX" + ./test/internal/build.sh --version "$VERSION" --image "$IMAGE" --latest --suffix "$SUFFIX" fi subprocesses=() @@ -143,7 +143,7 @@ for run in $(seq 1 "$FLAKY"); do if "$testThisServercode" && "$rerunIsFine"; then echo "[info][multiple] testing: $server_code" ( - quick=(./tests/quick.sh --logs --version "$VERSION" --image "$IMAGE" --skip-lgsm --suffix "$SUFFIX") + quick=(./test/quick.sh --logs --version "$VERSION" --image "$IMAGE" --skip-lgsm --suffix "$SUFFIX") if "$VOLUMES"; then quick+=(--volume "linuxgsm-$server_code") fi @@ -217,6 +217,6 @@ done if [ "$FLAKY" != "1" ]; then ( cd "$ROOT_FOLDER" - ./tests/compareMultipleResultFolders.sh + ./test/compareMultipleResultFolders.sh ) fi diff --git a/tests/push.sh b/test/push.sh similarity index 100% rename from tests/push.sh rename to test/push.sh diff --git a/tests/shellcheck.sh b/test/shellcheck.sh similarity index 72% rename from tests/shellcheck.sh rename to test/shellcheck.sh index cbab9a0..617be55 100755 --- a/tests/shellcheck.sh +++ b/test/shellcheck.sh @@ -7,7 +7,7 @@ set -o nounset cd "$(dirname "$0")/.." files=() - mapfile -d $'\0' files < <( find commands setup tests -type f ! -iname "*.log" ! -iname "*.yml" -print0 ) + mapfile -d $'\0' files < <( find runtime build test -type f ! -iname "*.log" ! -iname "*.yml" -print0 ) echo "[info][shellcheck] testing on ${#files[@]} files" diff --git a/tests/single.sh b/test/single.sh similarity index 97% rename from tests/single.sh rename to test/single.sh index 7a3b9cd..7dcb2a0 100755 --- a/tests/single.sh +++ b/test/single.sh @@ -6,11 +6,11 @@ set -o pipefail cd "$(dirname "$0")/.." -# shellcheck source=tests/internal/api_docker.sh +# shellcheck source=test/internal/api_docker.sh source "$(dirname "$0")/internal/api_docker.sh" -# shellcheck source=tests/internal/api_various.sh +# shellcheck source=test/internal/api_various.sh source "$(dirname "$0")/internal/api_various.sh" -# shellcheck source=tests/steam_test_credentials +# shellcheck source=test/steam_test_credentials source "$(dirname "$0")/steam_test_credentials" diff --git a/tests/steam_test_credentials b/test/steam_test_credentials similarity index 72% rename from tests/steam_test_credentials rename to test/steam_test_credentials index 79dda78..74ed2ae 100644 --- a/tests/steam_test_credentials +++ b/test/steam_test_credentials @@ -1,8 +1,8 @@ #!/bin/bash # exclude from git with: -# git update-index --skip-worktree tests/steam_test_credentials +# git update-index --skip-worktree test/steam_test_credentials # revert: -# git update-index --no-skip-worktree tests/steam_test_credentials +# git update-index --no-skip-worktree test/steam_test_credentials #shellcheck disable=SC2034 # used elsewhere steam_test_username="" #shellcheck disable=SC2034 # used elsewhere From 376e768248d444eb7c2841b46750023a780e7de4 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 16 Jul 2022 17:42:55 +0200 Subject: [PATCH 091/116] doc: preparing docs --- DEVELOPER.md | 41 +++++++++++++++++++++++++++++++++++++++++ README.md | 18 +++++++++++++++++- test/testing.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 DEVELOPER.md create mode 100644 test/testing.md diff --git a/DEVELOPER.md b/DEVELOPER.md new file mode 100644 index 0000000..9a107ca --- /dev/null +++ b/DEVELOPER.md @@ -0,0 +1,41 @@ +# Overview for developers and consumers of the image + +Repository contains: +- docker build scripts `/build` +- runtime scripts `/runtime` +- test scripts `/test` + +## repository folder structure + +- `/runtime` runtime functionality intended to be used by extending dockerimages and available in PATH + - refered as `commands` of the dockerimage + - `lgsm-update-uid-gid` update uid / gid of lgsm user and all owned files + - `lgsm-fix-permission` resets all file permissions in volume + - `lgsm-init` resets linuxgsm.sh in volume and install _servercode_.sh + - `lgsm-cron-init` + - `lgsm-cron-start` + - `lgsm-tmux-attach` + - `lgsm-COMMAND` and `COMMAND` where command is an available lgsm command, e.g. details, monitor, install, aso. + - `lgsm-load-config` _alpha state_ updates gameconfig according to environment variables + +- `/build` build functionionality sometimes usable by extending dockerimages + - `installMinimalDependencies.sh` install minimal dependencies needed for build / runtime scripts + - `cleanImage.sh` clean and shrink dockerimage, e.g. remove apt cache and build scripts + - `entrypoint.sh` entrypoint for linuxgsm images, also example how the commands can be used. Expected to be executed as root with access to gosu. + - `setupUser.sh` create linuxgsm user + - `createAlias.sh` creates all alias for `lgsm-COMMAND` and `COMMAND` + - `installDependencies.sh` use linuxgsm to install needed dependencies + - `installGamedig.sh` install nodejs and recent gamedig + - `installGosu.sh` install Gosu to `/usr/local/bin/gosu` + - `installOpenSSL_1.1n.sh` + - `installLGSM.sh` + +## dockerimage folder structure + +- `/home/linuxgsm/` + - home folder of linuxgsm user + - volume for linuxgsm installation +- `/home/linuxgsm-scripts` + - contains all scripts and links and is part of PATH variable, so all scripts are directly accessible from everywhere + - initial linuxgsm.sh + - links to lgsm commands like `lgsm-monitor` which is identical to `monitor` \ No newline at end of file diff --git a/README.md b/README.md index cee8c83..289cb35 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,24 @@ A dockerised version of LinuxGSM https://linuxgsm.com Dockerhub https://hub.docker.com/r/gameservermanagers/linuxgsm-docker/ -# How to Use +## How to use: +1. There are prebuild images, if you think you need to build it yourself have a look at [testing readme](./test/testing.md) + + + + +- `/tests` + - `steam_test_credentials` some servers need credentials here, currently steam guard is not supported + - `single.sh` test a single servercode + - `multiple.sh` test multiple servercodes at once + + + + + +1. Pick your servercode e.g. `rustserver` +2. Pick ports needed ## Create Persistant Storage Game servers require persistant storage to store the server files and configs. The docker reccomended way is to use Persistant storage diff --git a/test/testing.md b/test/testing.md new file mode 100644 index 0000000..c2399e1 --- /dev/null +++ b/test/testing.md @@ -0,0 +1,46 @@ +# Overview of testing + +- all scripts supporting `-h or --help` for all options, here are only most important explained +- Wherever available `--version commit/tag/branch` can be: + - empty to take recent lgsm master branch + - a lgsm tag like `v22.1.0` + - a commit id of official lgsm repository + - a commit id of your _fork_ + +- Do you want to test a single servercode? E.g. to test a patch affecting just one server. + - `./single.sh [--volume v] [--version commit/tag/branch] servercode` + - testing a single servercode, e.g. if current is working or for testing your lgsm fork +- Do you want to test multiple or all servercodes? E.g. you refactoring code affecting multiple or all + - `./multiple.sh [--version commit/tag/branch] [servercode1 servercode2 ...]` + - if no servercode is provided every servercode is tested! + - needs lots of cpu / ram / network / time, maybe you want to run it in background: + 1. create a script `tmux.sh` with content: + ```bash + #!/bin/bash + ./test/multiple.sh --version v22.1.0 --log-debug + ``` + 2. invoke it `tmux new -d -s lgsm-testing bash tmux.sh // TODO: should work without extra script, maybe add option to scripts? + + +## Examples: + +### I just want to build this image, how? + +`./single.sh servercode` + +### I created a lgsm fork and want to test it + +1. You have created a fork +2. You have commited and pushed your changes to your repository +3. Get your commit id with `git log` e.g. `0dce0f0be3e2e881c592d726d0c11fc100a4a829` +4. You are in the root of this repository + - Do your changes affact just a single servercode? E.g. you provided a new one or you patched one + - `./single.sh --version 0dce0f0be3e2e881c592d726d0c11fc100a4a829 servercode` + - Do your changes affect all servercodes? + - `./multiple.sh --version 0dce0f0be3e2e881c592d726d0c11fc100a4a829` + +#### My test was not successful, how to debug? + +`./single.sh --version 0dce0f0be3e2e881c592d726d0c11fc100a4a829 --debug servercode` +1. Image will be build and entrypoint is overwritten to bash +2. Therefore entrypoint.sh is not executed and you are in the volume location \ No newline at end of file From fec88b541f74fae2a347764c05a554085cac55ba Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 16 Jul 2022 17:49:21 +0200 Subject: [PATCH 092/116] test: debug-utils --- .../compare_multiple_result_folders.sh} | 2 +- test/debug-utils/extract_health_check.sh | 15 +++++++++++++++ test/multiple.sh | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) rename test/{compareMultipleResultFolders.sh => debug-utils/compare_multiple_result_folders.sh} (97%) create mode 100644 test/debug-utils/extract_health_check.sh diff --git a/test/compareMultipleResultFolders.sh b/test/debug-utils/compare_multiple_result_folders.sh similarity index 97% rename from test/compareMultipleResultFolders.sh rename to test/debug-utils/compare_multiple_result_folders.sh index d814981..a19a41c 100644 --- a/test/compareMultipleResultFolders.sh +++ b/test/debug-utils/compare_multiple_result_folders.sh @@ -1,7 +1,7 @@ #!/bin/bash ( - cd "$(dirname "$0")" + cd "$(dirname "$0")/.." mapfile -t results_folder < <(find "." -maxdepth 1 -type d -iname "results*") diff --git a/test/debug-utils/extract_health_check.sh b/test/debug-utils/extract_health_check.sh new file mode 100644 index 0000000..828f3ee --- /dev/null +++ b/test/debug-utils/extract_health_check.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -euo pipefail + +folder="${1:?}" +code="${2:-""}" + +mapfile -t results < <(find "$folder" -type f -iname "*.log" | sort) +for log in "${results[@]}"; do + if [ -z "$code" ] || grep -qe "$code." <<< "$log"; then + echo "" + echo "$log:10000" + grep -Poe '(?<="Output": ").*' "$log" | sed -E 's/u001b\[[0-9a-z ]*//g' | sed 's/\\r/\n/g' | sed 's/\\n/\n/g' || true + fi +done diff --git a/test/multiple.sh b/test/multiple.sh index 03977d5..372828c 100755 --- a/test/multiple.sh +++ b/test/multiple.sh @@ -217,6 +217,6 @@ done if [ "$FLAKY" != "1" ]; then ( cd "$ROOT_FOLDER" - ./test/compareMultipleResultFolders.sh + ./test/debug-utils/compare_multiple_result_folders.sh ) fi From 01a0b5d728fb4cd9f6d52329e8920a15b4a1034c Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 16 Jul 2022 18:16:00 +0200 Subject: [PATCH 093/116] doc: relocated entrypoint --- build/Dockerfile | 2 +- {build => runtime}/entrypoint.sh | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {build => runtime}/entrypoint.sh (100%) diff --git a/build/Dockerfile b/build/Dockerfile index 440fcc1..45f7c40 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -51,8 +51,8 @@ COPY build/installMinimalDependencies.sh \ build/cleanImage.sh \ build/installDependencies.sh \ build/createAlias.sh \ - build/entrypoint.sh \ \ + runtime/entrypoint.sh \ runtime/lgsm-cron-init \ runtime/lgsm-cron-start \ runtime/lgsm-init \ diff --git a/build/entrypoint.sh b/runtime/entrypoint.sh similarity index 100% rename from build/entrypoint.sh rename to runtime/entrypoint.sh From 4fab05bc9c17f443984dc4690b84114312bf8e3a Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 16 Jul 2022 18:24:45 +0200 Subject: [PATCH 094/116] doc: renamed scripts --- build/{installDependencies.sh => installServerDependencies.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename build/{installDependencies.sh => installServerDependencies.sh} (100%) diff --git a/build/installDependencies.sh b/build/installServerDependencies.sh similarity index 100% rename from build/installDependencies.sh rename to build/installServerDependencies.sh From b2709201db762595e72a425e32c85cc8e798a307 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 16 Jul 2022 20:55:32 +0200 Subject: [PATCH 095/116] doc: general addition --- DEVELOPER.md | 43 ++++++++++------------- build/Dockerfile | 4 +-- build/cleanImage.sh | 3 ++ build/createAlias.sh | 3 ++ build/installMinimalDependencies.sh | 2 ++ build/setupUser.sh | 2 ++ {test => deploy}/push.sh | 0 test/internal/api_various.sh | 2 ++ test/internal/build.sh | 2 +- test/internal/run.sh | 6 +++- test/multiple.sh | 12 +++---- test/single.sh | 54 +++++++++++++++++------------ test/testing.md | 3 +- 13 files changed, 77 insertions(+), 59 deletions(-) rename {test => deploy}/push.sh (100%) diff --git a/DEVELOPER.md b/DEVELOPER.md index 9a107ca..28213a3 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -1,34 +1,26 @@ # Overview for developers and consumers of the image +If you want to work on this files at all, check/use: `init_dev_environment.sh`. E.g. it will check for tools you need or prevent your steam credentials to be committed + Repository contains: -- docker build scripts `/build` -- runtime scripts `/runtime` +- docker build scripts `/build`, sometimes usable by extending dockerimages +- runtime scripts `/runtime`, intended to be used by extending dockerimages and available in PATH - test scripts `/test` -## repository folder structure +Please check and use its telling you if you need to install tools and prevents commiting your steam credentials by accident. + +## features -- `/runtime` runtime functionality intended to be used by extending dockerimages and available in PATH - - refered as `commands` of the dockerimage - - `lgsm-update-uid-gid` update uid / gid of lgsm user and all owned files +- lgsm commands are available in PATH so you can directly use them e.g. `lgsm-update` which is the same as `update` +- We are using [Gosu](https://github.com/tianon/gosu) so entrypoint is executed as root but every command is executed with lower user privilege. + - Because the commands take care of gosu, you can use `lgsm-update` in your custom scripts as root and the command will take care of correct user + - Also works if you are using: `docker exec -it CONTAINER update` +- `/runtime` contains scripts(refered to as commands of the image) which provide standard functions, also available in PATH so you can directly invoke them - `lgsm-fix-permission` resets all file permissions in volume - - `lgsm-init` resets linuxgsm.sh in volume and install _servercode_.sh - - `lgsm-cron-init` - - `lgsm-cron-start` - - `lgsm-tmux-attach` - - `lgsm-COMMAND` and `COMMAND` where command is an available lgsm command, e.g. details, monitor, install, aso. - - `lgsm-load-config` _alpha state_ updates gameconfig according to environment variables - -- `/build` build functionionality sometimes usable by extending dockerimages - - `installMinimalDependencies.sh` install minimal dependencies needed for build / runtime scripts - - `cleanImage.sh` clean and shrink dockerimage, e.g. remove apt cache and build scripts - - `entrypoint.sh` entrypoint for linuxgsm images, also example how the commands can be used. Expected to be executed as root with access to gosu. - - `setupUser.sh` create linuxgsm user - - `createAlias.sh` creates all alias for `lgsm-COMMAND` and `COMMAND` - - `installDependencies.sh` use linuxgsm to install needed dependencies - - `installGamedig.sh` install nodejs and recent gamedig - - `installGosu.sh` install Gosu to `/usr/local/bin/gosu` - - `installOpenSSL_1.1n.sh` - - `installLGSM.sh` + - `lgsm-update-uid-gid` update uid / gid of lgsm user and all owned files + - `lgsm-init` resets linuxgsm.sh in volume and installs _servercode_.sh + - Cron job handling via Supercronic `lgsm-cron-init` `lgsm-cron-start` +- _alpha state_ `lgsm-load-config` updates gameconfig according to environment variables ## dockerimage folder structure @@ -38,4 +30,5 @@ Repository contains: - `/home/linuxgsm-scripts` - contains all scripts and links and is part of PATH variable, so all scripts are directly accessible from everywhere - initial linuxgsm.sh - - links to lgsm commands like `lgsm-monitor` which is identical to `monitor` \ No newline at end of file + - links to lgsm commands like `lgsm-monitor` which is identical to `monitor` + diff --git a/build/Dockerfile b/build/Dockerfile index 45f7c40..1887ced 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -49,7 +49,7 @@ COPY build/installMinimalDependencies.sh \ build/installLGSM.sh \ build/installGamedig.sh \ build/cleanImage.sh \ - build/installDependencies.sh \ + build/installServerDependencies.sh \ build/createAlias.sh \ \ runtime/entrypoint.sh \ @@ -77,7 +77,7 @@ FROM linuxgsm as specific ARG ARG_LGSM_GAMESERVER="" ENV LGSM_GAMESERVER="${ARG_LGSM_GAMESERVER:? To build the container by hand you need to set build argument ARG_LGSM_GAMESERVER to your desired servercode}" RUN set -eux; \ - installDependencies.sh "$LGSM_GAMESERVER"; \ + installServerDependencies.sh "$LGSM_GAMESERVER"; \ createAlias.sh "$LGSM_GAMESERVER"; \ cleanImage.sh diff --git a/build/cleanImage.sh b/build/cleanImage.sh index dc99c78..8de2dd4 100755 --- a/build/cleanImage.sh +++ b/build/cleanImage.sh @@ -1,5 +1,8 @@ #!/bin/sh +# clean/shrink dockerimage and removes unnecessary files +# e.g. remove apt cache and build scripts + set -o errexit set -o nounset if "$LGSM_DEBUG"; then diff --git a/build/createAlias.sh b/build/createAlias.sh index 453e628..0ba7605 100755 --- a/build/createAlias.sh +++ b/build/createAlias.sh @@ -1,4 +1,7 @@ #!/bin/bash + +# creates all alias for `lgsm-COMMAND` and `COMMAND` in /home/linuxgsm-scripts($LGSM_SCRIPTS) which are available in PATH + LGSM_GAMESERVER="$1" if [ -z "$LGSM_GAMESERVER" ]; then echo "[error][createAlias] first argument needs to be target gameserver" diff --git a/build/installMinimalDependencies.sh b/build/installMinimalDependencies.sh index 531b353..a0f2b88 100755 --- a/build/installMinimalDependencies.sh +++ b/build/installMinimalDependencies.sh @@ -1,5 +1,7 @@ #!/bin/sh +# install minimal dependencies needed for build / runtime scripts + set -o errexit set -o nounset if "$LGSM_DEBUG"; then diff --git a/build/setupUser.sh b/build/setupUser.sh index 7b13330..c69596d 100755 --- a/build/setupUser.sh +++ b/build/setupUser.sh @@ -1,5 +1,7 @@ #!/bin/sh +# create linuxgsm user + set -o errexit set -o nounset if "$LGSM_DEBUG"; then diff --git a/test/push.sh b/deploy/push.sh similarity index 100% rename from test/push.sh rename to deploy/push.sh diff --git a/test/internal/api_various.sh b/test/internal/api_various.sh index 5c50d19..b0ad9ea 100755 --- a/test/internal/api_various.sh +++ b/test/internal/api_various.sh @@ -1,5 +1,7 @@ #!/bin/bash +DEFAULT_DOCKER_REPOSITORY="gameservermanagers/linuxgsm-docker" + function isEmpty() { [ -z "$1" ] } diff --git a/test/internal/build.sh b/test/internal/build.sh index ef26752..51d6b78 100755 --- a/test/internal/build.sh +++ b/test/internal/build.sh @@ -10,7 +10,7 @@ source "$(dirname "$0")/api_docker.sh" source "$(dirname "$0")/api_various.sh" server="" -image="gameservermanagers/linuxgsm-docker" +image="$DEFAULT_DOCKER_REPOSITORY" latest="false" skip_lgsm="false" suffix="" diff --git a/test/internal/run.sh b/test/internal/run.sh index 15bf6c0..c9b7606 100755 --- a/test/internal/run.sh +++ b/test/internal/run.sh @@ -1,8 +1,12 @@ #!/bin/bash + +# shellcheck source=test/internal/api_various.sh +source "$(dirname "$0")/api_various.sh" + TAG="" SUFFIX="" docker_run_mode="-it" -IMAGE="gameservermanagers/linuxgsm-docker" +IMAGE="$DEFAULT_DOCKER_REPOSITORY" container="lgsm-test" run_image=(docker run) diff --git a/test/multiple.sh b/test/multiple.sh index 372828c..08db4b1 100755 --- a/test/multiple.sh +++ b/test/multiple.sh @@ -4,10 +4,15 @@ set -o errexit set -o pipefail set -o nounset +# shellcheck source=test/internal/api_various.sh +source "$(dirname "$0")/internal/api_various.sh" +# shellcheck source=test/steam_test_credentials +source "$(dirname "$0")/steam_test_credentials" + ROOT_FOLDER="$(realpath "$(dirname "$0")/..")" PARRALEL="$(lscpu -p | grep -Ev '^#' | sort -u -t, -k 2,4 | wc -l)" -IMAGE="gameservermanagers/linuxgsm-docker" +IMAGE="$DEFAULT_DOCKER_REPOSITORY" FLAKY="1" LOG_DEBUG="false" RERUN="false" @@ -76,11 +81,6 @@ if [ "$(whoami)" = "root" ]; then exit 1 fi -# shellcheck source=test/internal/api_various.sh -source "$(dirname "$0")/internal/api_various.sh" -# shellcheck source=test/steam_test_credentials -source "$(dirname "$0")/steam_test_credentials" - for run in $(seq 1 "$FLAKY"); do # prepare results folder RESULTS="$ROOT_FOLDER/test/results" diff --git a/test/single.sh b/test/single.sh index 7dcb2a0..3bf2807 100755 --- a/test/single.sh +++ b/test/single.sh @@ -18,9 +18,10 @@ source "$(dirname "$0")/steam_test_credentials" LOGS="false" LOG_DEBUG="false" DEBUG="false" -IMAGE="gameservermanagers/linuxgsm-docker" +IMAGE="$DEFAULT_DOCKER_REPOSITORY" RETRY="1" GAMESERVER="" +BUILD_ONLY="false" build=(./internal/build.sh) run=(./internal/run.sh) @@ -35,6 +36,7 @@ while [ $# -ge 1 ]; do echo "[help][single] " echo "[help][single] options:" echo "[help][single] -c --no-cache run without docker cache" + echo "[help][single] -b --build-only just build it" echo "[help][single] -d --debug run gameserver and overwrite entrypoint to bash" echo "[help][single] --image x target image" echo "[help][single] -l --logs print complete docker log afterwards" @@ -49,6 +51,8 @@ while [ $# -ge 1 ]; do exit 0;; -c|--no-cache) build+=(--no-cache);; + -b|--build-only) + BUILD_ONLY="true";; -d|--debug) run+=(--debug) DEBUG="true";; @@ -126,31 +130,35 @@ trap handleInterrupt SIGTERM SIGINT removeContainer "$CONTAINER" echo "${build[@]}" "${build[@]}" - echo "${run[@]}" | sed -E 's/(steamuser|steampass)=\S+/\1="xxx"/g' - "${run[@]}" - if "$DEBUG" || awaitHealthCheck "$CONTAINER"; then + if "$BUILD_ONLY"; then successful="true" + else + echo "${run[@]}" | sed -E 's/(steamuser|steampass)=\S+/\1="xxx"/g' + "${run[@]}" + + if "$DEBUG" || awaitHealthCheck "$CONTAINER"; then + successful="true" + fi + + echo "" + echo "[info][single] printing dev-debug-function-order.log" + docker exec -it "$CONTAINER" cat "dev-debug-function-order.log" || true + stty sane + echo "" + echo "[info][single] printing dev-debug.log" + docker exec -it "$CONTAINER" cat "dev-debug.log" || true + echo "" + stty sane + + stopContainer "$CONTAINER" + if "$LOGS"; then + printf "[info][single] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" + elif ! "$successful"; then + printf "[info][single] logs:\n%s\n" "$(docker logs -n 20 "$CONTAINER" 2>&1 || true)" + fi + printf "[info][single] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq | sed 's/\\r/\n/g' | sed 's/\\n/\n/g' || true)" fi - - echo "" - echo "[info][single] printing dev-debug-function-order.log" - docker exec -it "$CONTAINER" cat "dev-debug-function-order.log" || true - stty sane - echo "" - echo "[info][single] printing dev-debug.log" - docker exec -it "$CONTAINER" cat "dev-debug.log" || true - echo "" - stty sane - - stopContainer "$CONTAINER" - if "$LOGS"; then - printf "[info][single] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" - elif ! "$successful"; then - printf "[info][single] logs:\n%s\n" "$(docker logs -n 20 "$CONTAINER" 2>&1 || true)" - fi - printf "[info][single] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq | sed 's/\\r/\n/g' | sed 's/\\n/\n/g' || true)" - done removeContainer "$CONTAINER" diff --git a/test/testing.md b/test/testing.md index c2399e1..35c58bf 100644 --- a/test/testing.md +++ b/test/testing.md @@ -1,6 +1,7 @@ # Overview of testing - all scripts supporting `-h or --help` for all options, here are only most important explained +- some servers need [steam credentials](steam_test_credentials) don't commit them and don't share your logs if they are used! - Wherever available `--version commit/tag/branch` can be: - empty to take recent lgsm master branch - a lgsm tag like `v22.1.0` @@ -26,7 +27,7 @@ ### I just want to build this image, how? -`./single.sh servercode` +`./single.sh --build-only --latest servercode` ### I created a lgsm fork and want to test it From b6554929b77dc82b829c5369dea665a3ca041a86 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 16 Jul 2022 20:55:58 +0200 Subject: [PATCH 096/116] test: fix renaming --- test/features.sh | 2 +- test/features/testDockerLogs.sh | 2 +- test/features/testFixPermissions.sh | 2 +- test/features/testLgsmUpdate.sh | 6 +++--- test/features/testUpdateUidGuid.sh | 4 ++-- test/multiple.sh | 2 +- test/single.sh | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/features.sh b/test/features.sh index 008c8b4..7bce6ff 100755 --- a/test/features.sh +++ b/test/features.sh @@ -18,7 +18,7 @@ VOLUME="linuxgsm-$GAMESERVER-testFeatures" if "$CLEAR"; then docker volume rm "$VOLUME" || true fi - ./tests/quick.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./tests/single.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" ./tests/features/testCron.sh "$VERSION" "$GAMESERVER" "$VOLUME" ./tests/features/testDockerLogs.sh "$VERSION" "$GAMESERVER" "$VOLUME" diff --git a/test/features/testDockerLogs.sh b/test/features/testDockerLogs.sh index ede6d9d..1650c47 100755 --- a/test/features/testDockerLogs.sh +++ b/test/features/testDockerLogs.sh @@ -12,7 +12,7 @@ VOLUME="$3" log="$(realpath "$(dirname "$0")")/testDockerLogs.log" cd "$(dirname "$0")/../.." - ./test/quick.sh --very-fast --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" + ./test/single.sh --very-fast --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log" if grep -qE 'VAC\s*secure\s*mode\s*is\s*activated.' "$log"; then rm "$log" echo "[info][testDockerLogs] successful" diff --git a/test/features/testFixPermissions.sh b/test/features/testFixPermissions.sh index 8329a19..1f3af66 100755 --- a/test/features/testFixPermissions.sh +++ b/test/features/testFixPermissions.sh @@ -38,7 +38,7 @@ source "$(dirname "$0")/../internal/api_various.sh" fi } - if ./test/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER"; then + if ./test/single.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER"; then permission="$("${dockerRun[@]}" alpine ls -l "$newFile")" owner="$("${dockerRun[@]}" alpine ls -l "$newFile")" if ! grep -qE '^.rw.r..---' <<< "$permission"; then diff --git a/test/features/testLgsmUpdate.sh b/test/features/testLgsmUpdate.sh index d7bb304..64cea7a 100755 --- a/test/features/testLgsmUpdate.sh +++ b/test/features/testLgsmUpdate.sh @@ -11,7 +11,7 @@ VOLUME="$3" ( cd "$(dirname "$0")/../.." - ./test/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./test/single.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" log_downgrade="downgrade.log" log_update="upgrade.log" @@ -29,11 +29,11 @@ VOLUME="$3" } # old versions are allowed to fail, as long as log contains the expected entry - ./test/quick.sh --very-fast --logs --version "$OLD_VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_downgrade" || true + ./test/single.sh --very-fast --logs --version "$OLD_VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_downgrade" || true if ! grep -qF '[lgsm-init] force uninstall lgsm' "$log_downgrade"; then log "downgrading from \"$VERSION\" to \"$OLD_VERSION\" successful but container didn't forcefully uninstalled lgsm" 21 - elif ! ./test/quick.sh --very-fast --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_update"; then + elif ! ./test/single.sh --very-fast --logs --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" > "$log_update"; then log "upgrading from \"$OLD_VERSION\" to \"$VERSION\" failed" 22 elif ! grep -qF '[lgsm-init] force uninstall lgsm' "$log_update"; then diff --git a/test/features/testUpdateUidGuid.sh b/test/features/testUpdateUidGuid.sh index 27740c9..6dbf560 100755 --- a/test/features/testUpdateUidGuid.sh +++ b/test/features/testUpdateUidGuid.sh @@ -12,7 +12,7 @@ gid="750" ( cd "$(dirname "$0")/../.." - ./test/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./test/single.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" function log() { if [ -n "${2:-}" ]; then @@ -35,7 +35,7 @@ gid="750" log "precondition successful" fi - ./test/quick.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" -e "USER_ID=1234" -e "GROUP_ID=5678" + ./test/single.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" -e "USER_ID=1234" -e "GROUP_ID=5678" if [ "0" != "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | wc -l )" ]; then log "update failed, there are files in \"$VOLUME\" which aren't owned by user \"1234\"" 22 "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | tail)" diff --git a/test/multiple.sh b/test/multiple.sh index 08db4b1..e1936e2 100755 --- a/test/multiple.sh +++ b/test/multiple.sh @@ -143,7 +143,7 @@ for run in $(seq 1 "$FLAKY"); do if "$testThisServercode" && "$rerunIsFine"; then echo "[info][multiple] testing: $server_code" ( - quick=(./test/quick.sh --logs --version "$VERSION" --image "$IMAGE" --skip-lgsm --suffix "$SUFFIX") + quick=(./test/single.sh --logs --version "$VERSION" --image "$IMAGE" --skip-lgsm --suffix "$SUFFIX") if "$VOLUMES"; then quick+=(--volume "linuxgsm-$server_code") fi diff --git a/test/single.sh b/test/single.sh index 3bf2807..a66810d 100755 --- a/test/single.sh +++ b/test/single.sh @@ -31,8 +31,8 @@ while [ $# -ge 1 ]; do case "$key" in -h|--help) - echo "[help][single] quick testing of provided gameserver" - echo "[help][single] quick.sh [option] server" + echo "[help][single] single testing of provided gameserver" + echo "[help][single] single.sh [option] server" echo "[help][single] " echo "[help][single] options:" echo "[help][single] -c --no-cache run without docker cache" From 20aa66de9954303148725a143a7403624033bf48 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 16 Jul 2022 20:56:38 +0200 Subject: [PATCH 097/116] fix: nodejs updated --- build/installGamedig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/installGamedig.sh b/build/installGamedig.sh index 86ab4dd..22cac2c 100755 --- a/build/installGamedig.sh +++ b/build/installGamedig.sh @@ -12,7 +12,7 @@ echo 'tzdata tzdata/Zones/Europe select Berlin' | debconf-set-selections apt-get update DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends xz-utils jq -NODE_VERSION="v16.14.0" +NODE_VERSION="v16.16.0" wget "https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.xz" mkdir -p "/usr/local/lib/nodejs" tar -xJvf "node-$NODE_VERSION-linux-x64.tar.xz" -C "/usr/local/lib/nodejs" From 855b535757922512f7938e3c3f9a3744ffc06895 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 17 Jul 2022 16:57:43 +0200 Subject: [PATCH 098/116] doc: compose examples autogenerated --- README.md | 52 ++-------------- deploy/generateExamples.sh | 114 +++++++++++++++++++++++++++++++++++ examples/docker-compose.yaml | 45 -------------- 3 files changed, 119 insertions(+), 92 deletions(-) create mode 100644 deploy/generateExamples.sh delete mode 100644 examples/docker-compose.yaml diff --git a/README.md b/README.md index 289cb35..c837755 100644 --- a/README.md +++ b/README.md @@ -13,52 +13,10 @@ Dockerhub https://hub.docker.com/r/gameservermanagers/linuxgsm-docker/ ## How to use: -1. There are prebuild images, if you think you need to build it yourself have a look at [testing readme](./test/testing.md) +1. Choose your servercode and replace in below +2. start `docker-compose -f examples/SERVER.yml up -d` +3. get config location `docker exec -it lgsm-SERVER-1 details` +4. copy your own config into: `docker cp my_local_config.txt lgsm-SERVER-1:/config_location_from_step_3` +5. print config content `docker exec lgsm-SERVER-1 cat /config_location_from_step_3` - - -- `/tests` - - `steam_test_credentials` some servers need credentials here, currently steam guard is not supported - - `single.sh` test a single servercode - - `multiple.sh` test multiple servercodes at once - - - - - -1. Pick your servercode e.g. `rustserver` -2. Pick ports needed -## Create Persistant Storage -Game servers require persistant storage to store the server files and configs. The docker reccomended way is to use Persistant storage - -``` -docker volume create csgoserver -``` - -# Install and Start Game server -``` -docker run -d --name csgoserver -v csgoserver --net-host -it -env GAMESERVERNAME=csgoserver gameservermanagers/linuxgsm-docker -``` -# Run LinuxGSM commands -Commands can be run just like standard LinuxGSM using the docker exec command. -``` -docker exec -it csgoserver ./csgoserver details -``` -# Edit LinuxGSM config -To edit the LinuxGSM config files use the following. - -View the default settings -``` -docker exec -it csgoserver nano _default.cfg -``` -Edit LinuxGSM config settings -``` -docker exec -it csgoserver nano common.cfg -``` -Edit Game Server Config settings -To edit the game server config settings run the following. - -``` -docker exec -it csgoserver nano server.cfg -``` diff --git a/deploy/generateExamples.sh b/deploy/generateExamples.sh new file mode 100644 index 0000000..fb18225 --- /dev/null +++ b/deploy/generateExamples.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +version="$1" + +( + cd "$(dirname "$0")/.." + + source "test/internal/api_various.sh" + source "test/internal/api_docker.sh" + image="$DEFAULT_DOCKER_REPOSITORY" + + mapfile -d $'\n' -t servers < <(getServerCodeList "$version") + for server in "${servers[@]}"; do + echo "starting $server" + container="$server-generateExamples" + docker stop "$container" > /dev/null 2>&1 || true + docker rm "$container" > /dev/null 2>&1 || true + + # run it once + run=(./test/internal/run.sh --container "$container" --image "$image" --tag "$server" --detach) + # assuming already build before? Else takes way more time. + #if ! ./test/single.sh --build-only --version "$version" --image "$image" "$server"; then + # echo "build failed, skipping" + # continue + #fi + echo "${run[@]}" + if ! "${run[@]}" > /dev/null; then + echo "run failed, skipping" + continue + fi + + seconds=0 + echo -n "[info][awaitContainerStarted] waiting for $seconds" + while docker exec "$container" ls > /dev/null 2>&1 && ! docker exec "$container" ls "$server" > /dev/null 2>&1; do + sleep 1s # just waiting until linuxgsm is installed + seconds=$((seconds+1)) + echo -en "\r[info][awaitContainerStarted] waiting for $seconds" + done + echo -e "\r[info][awaitContainerStarted] waited for $seconds " + + # get all ports + details="$(docker exec -it "$container" details 2>&1)" + + docker stop "$container" > /dev/null 2>&1 || true + docker rm "$container" > /dev/null 2>&1 || true + + # write docker-compose.yml + compose_file=" +# usage: +# docker-compose -f ./examples/$server.yml up -d +volumes: + serverfiles: + +name: lgsm-$server + +services: + service: + image: \"$image:$server\" + tty: true + restart: unless-stopped + environment: + - \"CRON_update_daily=0 7 * * *\" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro" + echo "$compose_file" > "examples/$server.yml" + + # extract port info + mapfile -t ports < <(echo "$details" | grep -E '^[a-zA-Z0-9_-]+\s+[0-9]+\s+[a-z]+\s+\S+') + if [ "${#ports[@]}" -gt 0 ]; then + echo " ports:" >> "examples/$server.yml" + + # we have ports but maybe they are duplicate + # => we need to merge the desc + already_added="" + for port_i in "${ports[@]}"; do + desc="$(echo "$port_i" | awk '{ print $1 }')" + value="$(echo "$port_i" | awk '{ print $2 }')" + protocol="$(echo "$port_i" | awk '{ print $3 }')" + + merged_desc="$desc" + for port_j in "${ports[@]}"; do + desc_j="$(echo "$port_j" | awk '{ print $1 }')" + value_j="$(echo "$port_j" | awk '{ print $2 }')" + protocol_j="$(echo "$port_j" | awk '{ print $3 }')" + + # port/proto is identical + if [ "$value:$protocol" = "$value_j:$protocol_j" ] && ! grep -q "$desc_j" <<< "$merged_desc"; then + merged_desc="$merged_desc / $desc_j" + fi + done + + if ! grep -q " $value/$protocol " <<< "$already_added"; then + already_added="$already_added $value/$protocol " + echo " # $merged_desc" >> "examples/$server.yml" + echo " - \"$value:$value/$protocol\"" >> "examples/$server.yml" + fi + done + else + echo "# couldn't extract ports, can only provide example how to configure it" >> "examples/$server.yml" + echo "# ports:" >> "examples/$server.yml" + echo "# - \"27015:27015/udp\"" >> "examples/$server.yml" + echo "# - \"27015:27015/tcp\"" >> "examples/$server.yml" + + fi + if grep -q "b" <<< "$server"; then + exit 0 + fi + done +) diff --git a/examples/docker-compose.yaml b/examples/docker-compose.yaml deleted file mode 100644 index f4e7d5f..0000000 --- a/examples/docker-compose.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# usage: -# docker-compose up -d csgo -# docker-compose up -d rust -# -# VERSION: -# current pull request: 4b399fa6c5b735eb6b8207f7ba40b476fa667987 # https://github.com/GameServerManagers/LinuxGSM/pull/3836/commits -# jusito/develop fork for lgsm: 33285c77caad5af04a5f374c078e1040e69518c3 -# official: master -services: - rust: - build: - context: . - args: - ARG_LGSM_VERSION: 33285c77caad5af04a5f374c078e1040e69518c3 - ARG_LGSM_GAMESERVER: rustserver - tty: true - restart: unless-stopped - ports: - - "28010:28010/tcp" - - "28010:28010/udp" - - "28011:28011/udp" - - "28082:28082/udp" - volumes: - - server:/home/linuxgsm - - /etc/localtime:/etc/localtime:ro - - csgo: - build: - context: . - args: - ARG_LGSM_VERSION: 33285c77caad5af04a5f374c078e1040e69518c3 - ARG_LGSM_GAMESERVER: csgoserver - tty: true - restart: unless-stopped - ports: - - "27015:27015/udp" - - "27015:27015/tcp" - - "27020:27020/udp" - - "27005:27005/udp" - volumes: - - server:/home/linuxgsm - - /etc/localtime:/etc/localtime:ro - -volumes: - server: From 7bf7379fc798c2d1d8279809ee7034953cec6112 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 31 Jul 2022 17:39:20 +0200 Subject: [PATCH 099/116] test: support for setting LGSM_{BRANCH,USER,REPO} --- test/multiple.sh | 28 ++++++++++++++++++++++------ test/single.sh | 25 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/test/multiple.sh b/test/multiple.sh index e1936e2..44aec65 100755 --- a/test/multiple.sh +++ b/test/multiple.sh @@ -19,6 +19,10 @@ RERUN="false" SUFFIX="" VOLUMES="false" VERSION="master" +LGSM_GITHUBUSER="" +LGSM_GITHUBREPO="" +LGSM_GITHUBBRANCH="" + GAMESERVER=() while [ $# -ge 1 ]; do key="$1" @@ -35,6 +39,9 @@ while [ $# -ge 1 ]; do echo "[help][multiple] --image x set target image" echo "[help][multiple] --flaky x test for flaky results x times, x should be greater as 1" echo "[help][multiple] --rerun check results and runs every gameserver which wasn't successful" + echo "[help][multiple] --git-branch x sets LGSM_GITHUBBRANCH" + echo "[help][multiple] --git-repo x sets LGSM_GITHUBREPO" + echo "[help][multiple] --git-user x sets LGSM_GITHUBUSER" echo "[help][multiple] --suffix suffix to add to every image" echo "[help][multiple] --volumes use volumes \"linuxgsm-SERVERCODE\"" echo "[help][multiple] -v --version x use linuxgsm version x e.g. \"v21.4.1\"" @@ -57,6 +64,15 @@ while [ $# -ge 1 ]; do shift;; --rerun) RERUN="true";; + --git-branch) + LGSM_GITHUBBRANCH="$1" + shift;; + --git-repo) + LGSM_GITHUBREPO="$1" + shift;; + --git-user) + LGSM_GITHUBUSER="$1" + shift;; --suffix) SUFFIX="$1" shift;; @@ -143,18 +159,18 @@ for run in $(seq 1 "$FLAKY"); do if "$testThisServercode" && "$rerunIsFine"; then echo "[info][multiple] testing: $server_code" ( - quick=(./test/single.sh --logs --version "$VERSION" --image "$IMAGE" --skip-lgsm --suffix "$SUFFIX") + single=(./test/single.sh --logs --version "$VERSION" --image "$IMAGE" --skip-lgsm --suffix "$SUFFIX" --git-branch "$LGSM_GITHUBBRANCH" --git-repo "$LGSM_GITHUBREPO" --git-user "$LGSM_GITHUBUSER") if "$VOLUMES"; then - quick+=(--volume "linuxgsm-$server_code") + single+=(--volume "linuxgsm-$server_code") fi if "$LOG_DEBUG"; then - quick+=(--log-debug) + single+=(--log-debug) fi - quick+=("$server_code") + single+=("$server_code") - echo "${quick[@]}" + echo "${single[@]}" is_successful="false" - if "${quick[@]}" > "$RESULTS/$server_code.log" 2>&1; then + if "${single[@]}" > "$RESULTS/$server_code.log" 2>&1; then is_successful="true" fi diff --git a/test/single.sh b/test/single.sh index a66810d..3e8b8d2 100755 --- a/test/single.sh +++ b/test/single.sh @@ -22,6 +22,9 @@ IMAGE="$DEFAULT_DOCKER_REPOSITORY" RETRY="1" GAMESERVER="" BUILD_ONLY="false" +LGSM_GITHUBUSER="" +LGSM_GITHUBREPO="" +LGSM_GITHUBBRANCH="" build=(./internal/build.sh) run=(./internal/run.sh) @@ -42,6 +45,9 @@ while [ $# -ge 1 ]; do echo "[help][single] -l --logs print complete docker log afterwards" echo "[help][single] --log-debug enables LGSM_DEBUG, log can contain your steam credentials, dont share it!" echo "[help][single] --retry if run failed, rebuild and rerun up to 3 times" + echo "[help][single] --git-branch x sets LGSM_GITHUBBRANCH" + echo "[help][single] --git-repo x sets LGSM_GITHUBREPO" + echo "[help][single] --git-user x sets LGSM_GITHUBUSER" echo "[help][single] --skip-lgsm skip build lgsm" echo "[help][single] --very-fast overwrite healthcheck, only use it with volumes / lancache because container will else fail pretty fast" echo "[help][single] --version x use linuxgsm version x e.g. \"v21.4.1\"" @@ -66,6 +72,15 @@ while [ $# -ge 1 ]; do LOG_DEBUG="true";; --retry) RETRY="3";; + --git-branch) + LGSM_GITHUBBRANCH="$1" + shift;; + --git-repo) + LGSM_GITHUBREPO="$1" + shift;; + --git-user) + LGSM_GITHUBUSER="$1" + shift;; --skip-lgsm) build+=(--skip-lgsm);; --suffix) @@ -105,6 +120,16 @@ else echo "[warning][single] no steam credentials provided, some servers will fail without it" fi +if [ -n "$LGSM_GITHUBUSER" ]; then + run+=(-e "LGSM_GITHUBUSER=$LGSM_GITHUBUSER") +fi +if [ -n "$LGSM_GITHUBREPO" ]; then + run+=(-e "LGSM_GITHUBREPO=$LGSM_GITHUBREPO") +fi +if [ -n "$LGSM_GITHUBBRANCH" ]; then + run+=(-e "LGSM_GITHUBBRANCH=$LGSM_GITHUBBRANCH") +fi + CONTAINER="linuxgsm-$GAMESERVER" build+=(--image "$IMAGE" --latest "$GAMESERVER") run+=(--image "$IMAGE" --tag "$GAMESERVER" --container "$CONTAINER") From 8e3fff2c17c8b3b7020d6f7cf03a680ec7a03c43 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 31 Jul 2022 18:24:53 +0200 Subject: [PATCH 100/116] doc: how testing works git --git-* args --- test/testing.md | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/test/testing.md b/test/testing.md index 35c58bf..6147d31 100644 --- a/test/testing.md +++ b/test/testing.md @@ -1,13 +1,13 @@ # Overview of testing -- all scripts supporting `-h or --help` for all options, here are only most important explained -- some servers need [steam credentials](steam_test_credentials) don't commit them and don't share your logs if they are used! +- All scripts supporting `-h or --help` for all options, here are only most important explained +- Some servers need [steam credentials](steam_test_credentials) don't commit them and don't share your logs if they are used! - Wherever available `--version commit/tag/branch` can be: - empty to take recent lgsm master branch - a lgsm tag like `v22.1.0` - a commit id of official lgsm repository - a commit id of your _fork_ - +- `LGSM_GITHUBBRANCH / LGSM_GITHUBREPO / LGSM_GITHUBUSER` can be set with `--git-[branch,repo,user] "value"` - Do you want to test a single servercode? E.g. to test a patch affecting just one server. - `./single.sh [--volume v] [--version commit/tag/branch] servercode` - testing a single servercode, e.g. if current is working or for testing your lgsm fork @@ -33,15 +33,29 @@ 1. You have created a fork 2. You have commited and pushed your changes to your repository -3. Get your commit id with `git log` e.g. `0dce0f0be3e2e881c592d726d0c11fc100a4a829` -4. You are in the root of this repository - - Do your changes affact just a single servercode? E.g. you provided a new one or you patched one +3. If you didn't modify `linuxgsm.sh`: + 1. Lets say your repository is: `https://github.com/MyUser/LinuxGSM/` + 2. Append to the scripts: `--git-user "MyUser" --git-repo "LinuxGSM" --git-branch "mybranch"` + 4. You can skip the the values if the default is fine, e.g. if your fork repo is still LinuxGSM you dont need to provide it. + 3. Important: This will only work completely for a clean volume! +4. If you modified `linuxgsm.sh`: + 1. Get your commit id with `git log` e.g. `0dce0f0be3e2e881c592d726d0c11fc100a4a829` + 2. Appent to the scripts `--version 0dce0f0be3e2e881c592d726d0c11fc100a4a829` + 3. Did you modify your `linuxgsm.sh` to set LGSM_GITHUBBRANCH / LGSM_GITHUBREPO / LGSM_GITHUBUSER ? + - If yes, you don't need to provide `--git-[user,repo,branch] "value"` + - If no, check step 3 +5. You are in the root of this repository + - Do your changes affact just a single servercode? E.g. you provided a new one or you patched one, use the variant below. + - `./single.sh --git-user "MyUser" --git-repo "LinuxGSM" --git-branch "mybranch" servercode` - `./single.sh --version 0dce0f0be3e2e881c592d726d0c11fc100a4a829 servercode` + - `./single.sh --version 0dce0f0be3e2e881c592d726d0c11fc100a4a829 --git-user "MyUser" --git-repo "LinuxGSM" --git-branch "mybranch" servercode` - Do your changes affect all servercodes? + - `./multiple.sh --git-user "MyUser" --git-repo "LinuxGSM" --git-branch "mybranch"` - `./multiple.sh --version 0dce0f0be3e2e881c592d726d0c11fc100a4a829` + - `./multiple.sh --version 0dce0f0be3e2e881c592d726d0c11fc100a4a829 --git-user "MyUser" --git-repo "LinuxGSM" --git-branch "mybranch"` #### My test was not successful, how to debug? `./single.sh --version 0dce0f0be3e2e881c592d726d0c11fc100a4a829 --debug servercode` 1. Image will be build and entrypoint is overwritten to bash -2. Therefore entrypoint.sh is not executed and you are in the volume location \ No newline at end of file +2. Therefore entrypoint.sh is not executed and you are in the volume location From b802ef08fe4487a019741b8734ff9fd9a800a5bc Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 31 Jul 2022 21:13:33 +0200 Subject: [PATCH 101/116] fix: openssl1.1 x86 / x64 --- build/installOpenSSL_1.1n.sh | 8 ++++++-- build/installServerDependencies.sh | 13 ++++++++++++- runtime/entrypoint.sh | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/build/installOpenSSL_1.1n.sh b/build/installOpenSSL_1.1n.sh index e9957cc..4cf2705 100644 --- a/build/installOpenSSL_1.1n.sh +++ b/build/installOpenSSL_1.1n.sh @@ -8,7 +8,11 @@ apt-get install -y python3-pip gcc-multilib pip3 install --force-reinstall conan conan profile new default --detect conan profile update settings.compiler.libcxx=libstdc++11 default -conan install -if "$(mktemp -d)" -s arch=x86 -s arch_build=x86 --build=missing -o openssl:shared=True "openssl/$version@_/_" -cp -vf ~/.conan/data/openssl/"$version"/_/_/package/*/lib/*.so.1.1 "/usr/local/lib" +conan install -if "$(mktemp -d)" -s arch=x86 -s arch_build=x86 --build=missing -o openssl:shared=True -s compiler.libcxx=libstdc++11 "openssl/$version@_/_" +mkdir -p "/usr/local/lib/openssl_x86" +cp -vf ~/.conan/data/openssl/"$version"/_/_/package/*/lib/*.so.1.1 "/usr/local/lib/openssl_x86" +conan install -if "$(mktemp -d)" -s arch=x86_x64 -s arch_build=x86_x64 --build=missing -o openssl:shared=True -s compiler.libcxx=libstdc++11 "openssl/$version@_/_" +mkdir -p "/usr/local/lib/openssl_x64" +cp -vf ~/.conan/data/openssl/"$version"/_/_/package/*/lib/*.so.1.1 "/usr/local/lib/openssl_x64" # reindex with: ldconfig /usr/local/lib # ldd *.so should be fine and ldconfig -p should list the so diff --git a/build/installServerDependencies.sh b/build/installServerDependencies.sh index d679bc0..880c9f7 100755 --- a/build/installServerDependencies.sh +++ b/build/installServerDependencies.sh @@ -29,8 +29,19 @@ if [ "${#cmds[@]}" -gt "0" ]; then dpkg --add-architecture i386 fi apt-get update - set -x + for cmd in "${cmds[@]}"; do + # workaround libssl1.1 + if grep -qF 'libssl1.1:i386' <<< "$cmd"; then + cp "/usr/local/lib/openssl_x86"/*.so* "/usr/local/lib/" + ldconfig "/usr/local/lib" + cmd="${cmd//libssl1.1:i386/}" + elif grep -qF 'libssl1.1' <<< "$cmd"; then + cp "/usr/local/lib/openssl_x64"/*.so* "/usr/local/lib/" + ldconfig "/usr/local/lib" + cmd="${cmd//libssl1.1/}" + fi + echo "[info][installDependencies] >$cmd<" if eval "DEBIAN_FRONTEND=noninteractive $cmd"; then echo "[info][installDependencies] successful!" diff --git a/runtime/entrypoint.sh b/runtime/entrypoint.sh index ada103d..21c87e3 100755 --- a/runtime/entrypoint.sh +++ b/runtime/entrypoint.sh @@ -38,6 +38,8 @@ else fi lgsm-load-config +# workaround libssl +sed -i -E 's/,libssl1.1[^,]*//' ./lgsm/data/ubuntu-22.04.csv lgsm-start || ( exitcode="$?" echo "[error][entrypoint] initial start failed, printing console.log" From 77c587274a7206fe2baf8847a114876d92aea9ea Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 31 Jul 2022 21:14:39 +0200 Subject: [PATCH 102/116] build: renaming openssl script --- build/Dockerfile | 4 ++-- build/{installOpenSSL_1.1n.sh => installOpenSSL_1.1.sh} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename build/{installOpenSSL_1.1n.sh => installOpenSSL_1.1.sh} (100%) diff --git a/build/Dockerfile b/build/Dockerfile index 1887ced..8f0b655 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -3,14 +3,14 @@ FROM ubuntu:22.04 as dependencyStage COPY build/installGosu.sh \ - build/installOpenSSL_1.1n.sh \ + build/installOpenSSL_1.1.sh \ build/installSupercronic.sh \ / RUN chmod +x installGosu.sh RUN set -eux; \ ./installGosu.sh 1.14; \ ./installSupercronic.sh v0.2.1 5eb5e2533fe75acffa63e437c0d8c4cb1f0c96891b84ae10ef4e53d602505f60; \ - ./installOpenSSL_1.1n.sh + ./installOpenSSL_1.1.sh # create linuxgsm image # this stage should be usable by existing developers diff --git a/build/installOpenSSL_1.1n.sh b/build/installOpenSSL_1.1.sh similarity index 100% rename from build/installOpenSSL_1.1n.sh rename to build/installOpenSSL_1.1.sh From 51e7599541e872a51c901820ce2955370176406a Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 31 Jul 2022 21:17:03 +0200 Subject: [PATCH 103/116] fix: openssl 1.1.1n -> 1.1.1q --- build/Dockerfile | 2 +- build/installOpenSSL_1.1.sh | 7 ++++--- deploy/generateExamples.sh | 0 test/debug-utils/extract_health_check.sh | 0 4 files changed, 5 insertions(+), 4 deletions(-) mode change 100644 => 100755 build/installOpenSSL_1.1.sh mode change 100644 => 100755 deploy/generateExamples.sh mode change 100644 => 100755 test/debug-utils/extract_health_check.sh diff --git a/build/Dockerfile b/build/Dockerfile index 8f0b655..3083df6 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -10,7 +10,7 @@ RUN chmod +x installGosu.sh RUN set -eux; \ ./installGosu.sh 1.14; \ ./installSupercronic.sh v0.2.1 5eb5e2533fe75acffa63e437c0d8c4cb1f0c96891b84ae10ef4e53d602505f60; \ - ./installOpenSSL_1.1.sh + ./installOpenSSL_1.1.sh 1.1.1q # create linuxgsm image # this stage should be usable by existing developers diff --git a/build/installOpenSSL_1.1.sh b/build/installOpenSSL_1.1.sh old mode 100644 new mode 100755 index 4cf2705..d978456 --- a/build/installOpenSSL_1.1.sh +++ b/build/installOpenSSL_1.1.sh @@ -1,17 +1,18 @@ #!/bin/bash set -euo pipefail -version="1.1.1n" +version="$1" apt-get update apt-get install -y python3-pip gcc-multilib pip3 install --force-reinstall conan conan profile new default --detect conan profile update settings.compiler.libcxx=libstdc++11 default -conan install -if "$(mktemp -d)" -s arch=x86 -s arch_build=x86 --build=missing -o openssl:shared=True -s compiler.libcxx=libstdc++11 "openssl/$version@_/_" +conan install -if "$(mktemp -d)" -s arch=x86 -s arch_build=x86 --build=missing -o openssl:shared=True -s compiler.libcxx=libstdc++11 -s build_type=Release "openssl/$version@_/_" mkdir -p "/usr/local/lib/openssl_x86" cp -vf ~/.conan/data/openssl/"$version"/_/_/package/*/lib/*.so.1.1 "/usr/local/lib/openssl_x86" -conan install -if "$(mktemp -d)" -s arch=x86_x64 -s arch_build=x86_x64 --build=missing -o openssl:shared=True -s compiler.libcxx=libstdc++11 "openssl/$version@_/_" +rm -rf ~/.conan/data/openssl/"$version"/_/_/package/ +conan install -if "$(mktemp -d)" -s arch=x86_64 -s arch_build=x86_64 --build=missing -o openssl:shared=True -s compiler.libcxx=libstdc++11 -s build_type=Release "openssl/$version@_/_" mkdir -p "/usr/local/lib/openssl_x64" cp -vf ~/.conan/data/openssl/"$version"/_/_/package/*/lib/*.so.1.1 "/usr/local/lib/openssl_x64" # reindex with: ldconfig /usr/local/lib diff --git a/deploy/generateExamples.sh b/deploy/generateExamples.sh old mode 100644 new mode 100755 diff --git a/test/debug-utils/extract_health_check.sh b/test/debug-utils/extract_health_check.sh old mode 100644 new mode 100755 From 64dfcc2ea5168c832e865be2731d711fe099193e Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Mon, 8 Aug 2022 22:31:34 +0200 Subject: [PATCH 104/116] fix: example generation consider credentials --- README.md | 2 +- deploy/generateExamples.sh | 31 ++++++++++++++++++++----------- examples/ahl2server.yml | 25 +++++++++++++++++++++++++ examples/ahlserver.yml | 23 +++++++++++++++++++++++ examples/arkserver.yml | 25 +++++++++++++++++++++++++ examples/arma3server.yml | 25 +++++++++++++++++++++++++ examples/armarserver.yml | 22 ++++++++++++++++++++++ examples/avserver.yml | 22 ++++++++++++++++++++++ examples/bb2server.yml | 22 ++++++++++++++++++++++ examples/bbserver.yml | 23 +++++++++++++++++++++++ examples/bdserver.yml | 22 ++++++++++++++++++++++ examples/bf1942server.yml | 22 ++++++++++++++++++++++ examples/bfvserver.yml | 22 ++++++++++++++++++++++ examples/bmdmserver.yml | 27 +++++++++++++++++++++++++++ examples/boserver.yml | 22 ++++++++++++++++++++++ examples/bsserver.yml | 25 +++++++++++++++++++++++++ examples/bt1944server.yml | 22 ++++++++++++++++++++++ examples/btserver.yml | 22 ++++++++++++++++++++++ examples/ccserver.yml | 27 +++++++++++++++++++++++++++ examples/cdserver.yml | 22 ++++++++++++++++++++++ examples/cmwserver.yml | 23 +++++++++++++++++++++++ examples/cod2server.yml | 22 ++++++++++++++++++++++ examples/cod4server.yml | 22 ++++++++++++++++++++++ examples/codserver.yml | 21 +++++++++++++++++++++ examples/coduoserver.yml | 21 +++++++++++++++++++++ examples/codwawserver.yml | 21 +++++++++++++++++++++ examples/colserver.yml | 22 ++++++++++++++++++++++ examples/csczserver.yml | 23 +++++++++++++++++++++++ examples/csgoserver.yml | 27 +++++++++++++++++++++++++++ examples/csserver.yml | 22 ++++++++++++++++++++++ examples/cssserver.yml | 27 +++++++++++++++++++++++++++ examples/dabserver.yml | 27 +++++++++++++++++++++++++++ examples/dayzserver.yml | 22 ++++++++++++++++++++++ examples/dmcserver.yml | 23 +++++++++++++++++++++++ examples/dodrserver.yml | 22 ++++++++++++++++++++++ examples/dodserver.yml | 23 +++++++++++++++++++++++ examples/dodsserver.yml | 22 ++++++++++++++++++++++ examples/doiserver.yml | 22 ++++++++++++++++++++++ examples/dstserver.yml | 22 ++++++++++++++++++++++ examples/dysserver.yml | 27 +++++++++++++++++++++++++++ examples/ecoserver.yml | 22 ++++++++++++++++++++++ examples/emserver.yml | 22 ++++++++++++++++++++++ examples/etlserver.yml | 22 ++++++++++++++++++++++ examples/fctrserver.yml | 22 ++++++++++++++++++++++ examples/fofserver.yml | 27 +++++++++++++++++++++++++++ examples/gmodserver.yml | 27 +++++++++++++++++++++++++++ examples/hl2dmserver.yml | 22 ++++++++++++++++++++++ examples/hldmserver.yml | 23 +++++++++++++++++++++++ examples/hldmsserver.yml | 27 +++++++++++++++++++++++++++ examples/hwserver.yml | 22 ++++++++++++++++++++++ examples/insserver.yml | 22 ++++++++++++++++++++++ examples/inssserver.yml | 22 ++++++++++++++++++++++ examples/iosserver.yml | 27 +++++++++++++++++++++++++++ examples/jc2server.yml | 22 ++++++++++++++++++++++ examples/jc3server.yml | 22 ++++++++++++++++++++++ examples/jk2server.yml | 24 ++++++++++++++++++++++++ examples/kf2server.yml | 22 ++++++++++++++++++++++ examples/kfserver.yml | 25 +++++++++++++++++++++++++ examples/l4d2server.yml | 25 +++++++++++++++++++++++++ examples/l4dserver.yml | 25 +++++++++++++++++++++++++ examples/loserver.yml | 22 ++++++++++++++++++++++ examples/mcbserver.yml | 22 ++++++++++++++++++++++ examples/mcserver.yml | 22 ++++++++++++++++++++++ examples/mhserver.yml | 25 +++++++++++++++++++++++++ examples/mohaaserver.yml | 22 ++++++++++++++++++++++ examples/momserver.yml | 23 +++++++++++++++++++++++ examples/mtaserver.yml | 22 ++++++++++++++++++++++ examples/mumbleserver.yml | 23 +++++++++++++++++++++++ examples/ndserver.yml | 27 +++++++++++++++++++++++++++ examples/nmrihserver.yml | 27 +++++++++++++++++++++++++++ examples/ns2cserver.yml | 22 ++++++++++++++++++++++ examples/ns2server.yml | 26 ++++++++++++++++++++++++++ examples/nsserver.yml | 22 ++++++++++++++++++++++ examples/opforserver.yml | 22 ++++++++++++++++++++++ examples/pc2server.yml | 22 ++++++++++++++++++++++ examples/pcserver.yml | 22 ++++++++++++++++++++++ examples/pmcserver.yml | 22 ++++++++++++++++++++++ examples/pstbsserver.yml | 22 ++++++++++++++++++++++ examples/pvkiiserver.yml | 27 +++++++++++++++++++++++++++ examples/pvrserver.yml | 22 ++++++++++++++++++++++ examples/q2server.yml | 21 +++++++++++++++++++++ examples/q3server.yml | 21 +++++++++++++++++++++ examples/qlserver.yml | 22 ++++++++++++++++++++++ examples/qwserver.yml | 22 ++++++++++++++++++++++ examples/ricochetserver.yml | 22 ++++++++++++++++++++++ examples/roserver.yml | 25 +++++++++++++++++++++++++ examples/rtcwserver.yml | 21 +++++++++++++++++++++ examples/rustserver.yml | 25 +++++++++++++++++++++++++ examples/sampserver.yml | 22 ++++++++++++++++++++++ examples/sbotsserver.yml | 23 +++++++++++++++++++++++ examples/sbserver.yml | 28 ++++++++++++++++++++++++++++ examples/scpslserver.yml | 22 ++++++++++++++++++++++ examples/scpslsmserver.yml | 22 ++++++++++++++++++++++ examples/sdtdserver.yml | 22 ++++++++++++++++++++++ examples/sfcserver.yml | 22 ++++++++++++++++++++++ examples/sfserver.yml | 25 +++++++++++++++++++++++++ examples/sof2server.yml | 21 +++++++++++++++++++++ examples/solserver.yml | 22 ++++++++++++++++++++++ examples/squadserver.yml | 22 ++++++++++++++++++++++ examples/stnserver.yml | 22 ++++++++++++++++++++++ examples/stserver.yml | 23 +++++++++++++++++++++++ examples/svenserver.yml | 22 ++++++++++++++++++++++ examples/tf2server.yml | 22 ++++++++++++++++++++++ examples/tfcserver.yml | 22 ++++++++++++++++++++++ examples/tiserver.yml | 22 ++++++++++++++++++++++ examples/ts3server.yml | 23 +++++++++++++++++++++++ examples/tsserver.yml | 22 ++++++++++++++++++++++ examples/tuserver.yml | 22 ++++++++++++++++++++++ examples/twserver.yml | 24 ++++++++++++++++++++++++ examples/untserver.yml | 23 +++++++++++++++++++++++ examples/ut2k4server.yml | 22 ++++++++++++++++++++++ examples/ut3server.yml | 22 ++++++++++++++++++++++ examples/ut99server.yml | 22 ++++++++++++++++++++++ examples/utserver.yml | 23 +++++++++++++++++++++++ examples/vhserver.yml | 23 +++++++++++++++++++++++ examples/vintsserver.yml | 22 ++++++++++++++++++++++ examples/vsserver.yml | 23 +++++++++++++++++++++++ examples/wetserver.yml | 22 ++++++++++++++++++++++ examples/wfserver.yml | 22 ++++++++++++++++++++++ examples/wmcserver.yml | 22 ++++++++++++++++++++++ examples/wurmserver.yml | 22 ++++++++++++++++++++++ examples/zmrserver.yml | 27 +++++++++++++++++++++++++++ examples/zpsserver.yml | 27 +++++++++++++++++++++++++++ test/single.sh | 4 +++- 124 files changed, 2817 insertions(+), 13 deletions(-) create mode 100644 examples/ahl2server.yml create mode 100644 examples/ahlserver.yml create mode 100644 examples/arkserver.yml create mode 100644 examples/arma3server.yml create mode 100644 examples/armarserver.yml create mode 100644 examples/avserver.yml create mode 100644 examples/bb2server.yml create mode 100644 examples/bbserver.yml create mode 100644 examples/bdserver.yml create mode 100644 examples/bf1942server.yml create mode 100644 examples/bfvserver.yml create mode 100644 examples/bmdmserver.yml create mode 100644 examples/boserver.yml create mode 100644 examples/bsserver.yml create mode 100644 examples/bt1944server.yml create mode 100644 examples/btserver.yml create mode 100644 examples/ccserver.yml create mode 100644 examples/cdserver.yml create mode 100644 examples/cmwserver.yml create mode 100644 examples/cod2server.yml create mode 100644 examples/cod4server.yml create mode 100644 examples/codserver.yml create mode 100644 examples/coduoserver.yml create mode 100644 examples/codwawserver.yml create mode 100644 examples/colserver.yml create mode 100644 examples/csczserver.yml create mode 100644 examples/csgoserver.yml create mode 100644 examples/csserver.yml create mode 100644 examples/cssserver.yml create mode 100644 examples/dabserver.yml create mode 100644 examples/dayzserver.yml create mode 100644 examples/dmcserver.yml create mode 100644 examples/dodrserver.yml create mode 100644 examples/dodserver.yml create mode 100644 examples/dodsserver.yml create mode 100644 examples/doiserver.yml create mode 100644 examples/dstserver.yml create mode 100644 examples/dysserver.yml create mode 100644 examples/ecoserver.yml create mode 100644 examples/emserver.yml create mode 100644 examples/etlserver.yml create mode 100644 examples/fctrserver.yml create mode 100644 examples/fofserver.yml create mode 100644 examples/gmodserver.yml create mode 100644 examples/hl2dmserver.yml create mode 100644 examples/hldmserver.yml create mode 100644 examples/hldmsserver.yml create mode 100644 examples/hwserver.yml create mode 100644 examples/insserver.yml create mode 100644 examples/inssserver.yml create mode 100644 examples/iosserver.yml create mode 100644 examples/jc2server.yml create mode 100644 examples/jc3server.yml create mode 100644 examples/jk2server.yml create mode 100644 examples/kf2server.yml create mode 100644 examples/kfserver.yml create mode 100644 examples/l4d2server.yml create mode 100644 examples/l4dserver.yml create mode 100644 examples/loserver.yml create mode 100644 examples/mcbserver.yml create mode 100644 examples/mcserver.yml create mode 100644 examples/mhserver.yml create mode 100644 examples/mohaaserver.yml create mode 100644 examples/momserver.yml create mode 100644 examples/mtaserver.yml create mode 100644 examples/mumbleserver.yml create mode 100644 examples/ndserver.yml create mode 100644 examples/nmrihserver.yml create mode 100644 examples/ns2cserver.yml create mode 100644 examples/ns2server.yml create mode 100644 examples/nsserver.yml create mode 100644 examples/opforserver.yml create mode 100644 examples/pc2server.yml create mode 100644 examples/pcserver.yml create mode 100644 examples/pmcserver.yml create mode 100644 examples/pstbsserver.yml create mode 100644 examples/pvkiiserver.yml create mode 100644 examples/pvrserver.yml create mode 100644 examples/q2server.yml create mode 100644 examples/q3server.yml create mode 100644 examples/qlserver.yml create mode 100644 examples/qwserver.yml create mode 100644 examples/ricochetserver.yml create mode 100644 examples/roserver.yml create mode 100644 examples/rtcwserver.yml create mode 100644 examples/rustserver.yml create mode 100644 examples/sampserver.yml create mode 100644 examples/sbotsserver.yml create mode 100644 examples/sbserver.yml create mode 100644 examples/scpslserver.yml create mode 100644 examples/scpslsmserver.yml create mode 100644 examples/sdtdserver.yml create mode 100644 examples/sfcserver.yml create mode 100644 examples/sfserver.yml create mode 100644 examples/sof2server.yml create mode 100644 examples/solserver.yml create mode 100644 examples/squadserver.yml create mode 100644 examples/stnserver.yml create mode 100644 examples/stserver.yml create mode 100644 examples/svenserver.yml create mode 100644 examples/tf2server.yml create mode 100644 examples/tfcserver.yml create mode 100644 examples/tiserver.yml create mode 100644 examples/ts3server.yml create mode 100644 examples/tsserver.yml create mode 100644 examples/tuserver.yml create mode 100644 examples/twserver.yml create mode 100644 examples/untserver.yml create mode 100644 examples/ut2k4server.yml create mode 100644 examples/ut3server.yml create mode 100644 examples/ut99server.yml create mode 100644 examples/utserver.yml create mode 100644 examples/vhserver.yml create mode 100644 examples/vintsserver.yml create mode 100644 examples/vsserver.yml create mode 100644 examples/wetserver.yml create mode 100644 examples/wfserver.yml create mode 100644 examples/wmcserver.yml create mode 100644 examples/wurmserver.yml create mode 100644 examples/zmrserver.yml create mode 100644 examples/zpsserver.yml diff --git a/README.md b/README.md index c837755..136916c 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Dockerhub https://hub.docker.com/r/gameservermanagers/linuxgsm-docker/ ## How to use: 1. Choose your servercode and replace in below -2. start `docker-compose -f examples/SERVER.yml up -d` +2. start `docker-compose -f examples/SERVER.yml up -d`, if the server needs credentials there will be placeholders in the compose. 3. get config location `docker exec -it lgsm-SERVER-1 details` 4. copy your own config into: `docker cp my_local_config.txt lgsm-SERVER-1:/config_location_from_step_3` 5. print config content `docker exec lgsm-SERVER-1 cat /config_location_from_step_3` diff --git a/deploy/generateExamples.sh b/deploy/generateExamples.sh index fb18225..7b765b2 100755 --- a/deploy/generateExamples.sh +++ b/deploy/generateExamples.sh @@ -1,16 +1,17 @@ #!/bin/bash -set -o errexit set -o nounset set -o pipefail version="$1" +rebuild="false" ( cd "$(dirname "$0")/.." source "test/internal/api_various.sh" source "test/internal/api_docker.sh" + source "test/steam_test_credentials" image="$DEFAULT_DOCKER_REPOSITORY" mapfile -d $'\n' -t servers < <(getServerCodeList "$version") @@ -23,10 +24,10 @@ version="$1" # run it once run=(./test/internal/run.sh --container "$container" --image "$image" --tag "$server" --detach) # assuming already build before? Else takes way more time. - #if ! ./test/single.sh --build-only --version "$version" --image "$image" "$server"; then - # echo "build failed, skipping" - # continue - #fi + if "$rebuild" && ! ./test/single.sh --build-only --version "$version" --image "$image" "$server"; then + echo "build failed, skipping" + continue + fi echo "${run[@]}" if ! "${run[@]}" > /dev/null; then echo "run failed, skipping" @@ -41,6 +42,12 @@ version="$1" echo -en "\r[info][awaitContainerStarted] waiting for $seconds" done echo -e "\r[info][awaitContainerStarted] waited for $seconds " + if ! docker exec "$container" ls > /dev/null 2>&1; then + echo "[error] $container crashed" + cmd=(docker logs "$container") + echo "${cmd[@]}" + "${cmd[@]}" + fi # get all ports details="$(docker exec -it "$container" details 2>&1)" @@ -48,6 +55,11 @@ version="$1" docker stop "$container" > /dev/null 2>&1 || true docker rm "$container" > /dev/null 2>&1 || true + steam_credentials_needed="" + if grep -qEe "(^|\s)$server(\s|$)" <<< "${credentials_enabled[@]}"; then + steam_credentials_needed="$(printf '\n # please fill your credentials below\n - "CONFIGFORCED_steamuser="\n - "CONFIGFORCED_steampass="\n')" + fi + # write docker-compose.yml compose_file=" # usage: @@ -55,15 +67,15 @@ version="$1" volumes: serverfiles: -name: lgsm-$server +name: lgsm services: - service: + $server: image: \"$image:$server\" tty: true restart: unless-stopped environment: - - \"CRON_update_daily=0 7 * * *\" + - \"CRON_update_daily=0 7 * * * update\"$steam_credentials_needed volumes: - serverfiles:/home/linuxgsm - /etc/localtime:/etc/localtime:ro" @@ -107,8 +119,5 @@ services: echo "# - \"27015:27015/tcp\"" >> "examples/$server.yml" fi - if grep -q "b" <<< "$server"; then - exit 0 - fi done ) diff --git a/examples/ahl2server.yml b/examples/ahl2server.yml new file mode 100644 index 0000000..3db9b28 --- /dev/null +++ b/examples/ahl2server.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/ahl2server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + ahl2server: + image: "gameservermanagers/linuxgsm-docker:ahl2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + # please fill your credentials below + - "CONFIGFORCED_steamuser=" + - "CONFIGFORCED_steampass=" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/ahlserver.yml b/examples/ahlserver.yml new file mode 100644 index 0000000..2864106 --- /dev/null +++ b/examples/ahlserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/ahlserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + ahlserver: + image: "gameservermanagers/linuxgsm-docker:ahlserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/arkserver.yml b/examples/arkserver.yml new file mode 100644 index 0000000..b664be7 --- /dev/null +++ b/examples/arkserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/arkserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + arkserver: + image: "gameservermanagers/linuxgsm-docker:arkserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Query + - "27015:27015/udp" + # RCON + - "27020:27020/tcp" diff --git a/examples/arma3server.yml b/examples/arma3server.yml new file mode 100644 index 0000000..307c53b --- /dev/null +++ b/examples/arma3server.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/arma3server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + arma3server: + image: "gameservermanagers/linuxgsm-docker:arma3server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + # please fill your credentials below + - "CONFIGFORCED_steamuser=" + - "CONFIGFORCED_steampass=" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/armarserver.yml b/examples/armarserver.yml new file mode 100644 index 0000000..f80e110 --- /dev/null +++ b/examples/armarserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/armarserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + armarserver: + image: "gameservermanagers/linuxgsm-docker:armarserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/avserver.yml b/examples/avserver.yml new file mode 100644 index 0000000..fcbdf44 --- /dev/null +++ b/examples/avserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/avserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + avserver: + image: "gameservermanagers/linuxgsm-docker:avserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/bb2server.yml b/examples/bb2server.yml new file mode 100644 index 0000000..6c06b39 --- /dev/null +++ b/examples/bb2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/bb2server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + bb2server: + image: "gameservermanagers/linuxgsm-docker:bb2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/bbserver.yml b/examples/bbserver.yml new file mode 100644 index 0000000..1159694 --- /dev/null +++ b/examples/bbserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/bbserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + bbserver: + image: "gameservermanagers/linuxgsm-docker:bbserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/bdserver.yml b/examples/bdserver.yml new file mode 100644 index 0000000..9df1e54 --- /dev/null +++ b/examples/bdserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/bdserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + bdserver: + image: "gameservermanagers/linuxgsm-docker:bdserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/bf1942server.yml b/examples/bf1942server.yml new file mode 100644 index 0000000..02303e2 --- /dev/null +++ b/examples/bf1942server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/bf1942server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + bf1942server: + image: "gameservermanagers/linuxgsm-docker:bf1942server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/bfvserver.yml b/examples/bfvserver.yml new file mode 100644 index 0000000..6b2c0ee --- /dev/null +++ b/examples/bfvserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/bfvserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + bfvserver: + image: "gameservermanagers/linuxgsm-docker:bfvserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/bmdmserver.yml b/examples/bmdmserver.yml new file mode 100644 index 0000000..21bb0ed --- /dev/null +++ b/examples/bmdmserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/bmdmserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + bmdmserver: + image: "gameservermanagers/linuxgsm-docker:bmdmserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/boserver.yml b/examples/boserver.yml new file mode 100644 index 0000000..687ec80 --- /dev/null +++ b/examples/boserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/boserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + boserver: + image: "gameservermanagers/linuxgsm-docker:boserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/bsserver.yml b/examples/bsserver.yml new file mode 100644 index 0000000..36d22e2 --- /dev/null +++ b/examples/bsserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/bsserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + bsserver: + image: "gameservermanagers/linuxgsm-docker:bsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + # please fill your credentials below + - "CONFIGFORCED_steamuser=" + - "CONFIGFORCED_steampass=" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/bt1944server.yml b/examples/bt1944server.yml new file mode 100644 index 0000000..d2f5ff1 --- /dev/null +++ b/examples/bt1944server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/bt1944server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + bt1944server: + image: "gameservermanagers/linuxgsm-docker:bt1944server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/btserver.yml b/examples/btserver.yml new file mode 100644 index 0000000..c40b6cb --- /dev/null +++ b/examples/btserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/btserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + btserver: + image: "gameservermanagers/linuxgsm-docker:btserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/ccserver.yml b/examples/ccserver.yml new file mode 100644 index 0000000..6853151 --- /dev/null +++ b/examples/ccserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/ccserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + ccserver: + image: "gameservermanagers/linuxgsm-docker:ccserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/cdserver.yml b/examples/cdserver.yml new file mode 100644 index 0000000..90dd38b --- /dev/null +++ b/examples/cdserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/cdserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + cdserver: + image: "gameservermanagers/linuxgsm-docker:cdserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/cmwserver.yml b/examples/cmwserver.yml new file mode 100644 index 0000000..d49ec32 --- /dev/null +++ b/examples/cmwserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/cmwserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + cmwserver: + image: "gameservermanagers/linuxgsm-docker:cmwserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Query + - "7779:7779/udp" diff --git a/examples/cod2server.yml b/examples/cod2server.yml new file mode 100644 index 0000000..41e7d70 --- /dev/null +++ b/examples/cod2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/cod2server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + cod2server: + image: "gameservermanagers/linuxgsm-docker:cod2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/cod4server.yml b/examples/cod4server.yml new file mode 100644 index 0000000..4627b7f --- /dev/null +++ b/examples/cod4server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/cod4server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + cod4server: + image: "gameservermanagers/linuxgsm-docker:cod4server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/codserver.yml b/examples/codserver.yml new file mode 100644 index 0000000..6940944 --- /dev/null +++ b/examples/codserver.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/codserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + codserver: + image: "gameservermanagers/linuxgsm-docker:codserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "28960:28960/udp" diff --git a/examples/coduoserver.yml b/examples/coduoserver.yml new file mode 100644 index 0000000..3604b84 --- /dev/null +++ b/examples/coduoserver.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/coduoserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + coduoserver: + image: "gameservermanagers/linuxgsm-docker:coduoserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "28960:28960/udp" diff --git a/examples/codwawserver.yml b/examples/codwawserver.yml new file mode 100644 index 0000000..eed18f8 --- /dev/null +++ b/examples/codwawserver.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/codwawserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + codwawserver: + image: "gameservermanagers/linuxgsm-docker:codwawserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game / Query + - "28960:28960/udp" diff --git a/examples/colserver.yml b/examples/colserver.yml new file mode 100644 index 0000000..2ee7661 --- /dev/null +++ b/examples/colserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/colserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + colserver: + image: "gameservermanagers/linuxgsm-docker:colserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/csczserver.yml b/examples/csczserver.yml new file mode 100644 index 0000000..f144427 --- /dev/null +++ b/examples/csczserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/csczserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + csczserver: + image: "gameservermanagers/linuxgsm-docker:csczserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/csgoserver.yml b/examples/csgoserver.yml new file mode 100644 index 0000000..79c182d --- /dev/null +++ b/examples/csgoserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/csgoserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + csgoserver: + image: "gameservermanagers/linuxgsm-docker:csgoserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/csserver.yml b/examples/csserver.yml new file mode 100644 index 0000000..dc2b862 --- /dev/null +++ b/examples/csserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/csserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + csserver: + image: "gameservermanagers/linuxgsm-docker:csserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/cssserver.yml b/examples/cssserver.yml new file mode 100644 index 0000000..1a939c9 --- /dev/null +++ b/examples/cssserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/cssserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + cssserver: + image: "gameservermanagers/linuxgsm-docker:cssserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/dabserver.yml b/examples/dabserver.yml new file mode 100644 index 0000000..0d0a211 --- /dev/null +++ b/examples/dabserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/dabserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + dabserver: + image: "gameservermanagers/linuxgsm-docker:dabserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/dayzserver.yml b/examples/dayzserver.yml new file mode 100644 index 0000000..165d49c --- /dev/null +++ b/examples/dayzserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/dayzserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + dayzserver: + image: "gameservermanagers/linuxgsm-docker:dayzserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/dmcserver.yml b/examples/dmcserver.yml new file mode 100644 index 0000000..5e95584 --- /dev/null +++ b/examples/dmcserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/dmcserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + dmcserver: + image: "gameservermanagers/linuxgsm-docker:dmcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/dodrserver.yml b/examples/dodrserver.yml new file mode 100644 index 0000000..62ae989 --- /dev/null +++ b/examples/dodrserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/dodrserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + dodrserver: + image: "gameservermanagers/linuxgsm-docker:dodrserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/dodserver.yml b/examples/dodserver.yml new file mode 100644 index 0000000..4328898 --- /dev/null +++ b/examples/dodserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/dodserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + dodserver: + image: "gameservermanagers/linuxgsm-docker:dodserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/dodsserver.yml b/examples/dodsserver.yml new file mode 100644 index 0000000..895ce8a --- /dev/null +++ b/examples/dodsserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/dodsserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + dodsserver: + image: "gameservermanagers/linuxgsm-docker:dodsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/doiserver.yml b/examples/doiserver.yml new file mode 100644 index 0000000..d1d8c8e --- /dev/null +++ b/examples/doiserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/doiserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + doiserver: + image: "gameservermanagers/linuxgsm-docker:doiserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/dstserver.yml b/examples/dstserver.yml new file mode 100644 index 0000000..33fca91 --- /dev/null +++ b/examples/dstserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/dstserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + dstserver: + image: "gameservermanagers/linuxgsm-docker:dstserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/dysserver.yml b/examples/dysserver.yml new file mode 100644 index 0000000..959d5b3 --- /dev/null +++ b/examples/dysserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/dysserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + dysserver: + image: "gameservermanagers/linuxgsm-docker:dysserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/ecoserver.yml b/examples/ecoserver.yml new file mode 100644 index 0000000..797bf3f --- /dev/null +++ b/examples/ecoserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/ecoserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + ecoserver: + image: "gameservermanagers/linuxgsm-docker:ecoserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/emserver.yml b/examples/emserver.yml new file mode 100644 index 0000000..4e677df --- /dev/null +++ b/examples/emserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/emserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + emserver: + image: "gameservermanagers/linuxgsm-docker:emserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/etlserver.yml b/examples/etlserver.yml new file mode 100644 index 0000000..c1c296f --- /dev/null +++ b/examples/etlserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/etlserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + etlserver: + image: "gameservermanagers/linuxgsm-docker:etlserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/fctrserver.yml b/examples/fctrserver.yml new file mode 100644 index 0000000..000ff5f --- /dev/null +++ b/examples/fctrserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/fctrserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + fctrserver: + image: "gameservermanagers/linuxgsm-docker:fctrserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/fofserver.yml b/examples/fofserver.yml new file mode 100644 index 0000000..0299378 --- /dev/null +++ b/examples/fofserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/fofserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + fofserver: + image: "gameservermanagers/linuxgsm-docker:fofserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/gmodserver.yml b/examples/gmodserver.yml new file mode 100644 index 0000000..096ec40 --- /dev/null +++ b/examples/gmodserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/gmodserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + gmodserver: + image: "gameservermanagers/linuxgsm-docker:gmodserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/hl2dmserver.yml b/examples/hl2dmserver.yml new file mode 100644 index 0000000..8a8e789 --- /dev/null +++ b/examples/hl2dmserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/hl2dmserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + hl2dmserver: + image: "gameservermanagers/linuxgsm-docker:hl2dmserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/hldmserver.yml b/examples/hldmserver.yml new file mode 100644 index 0000000..9b073bb --- /dev/null +++ b/examples/hldmserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/hldmserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + hldmserver: + image: "gameservermanagers/linuxgsm-docker:hldmserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/hldmsserver.yml b/examples/hldmsserver.yml new file mode 100644 index 0000000..b69550b --- /dev/null +++ b/examples/hldmsserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/hldmsserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + hldmsserver: + image: "gameservermanagers/linuxgsm-docker:hldmsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/hwserver.yml b/examples/hwserver.yml new file mode 100644 index 0000000..d0bbae2 --- /dev/null +++ b/examples/hwserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/hwserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + hwserver: + image: "gameservermanagers/linuxgsm-docker:hwserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/insserver.yml b/examples/insserver.yml new file mode 100644 index 0000000..f2b9b08 --- /dev/null +++ b/examples/insserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/insserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + insserver: + image: "gameservermanagers/linuxgsm-docker:insserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/inssserver.yml b/examples/inssserver.yml new file mode 100644 index 0000000..d621e3a --- /dev/null +++ b/examples/inssserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/inssserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + inssserver: + image: "gameservermanagers/linuxgsm-docker:inssserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/iosserver.yml b/examples/iosserver.yml new file mode 100644 index 0000000..6615618 --- /dev/null +++ b/examples/iosserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/iosserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + iosserver: + image: "gameservermanagers/linuxgsm-docker:iosserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/jc2server.yml b/examples/jc2server.yml new file mode 100644 index 0000000..a852b50 --- /dev/null +++ b/examples/jc2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/jc2server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + jc2server: + image: "gameservermanagers/linuxgsm-docker:jc2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/jc3server.yml b/examples/jc3server.yml new file mode 100644 index 0000000..9f26011 --- /dev/null +++ b/examples/jc3server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/jc3server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + jc3server: + image: "gameservermanagers/linuxgsm-docker:jc3server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/jk2server.yml b/examples/jk2server.yml new file mode 100644 index 0000000..bdce0bb --- /dev/null +++ b/examples/jk2server.yml @@ -0,0 +1,24 @@ + +# usage: +# docker-compose -f ./examples/jk2server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + jk2server: + image: "gameservermanagers/linuxgsm-docker:jk2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + # please fill your credentials below + - "CONFIGFORCED_steamuser=" + - "CONFIGFORCED_steampass=" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27960:27960/udp" diff --git a/examples/kf2server.yml b/examples/kf2server.yml new file mode 100644 index 0000000..345dcb0 --- /dev/null +++ b/examples/kf2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/kf2server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + kf2server: + image: "gameservermanagers/linuxgsm-docker:kf2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/kfserver.yml b/examples/kfserver.yml new file mode 100644 index 0000000..2f74a4f --- /dev/null +++ b/examples/kfserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/kfserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + kfserver: + image: "gameservermanagers/linuxgsm-docker:kfserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + # please fill your credentials below + - "CONFIGFORCED_steamuser=" + - "CONFIGFORCED_steampass=" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/l4d2server.yml b/examples/l4d2server.yml new file mode 100644 index 0000000..b9b1410 --- /dev/null +++ b/examples/l4d2server.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/l4d2server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + l4d2server: + image: "gameservermanagers/linuxgsm-docker:l4d2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # Client + - "27005:27005/udp" diff --git a/examples/l4dserver.yml b/examples/l4dserver.yml new file mode 100644 index 0000000..debca56 --- /dev/null +++ b/examples/l4dserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/l4dserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + l4dserver: + image: "gameservermanagers/linuxgsm-docker:l4dserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # Client + - "27005:27005/udp" diff --git a/examples/loserver.yml b/examples/loserver.yml new file mode 100644 index 0000000..134ed84 --- /dev/null +++ b/examples/loserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/loserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + loserver: + image: "gameservermanagers/linuxgsm-docker:loserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/mcbserver.yml b/examples/mcbserver.yml new file mode 100644 index 0000000..6a1b5ce --- /dev/null +++ b/examples/mcbserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/mcbserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + mcbserver: + image: "gameservermanagers/linuxgsm-docker:mcbserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/mcserver.yml b/examples/mcserver.yml new file mode 100644 index 0000000..8d6ce14 --- /dev/null +++ b/examples/mcserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/mcserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + mcserver: + image: "gameservermanagers/linuxgsm-docker:mcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/mhserver.yml b/examples/mhserver.yml new file mode 100644 index 0000000..39c5b90 --- /dev/null +++ b/examples/mhserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/mhserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + mhserver: + image: "gameservermanagers/linuxgsm-docker:mhserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Query + - "27015:27015/udp" + # Beacon + - "15000:15000/udp" diff --git a/examples/mohaaserver.yml b/examples/mohaaserver.yml new file mode 100644 index 0000000..a5fc395 --- /dev/null +++ b/examples/mohaaserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/mohaaserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + mohaaserver: + image: "gameservermanagers/linuxgsm-docker:mohaaserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/momserver.yml b/examples/momserver.yml new file mode 100644 index 0000000..3c61629 --- /dev/null +++ b/examples/momserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/momserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + momserver: + image: "gameservermanagers/linuxgsm-docker:momserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Beacon + - "15000:15000/udp" diff --git a/examples/mtaserver.yml b/examples/mtaserver.yml new file mode 100644 index 0000000..266af7a --- /dev/null +++ b/examples/mtaserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/mtaserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + mtaserver: + image: "gameservermanagers/linuxgsm-docker:mtaserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/mumbleserver.yml b/examples/mumbleserver.yml new file mode 100644 index 0000000..afc9859 --- /dev/null +++ b/examples/mumbleserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/mumbleserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + mumbleserver: + image: "gameservermanagers/linuxgsm-docker:mumbleserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Voice + - "64738:64738/udp" + # Query + - "64738:64738/tcp" diff --git a/examples/ndserver.yml b/examples/ndserver.yml new file mode 100644 index 0000000..5d5b028 --- /dev/null +++ b/examples/ndserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/ndserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + ndserver: + image: "gameservermanagers/linuxgsm-docker:ndserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/nmrihserver.yml b/examples/nmrihserver.yml new file mode 100644 index 0000000..fb3e75a --- /dev/null +++ b/examples/nmrihserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/nmrihserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + nmrihserver: + image: "gameservermanagers/linuxgsm-docker:nmrihserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/ns2cserver.yml b/examples/ns2cserver.yml new file mode 100644 index 0000000..6b634b7 --- /dev/null +++ b/examples/ns2cserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/ns2cserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + ns2cserver: + image: "gameservermanagers/linuxgsm-docker:ns2cserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/ns2server.yml b/examples/ns2server.yml new file mode 100644 index 0000000..9eca9ac --- /dev/null +++ b/examples/ns2server.yml @@ -0,0 +1,26 @@ + +# usage: +# docker-compose -f ./examples/ns2server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + ns2server: + image: "gameservermanagers/linuxgsm-docker:ns2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + # please fill your credentials below + - "CONFIGFORCED_steamuser=" + - "CONFIGFORCED_steampass=" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query + - "27016:27016/udp" diff --git a/examples/nsserver.yml b/examples/nsserver.yml new file mode 100644 index 0000000..909b4c1 --- /dev/null +++ b/examples/nsserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/nsserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + nsserver: + image: "gameservermanagers/linuxgsm-docker:nsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/opforserver.yml b/examples/opforserver.yml new file mode 100644 index 0000000..0a01a36 --- /dev/null +++ b/examples/opforserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/opforserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + opforserver: + image: "gameservermanagers/linuxgsm-docker:opforserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/pc2server.yml b/examples/pc2server.yml new file mode 100644 index 0000000..e567eaa --- /dev/null +++ b/examples/pc2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/pc2server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + pc2server: + image: "gameservermanagers/linuxgsm-docker:pc2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/pcserver.yml b/examples/pcserver.yml new file mode 100644 index 0000000..7cafc81 --- /dev/null +++ b/examples/pcserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/pcserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + pcserver: + image: "gameservermanagers/linuxgsm-docker:pcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/pmcserver.yml b/examples/pmcserver.yml new file mode 100644 index 0000000..077fcf6 --- /dev/null +++ b/examples/pmcserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/pmcserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + pmcserver: + image: "gameservermanagers/linuxgsm-docker:pmcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/pstbsserver.yml b/examples/pstbsserver.yml new file mode 100644 index 0000000..03d2076 --- /dev/null +++ b/examples/pstbsserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/pstbsserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + pstbsserver: + image: "gameservermanagers/linuxgsm-docker:pstbsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/pvkiiserver.yml b/examples/pvkiiserver.yml new file mode 100644 index 0000000..005f937 --- /dev/null +++ b/examples/pvkiiserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/pvkiiserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + pvkiiserver: + image: "gameservermanagers/linuxgsm-docker:pvkiiserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/pvrserver.yml b/examples/pvrserver.yml new file mode 100644 index 0000000..91b64a6 --- /dev/null +++ b/examples/pvrserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/pvrserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + pvrserver: + image: "gameservermanagers/linuxgsm-docker:pvrserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/q2server.yml b/examples/q2server.yml new file mode 100644 index 0000000..28659a3 --- /dev/null +++ b/examples/q2server.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/q2server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + q2server: + image: "gameservermanagers/linuxgsm-docker:q2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27910:27910/udp" diff --git a/examples/q3server.yml b/examples/q3server.yml new file mode 100644 index 0000000..78b4267 --- /dev/null +++ b/examples/q3server.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/q3server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + q3server: + image: "gameservermanagers/linuxgsm-docker:q3server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27960:27960/udp" diff --git a/examples/qlserver.yml b/examples/qlserver.yml new file mode 100644 index 0000000..08d72ff --- /dev/null +++ b/examples/qlserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/qlserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + qlserver: + image: "gameservermanagers/linuxgsm-docker:qlserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/qwserver.yml b/examples/qwserver.yml new file mode 100644 index 0000000..e9632e6 --- /dev/null +++ b/examples/qwserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/qwserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + qwserver: + image: "gameservermanagers/linuxgsm-docker:qwserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/ricochetserver.yml b/examples/ricochetserver.yml new file mode 100644 index 0000000..b1b5bb5 --- /dev/null +++ b/examples/ricochetserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/ricochetserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + ricochetserver: + image: "gameservermanagers/linuxgsm-docker:ricochetserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/roserver.yml b/examples/roserver.yml new file mode 100644 index 0000000..a769fbe --- /dev/null +++ b/examples/roserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/roserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + roserver: + image: "gameservermanagers/linuxgsm-docker:roserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + # please fill your credentials below + - "CONFIGFORCED_steamuser=" + - "CONFIGFORCED_steampass=" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/rtcwserver.yml b/examples/rtcwserver.yml new file mode 100644 index 0000000..7f79a1d --- /dev/null +++ b/examples/rtcwserver.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/rtcwserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + rtcwserver: + image: "gameservermanagers/linuxgsm-docker:rtcwserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27960:27960/udp" diff --git a/examples/rustserver.yml b/examples/rustserver.yml new file mode 100644 index 0000000..e12dcfe --- /dev/null +++ b/examples/rustserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/rustserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + rustserver: + image: "gameservermanagers/linuxgsm-docker:rustserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game / Query + - "28015:28015/udp" + # RCON + - "28016:28016/tcp" + # App + - "28082:28082/tcp" diff --git a/examples/sampserver.yml b/examples/sampserver.yml new file mode 100644 index 0000000..2d46191 --- /dev/null +++ b/examples/sampserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/sampserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + sampserver: + image: "gameservermanagers/linuxgsm-docker:sampserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/sbotsserver.yml b/examples/sbotsserver.yml new file mode 100644 index 0000000..a432ca0 --- /dev/null +++ b/examples/sbotsserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/sbotsserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + sbotsserver: + image: "gameservermanagers/linuxgsm-docker:sbotsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Query + - "27015:27015/udp" diff --git a/examples/sbserver.yml b/examples/sbserver.yml new file mode 100644 index 0000000..24ba71b --- /dev/null +++ b/examples/sbserver.yml @@ -0,0 +1,28 @@ + +# usage: +# docker-compose -f ./examples/sbserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + sbserver: + image: "gameservermanagers/linuxgsm-docker:sbserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + # please fill your credentials below + - "CONFIGFORCED_steamuser=" + - "CONFIGFORCED_steampass=" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "21025:21025/udp" + # Query + - "21025:21025/tcp" + # RCON + - "21026:21026/tcp" diff --git a/examples/scpslserver.yml b/examples/scpslserver.yml new file mode 100644 index 0000000..db2e472 --- /dev/null +++ b/examples/scpslserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/scpslserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + scpslserver: + image: "gameservermanagers/linuxgsm-docker:scpslserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/scpslsmserver.yml b/examples/scpslsmserver.yml new file mode 100644 index 0000000..cb9f776 --- /dev/null +++ b/examples/scpslsmserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/scpslsmserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + scpslsmserver: + image: "gameservermanagers/linuxgsm-docker:scpslsmserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/sdtdserver.yml b/examples/sdtdserver.yml new file mode 100644 index 0000000..ce3775e --- /dev/null +++ b/examples/sdtdserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/sdtdserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + sdtdserver: + image: "gameservermanagers/linuxgsm-docker:sdtdserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/sfcserver.yml b/examples/sfcserver.yml new file mode 100644 index 0000000..00c307a --- /dev/null +++ b/examples/sfcserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/sfcserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + sfcserver: + image: "gameservermanagers/linuxgsm-docker:sfcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/sfserver.yml b/examples/sfserver.yml new file mode 100644 index 0000000..819b180 --- /dev/null +++ b/examples/sfserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/sfserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + sfserver: + image: "gameservermanagers/linuxgsm-docker:sfserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Query + - "15777:15777/udp" + # Beacon + - "15000:15000/udp" diff --git a/examples/sof2server.yml b/examples/sof2server.yml new file mode 100644 index 0000000..86ce907 --- /dev/null +++ b/examples/sof2server.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/sof2server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + sof2server: + image: "gameservermanagers/linuxgsm-docker:sof2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game / Query + - "20100:20100/udp" diff --git a/examples/solserver.yml b/examples/solserver.yml new file mode 100644 index 0000000..abca0c3 --- /dev/null +++ b/examples/solserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/solserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + solserver: + image: "gameservermanagers/linuxgsm-docker:solserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/squadserver.yml b/examples/squadserver.yml new file mode 100644 index 0000000..11843d9 --- /dev/null +++ b/examples/squadserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/squadserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + squadserver: + image: "gameservermanagers/linuxgsm-docker:squadserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/stnserver.yml b/examples/stnserver.yml new file mode 100644 index 0000000..58f76e3 --- /dev/null +++ b/examples/stnserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/stnserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + stnserver: + image: "gameservermanagers/linuxgsm-docker:stnserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/stserver.yml b/examples/stserver.yml new file mode 100644 index 0000000..75c465d --- /dev/null +++ b/examples/stserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/stserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + stserver: + image: "gameservermanagers/linuxgsm-docker:stserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27500:27500/udp" + # Query + - "27015:27015/udp" diff --git a/examples/svenserver.yml b/examples/svenserver.yml new file mode 100644 index 0000000..b1be400 --- /dev/null +++ b/examples/svenserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/svenserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + svenserver: + image: "gameservermanagers/linuxgsm-docker:svenserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/tf2server.yml b/examples/tf2server.yml new file mode 100644 index 0000000..dbcc0ba --- /dev/null +++ b/examples/tf2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/tf2server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + tf2server: + image: "gameservermanagers/linuxgsm-docker:tf2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/tfcserver.yml b/examples/tfcserver.yml new file mode 100644 index 0000000..18f590a --- /dev/null +++ b/examples/tfcserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/tfcserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + tfcserver: + image: "gameservermanagers/linuxgsm-docker:tfcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/tiserver.yml b/examples/tiserver.yml new file mode 100644 index 0000000..7fccc66 --- /dev/null +++ b/examples/tiserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/tiserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + tiserver: + image: "gameservermanagers/linuxgsm-docker:tiserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/ts3server.yml b/examples/ts3server.yml new file mode 100644 index 0000000..41eb107 --- /dev/null +++ b/examples/ts3server.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/ts3server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + ts3server: + image: "gameservermanagers/linuxgsm-docker:ts3server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Voice + - "9987:9987/udp" + # Query / Telnet + - "10011:10011/tcp" diff --git a/examples/tsserver.yml b/examples/tsserver.yml new file mode 100644 index 0000000..f270cf0 --- /dev/null +++ b/examples/tsserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/tsserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + tsserver: + image: "gameservermanagers/linuxgsm-docker:tsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/tuserver.yml b/examples/tuserver.yml new file mode 100644 index 0000000..354bcb2 --- /dev/null +++ b/examples/tuserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/tuserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + tuserver: + image: "gameservermanagers/linuxgsm-docker:tuserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/twserver.yml b/examples/twserver.yml new file mode 100644 index 0000000..79af4f7 --- /dev/null +++ b/examples/twserver.yml @@ -0,0 +1,24 @@ + +# usage: +# docker-compose -f ./examples/twserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + twserver: + image: "gameservermanagers/linuxgsm-docker:twserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + # please fill your credentials below + - "CONFIGFORCED_steamuser=" + - "CONFIGFORCED_steampass=" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game / Query + - "8303:8303/udp" diff --git a/examples/untserver.yml b/examples/untserver.yml new file mode 100644 index 0000000..3763d35 --- /dev/null +++ b/examples/untserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/untserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + untserver: + image: "gameservermanagers/linuxgsm-docker:untserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game / Query + - "27015:27015/udp" + # Steam + - "27016:27016/udp" diff --git a/examples/ut2k4server.yml b/examples/ut2k4server.yml new file mode 100644 index 0000000..d5207ec --- /dev/null +++ b/examples/ut2k4server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/ut2k4server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + ut2k4server: + image: "gameservermanagers/linuxgsm-docker:ut2k4server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/ut3server.yml b/examples/ut3server.yml new file mode 100644 index 0000000..ff865e0 --- /dev/null +++ b/examples/ut3server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/ut3server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + ut3server: + image: "gameservermanagers/linuxgsm-docker:ut3server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/ut99server.yml b/examples/ut99server.yml new file mode 100644 index 0000000..ad4efce --- /dev/null +++ b/examples/ut99server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/ut99server.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + ut99server: + image: "gameservermanagers/linuxgsm-docker:ut99server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/utserver.yml b/examples/utserver.yml new file mode 100644 index 0000000..6dbb21a --- /dev/null +++ b/examples/utserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/utserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + utserver: + image: "gameservermanagers/linuxgsm-docker:utserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Query + - "7778:7778/udp" diff --git a/examples/vhserver.yml b/examples/vhserver.yml new file mode 100644 index 0000000..9e592b4 --- /dev/null +++ b/examples/vhserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/vhserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + vhserver: + image: "gameservermanagers/linuxgsm-docker:vhserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "2456:2456/udp" + # Query + - "2457:2457/udp" diff --git a/examples/vintsserver.yml b/examples/vintsserver.yml new file mode 100644 index 0000000..4081b7c --- /dev/null +++ b/examples/vintsserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/vintsserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + vintsserver: + image: "gameservermanagers/linuxgsm-docker:vintsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/vsserver.yml b/examples/vsserver.yml new file mode 100644 index 0000000..0b1f562 --- /dev/null +++ b/examples/vsserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/vsserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + vsserver: + image: "gameservermanagers/linuxgsm-docker:vsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/wetserver.yml b/examples/wetserver.yml new file mode 100644 index 0000000..efb0573 --- /dev/null +++ b/examples/wetserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/wetserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + wetserver: + image: "gameservermanagers/linuxgsm-docker:wetserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/wfserver.yml b/examples/wfserver.yml new file mode 100644 index 0000000..73c1b28 --- /dev/null +++ b/examples/wfserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/wfserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + wfserver: + image: "gameservermanagers/linuxgsm-docker:wfserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/wmcserver.yml b/examples/wmcserver.yml new file mode 100644 index 0000000..32f61f3 --- /dev/null +++ b/examples/wmcserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/wmcserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + wmcserver: + image: "gameservermanagers/linuxgsm-docker:wmcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/wurmserver.yml b/examples/wurmserver.yml new file mode 100644 index 0000000..34a560e --- /dev/null +++ b/examples/wurmserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/wurmserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + wurmserver: + image: "gameservermanagers/linuxgsm-docker:wurmserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/zmrserver.yml b/examples/zmrserver.yml new file mode 100644 index 0000000..3615a7c --- /dev/null +++ b/examples/zmrserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/zmrserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + zmrserver: + image: "gameservermanagers/linuxgsm-docker:zmrserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/zpsserver.yml b/examples/zpsserver.yml new file mode 100644 index 0000000..1eaaddf --- /dev/null +++ b/examples/zpsserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/zpsserver.yml up -d +volumes: + serverfiles: + +name: lgsm + +services: + zpsserver: + image: "gameservermanagers/linuxgsm-docker:zpsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - serverfiles:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/test/single.sh b/test/single.sh index 3e8b8d2..b8069ee 100755 --- a/test/single.sh +++ b/test/single.sh @@ -1,5 +1,7 @@ #!/bin/bash +echo "single.sh $@" + set -o errexit set -o nounset set -o pipefail @@ -108,7 +110,7 @@ done if [ -z "$GAMESERVER" ]; then echo "[error][single] no gameserver provided" exit 1 -elif grep -qEe "(^|\s)$GAMESERVER(\s|$)" <<< "${credentials_enabled[@]}"; then +elif grep -qEe "(^|\s)$GAMESERVER(\s|$)" <<< "${credentials_enabled[@]}" && ! "$BUILD_ONLY"; then echo "[info][single] $GAMESERVER can only be tested with steam credential" if [ -n "$steam_test_username" ] && [ -n "$steam_test_password" ]; then run+=(-e CONFIGFORCED_steamuser="$steam_test_username" -e CONFIGFORCED_steampass="$steam_test_password") From 5627e6369b6fde9bfa18b20f6c1dc6fd4b37e635 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 10 Aug 2022 21:11:39 +0200 Subject: [PATCH 105/116] doc: main readme not linking to others --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 136916c..344532f 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,7 @@ Dockerhub https://hub.docker.com/r/gameservermanagers/linuxgsm-docker/ 4. copy your own config into: `docker cp my_local_config.txt lgsm-SERVER-1:/config_location_from_step_3` 5. print config content `docker exec lgsm-SERVER-1 cat /config_location_from_step_3` +## Details +- [Repository / Container / Dev structure documentation](DEVELOPER.md) +- [How to build this / How to use it for lgsm testing](test/testing.md) From 796c6e8d392fb3db4fd2710822cb9f13f2d5d5b0 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Wed, 10 Aug 2022 21:32:21 +0200 Subject: [PATCH 106/116] doc: added docker usage examples --- README.md | 7 +++++++ test/single.sh | 2 +- test/testing.md | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 344532f..be056d8 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,15 @@ Dockerhub https://hub.docker.com/r/gameservermanagers/linuxgsm-docker/ 3. get config location `docker exec -it lgsm-SERVER-1 details` 4. copy your own config into: `docker cp my_local_config.txt lgsm-SERVER-1:/config_location_from_step_3` 5. print config content `docker exec lgsm-SERVER-1 cat /config_location_from_step_3` +6. stop with: + - Stopping container and keep files `docker-compose -f examples/SERVER.yml down` or `docker stop lgsm-SERVER-1` + - Stopping container and remove files `docker-compose -f examples/SERVER.yml down --volumes` ## Details +- build with: + - `./test/single.sh --build-only servercode` + - `./test/single.sh --help` + - [Repository / Container / Dev structure documentation](DEVELOPER.md) - [How to build this / How to use it for lgsm testing](test/testing.md) diff --git a/test/single.sh b/test/single.sh index b8069ee..36170e4 100755 --- a/test/single.sh +++ b/test/single.sh @@ -52,7 +52,7 @@ while [ $# -ge 1 ]; do echo "[help][single] --git-user x sets LGSM_GITHUBUSER" echo "[help][single] --skip-lgsm skip build lgsm" echo "[help][single] --very-fast overwrite healthcheck, only use it with volumes / lancache because container will else fail pretty fast" - echo "[help][single] --version x use linuxgsm version x e.g. \"v21.4.1\"" + echo "[help][single] --version x use linuxgsm version x e.g. \"v21.4.1\" can be a commit id(even fork) / branch" echo "[help][single] --volume x use volume x e.g. \"lgsm\"" echo "[help][single] " echo "[help][single] server e.g. gmodserver" diff --git a/test/testing.md b/test/testing.md index 6147d31..28e6573 100644 --- a/test/testing.md +++ b/test/testing.md @@ -27,7 +27,8 @@ ### I just want to build this image, how? -`./single.sh --build-only --latest servercode` +- `./single.sh --build-only servercode` +- `./single.sh --build-only --version commit-id-from-fork servercode` ### I created a lgsm fork and want to test it From 89d2eec4ac55cab523a8c16824d47d3e014b93a3 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 11 Aug 2022 19:14:36 +0200 Subject: [PATCH 107/116] examples: volumes should contain service name --- deploy/generateExamples.sh | 4 ++-- examples/ahl2server.yml | 17 +++++++++++------ examples/ahlserver.yml | 4 ++-- examples/arkserver.yml | 15 ++++++--------- examples/arma3server.yml | 15 +++++++++------ examples/armarserver.yml | 11 +++++------ examples/avserver.yml | 4 ++-- examples/bb2server.yml | 4 ++-- examples/bbserver.yml | 13 ++++++------- examples/bdserver.yml | 4 ++-- examples/bf1942server.yml | 4 ++-- examples/bfvserver.yml | 4 ++-- examples/bmdmserver.yml | 17 ++++++----------- examples/boserver.yml | 4 ++-- examples/bsserver.yml | 4 ++-- examples/bt1944server.yml | 15 +++++++++------ examples/btserver.yml | 4 ++-- examples/ccserver.yml | 17 ++++++----------- examples/cdserver.yml | 4 ++-- examples/cmwserver.yml | 13 ++++++------- examples/cod2server.yml | 4 ++-- examples/cod4server.yml | 11 +++++------ examples/codserver.yml | 11 ++++++----- examples/coduoserver.yml | 11 ++++++----- examples/codwawserver.yml | 4 ++-- examples/colserver.yml | 4 ++-- examples/csczserver.yml | 4 ++-- examples/csgoserver.yml | 17 ++++++----------- examples/csserver.yml | 13 +++++++------ examples/cssserver.yml | 17 ++++++----------- examples/dabserver.yml | 17 ++++++----------- examples/dayzserver.yml | 4 ++-- examples/dmcserver.yml | 4 ++-- examples/dodrserver.yml | 13 +++++++------ examples/dodserver.yml | 4 ++-- examples/dodsserver.yml | 4 ++-- examples/doiserver.yml | 17 +++++++++++------ examples/dstserver.yml | 4 ++-- examples/dysserver.yml | 4 ++-- examples/ecoserver.yml | 4 ++-- examples/emserver.yml | 17 +++++++++++------ examples/etlserver.yml | 4 ++-- examples/fctrserver.yml | 13 +++++++------ examples/fofserver.yml | 4 ++-- examples/gmodserver.yml | 4 ++-- examples/hl2dmserver.yml | 17 +++++++++++------ examples/hldmserver.yml | 4 ++-- examples/hldmsserver.yml | 17 ++++++----------- examples/hwserver.yml | 13 +++++++------ examples/insserver.yml | 17 +++++++++++------ examples/inssserver.yml | 15 +++++++++------ examples/iosserver.yml | 17 ++++++----------- examples/jc2server.yml | 4 ++-- examples/jc3server.yml | 4 ++-- examples/jk2server.yml | 4 ++-- examples/kf2server.yml | 4 ++-- examples/kfserver.yml | 4 ++-- examples/l4d2server.yml | 4 ++-- examples/l4dserver.yml | 15 ++++++--------- examples/loserver.yml | 13 +++++++------ examples/mcbserver.yml | 4 ++-- examples/mcserver.yml | 4 ++-- examples/mhserver.yml | 15 ++++++--------- examples/mohaaserver.yml | 11 +++++------ examples/momserver.yml | 13 ++++++------- examples/mtaserver.yml | 4 ++-- examples/mumbleserver.yml | 4 ++-- examples/ndserver.yml | 4 ++-- examples/nmrihserver.yml | 4 ++-- examples/ns2cserver.yml | 13 +++++++------ examples/ns2server.yml | 4 ++-- examples/nsserver.yml | 13 +++++++------ examples/opforserver.yml | 13 +++++++------ examples/pc2server.yml | 4 ++-- examples/pcserver.yml | 4 ++-- examples/pmcserver.yml | 4 ++-- examples/pstbsserver.yml | 4 ++-- examples/pvkiiserver.yml | 4 ++-- examples/pvrserver.yml | 13 +++++++------ examples/q2server.yml | 11 ++++++----- examples/q3server.yml | 11 ++++++----- examples/qlserver.yml | 4 ++-- examples/qwserver.yml | 4 ++-- examples/ricochetserver.yml | 13 +++++++------ examples/roserver.yml | 4 ++-- examples/rtcwserver.yml | 4 ++-- examples/rustserver.yml | 15 ++++++--------- examples/sampserver.yml | 4 ++-- examples/sbotsserver.yml | 4 ++-- examples/sbserver.yml | 4 ++-- examples/scpslserver.yml | 4 ++-- examples/scpslsmserver.yml | 11 +++++------ examples/sdtdserver.yml | 4 ++-- examples/sfcserver.yml | 4 ++-- examples/sfserver.yml | 4 ++-- examples/sof2server.yml | 11 ++++++----- examples/solserver.yml | 4 ++-- examples/squadserver.yml | 4 ++-- examples/stnserver.yml | 4 ++-- examples/stserver.yml | 13 ++++++------- examples/svenserver.yml | 13 +++++++------ examples/tf2server.yml | 4 ++-- examples/tfcserver.yml | 13 +++++++------ examples/tiserver.yml | 13 +++++++------ examples/ts3server.yml | 13 ++++++------- examples/tsserver.yml | 4 ++-- examples/tuserver.yml | 15 +++++++++------ examples/twserver.yml | 11 ++++++----- examples/untserver.yml | 4 ++-- examples/ut2k4server.yml | 4 ++-- examples/ut3server.yml | 4 ++-- examples/ut99server.yml | 4 ++-- examples/utserver.yml | 4 ++-- examples/vhserver.yml | 4 ++-- examples/vintsserver.yml | 4 ++-- examples/vsserver.yml | 4 ++-- examples/wetserver.yml | 4 ++-- examples/wfserver.yml | 4 ++-- examples/wmcserver.yml | 4 ++-- examples/wurmserver.yml | 4 ++-- examples/zmrserver.yml | 17 ++++++----------- examples/zpsserver.yml | 4 ++-- 122 files changed, 486 insertions(+), 491 deletions(-) diff --git a/deploy/generateExamples.sh b/deploy/generateExamples.sh index 7b765b2..de920b2 100755 --- a/deploy/generateExamples.sh +++ b/deploy/generateExamples.sh @@ -65,7 +65,7 @@ rebuild="false" # usage: # docker-compose -f ./examples/$server.yml up -d volumes: - serverfiles: + $server-files: name: lgsm @@ -77,7 +77,7 @@ services: environment: - \"CRON_update_daily=0 7 * * * update\"$steam_credentials_needed volumes: - - serverfiles:/home/linuxgsm + - $server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro" echo "$compose_file" > "examples/$server.yml" diff --git a/examples/ahl2server.yml b/examples/ahl2server.yml index 3db9b28..aba99cf 100644 --- a/examples/ahl2server.yml +++ b/examples/ahl2server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/ahl2server.yml up -d volumes: - serverfiles: + ahl2server-files: name: lgsm @@ -17,9 +17,14 @@ services: - "CONFIGFORCED_steamuser=" - "CONFIGFORCED_steampass=" volumes: - - serverfiles:/home/linuxgsm + - ahl2server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/ahlserver.yml b/examples/ahlserver.yml index 2864106..0b93cfb 100644 --- a/examples/ahlserver.yml +++ b/examples/ahlserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/ahlserver.yml up -d volumes: - serverfiles: + ahlserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - ahlserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/arkserver.yml b/examples/arkserver.yml index b664be7..74e684a 100644 --- a/examples/arkserver.yml +++ b/examples/arkserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/arkserver.yml up -d volumes: - serverfiles: + arkserver-files: name: lgsm @@ -14,12 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - arkserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "7777:7777/udp" - # Query - - "27015:27015/udp" - # RCON - - "27020:27020/tcp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/arma3server.yml b/examples/arma3server.yml index 307c53b..9b6d07e 100644 --- a/examples/arma3server.yml +++ b/examples/arma3server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/arma3server.yml up -d volumes: - serverfiles: + arma3server-files: name: lgsm @@ -17,9 +17,12 @@ services: - "CONFIGFORCED_steamuser=" - "CONFIGFORCED_steampass=" volumes: - - serverfiles:/home/linuxgsm + - arma3server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game / Voice + - "2302:2302/udp" + # Query + - "2303:2303/udp" + # BattleEye + - "2306:2306/udp" diff --git a/examples/armarserver.yml b/examples/armarserver.yml index f80e110..6428c26 100644 --- a/examples/armarserver.yml +++ b/examples/armarserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/armarserver.yml up -d volumes: - serverfiles: + armarserver-files: name: lgsm @@ -14,9 +14,8 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - armarserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "0:0/udp" diff --git a/examples/avserver.yml b/examples/avserver.yml index fcbdf44..759e0a7 100644 --- a/examples/avserver.yml +++ b/examples/avserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/avserver.yml up -d volumes: - serverfiles: + avserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - avserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/bb2server.yml b/examples/bb2server.yml index 6c06b39..4b596c6 100644 --- a/examples/bb2server.yml +++ b/examples/bb2server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/bb2server.yml up -d volumes: - serverfiles: + bb2server-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - bb2server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/bbserver.yml b/examples/bbserver.yml index 1159694..bc82224 100644 --- a/examples/bbserver.yml +++ b/examples/bbserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/bbserver.yml up -d volumes: - serverfiles: + bbserver-files: name: lgsm @@ -14,10 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - bbserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27015:27015/udp" - # Client - - "27005:27005/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/bdserver.yml b/examples/bdserver.yml index 9df1e54..0b8d24f 100644 --- a/examples/bdserver.yml +++ b/examples/bdserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/bdserver.yml up -d volumes: - serverfiles: + bdserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - bdserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/bf1942server.yml b/examples/bf1942server.yml index 02303e2..b2f32ad 100644 --- a/examples/bf1942server.yml +++ b/examples/bf1942server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/bf1942server.yml up -d volumes: - serverfiles: + bf1942server-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - bf1942server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/bfvserver.yml b/examples/bfvserver.yml index 6b2c0ee..1e75f3d 100644 --- a/examples/bfvserver.yml +++ b/examples/bfvserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/bfvserver.yml up -d volumes: - serverfiles: + bfvserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - bfvserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/bmdmserver.yml b/examples/bmdmserver.yml index 21bb0ed..4bb5a8b 100644 --- a/examples/bmdmserver.yml +++ b/examples/bmdmserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/bmdmserver.yml up -d volumes: - serverfiles: + bmdmserver-files: name: lgsm @@ -14,14 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - bmdmserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27015:27015/udp" - # Query / RCON - - "27015:27015/tcp" - # SourceTV - - "27020:27020/udp" - # Client - - "27005:27005/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/boserver.yml b/examples/boserver.yml index 687ec80..8c929a2 100644 --- a/examples/boserver.yml +++ b/examples/boserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/boserver.yml up -d volumes: - serverfiles: + boserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - boserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/bsserver.yml b/examples/bsserver.yml index 36d22e2..9d07164 100644 --- a/examples/bsserver.yml +++ b/examples/bsserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/bsserver.yml up -d volumes: - serverfiles: + bsserver-files: name: lgsm @@ -17,7 +17,7 @@ services: - "CONFIGFORCED_steamuser=" - "CONFIGFORCED_steampass=" volumes: - - serverfiles:/home/linuxgsm + - bsserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/bt1944server.yml b/examples/bt1944server.yml index d2f5ff1..dd084ef 100644 --- a/examples/bt1944server.yml +++ b/examples/bt1944server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/bt1944server.yml up -d volumes: - serverfiles: + bt1944server-files: name: lgsm @@ -14,9 +14,12 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - bt1944server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "7777:7777/udp" + # Query + - "7780:7780/udp" + # RCON + - "7779:7779/tcp" diff --git a/examples/btserver.yml b/examples/btserver.yml index c40b6cb..7239f3c 100644 --- a/examples/btserver.yml +++ b/examples/btserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/btserver.yml up -d volumes: - serverfiles: + btserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - btserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/ccserver.yml b/examples/ccserver.yml index 6853151..bcaf27d 100644 --- a/examples/ccserver.yml +++ b/examples/ccserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/ccserver.yml up -d volumes: - serverfiles: + ccserver-files: name: lgsm @@ -14,14 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - ccserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27015:27015/udp" - # Query / RCON - - "27015:27015/tcp" - # SourceTV - - "27020:27020/udp" - # Client - - "27005:27005/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/cdserver.yml b/examples/cdserver.yml index 90dd38b..4d517b1 100644 --- a/examples/cdserver.yml +++ b/examples/cdserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/cdserver.yml up -d volumes: - serverfiles: + cdserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - cdserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/cmwserver.yml b/examples/cmwserver.yml index d49ec32..d31e987 100644 --- a/examples/cmwserver.yml +++ b/examples/cmwserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/cmwserver.yml up -d volumes: - serverfiles: + cmwserver-files: name: lgsm @@ -14,10 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - cmwserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "7777:7777/udp" - # Query - - "7779:7779/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/cod2server.yml b/examples/cod2server.yml index 41e7d70..d3d2adb 100644 --- a/examples/cod2server.yml +++ b/examples/cod2server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/cod2server.yml up -d volumes: - serverfiles: + cod2server-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - cod2server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/cod4server.yml b/examples/cod4server.yml index 4627b7f..cf31dce 100644 --- a/examples/cod4server.yml +++ b/examples/cod4server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/cod4server.yml up -d volumes: - serverfiles: + cod4server-files: name: lgsm @@ -14,9 +14,8 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - cod4server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game / Query + - "28960:28960/udp" diff --git a/examples/codserver.yml b/examples/codserver.yml index 6940944..96c085d 100644 --- a/examples/codserver.yml +++ b/examples/codserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/codserver.yml up -d volumes: - serverfiles: + codserver-files: name: lgsm @@ -14,8 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - codserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "28960:28960/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/coduoserver.yml b/examples/coduoserver.yml index 3604b84..c33388d 100644 --- a/examples/coduoserver.yml +++ b/examples/coduoserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/coduoserver.yml up -d volumes: - serverfiles: + coduoserver-files: name: lgsm @@ -14,8 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - coduoserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "28960:28960/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/codwawserver.yml b/examples/codwawserver.yml index eed18f8..130ea1f 100644 --- a/examples/codwawserver.yml +++ b/examples/codwawserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/codwawserver.yml up -d volumes: - serverfiles: + codwawserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - codwawserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game / Query diff --git a/examples/colserver.yml b/examples/colserver.yml index 2ee7661..298d12d 100644 --- a/examples/colserver.yml +++ b/examples/colserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/colserver.yml up -d volumes: - serverfiles: + colserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - colserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/csczserver.yml b/examples/csczserver.yml index f144427..765a8e2 100644 --- a/examples/csczserver.yml +++ b/examples/csczserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/csczserver.yml up -d volumes: - serverfiles: + csczserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - csczserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/csgoserver.yml b/examples/csgoserver.yml index 79c182d..6bdedce 100644 --- a/examples/csgoserver.yml +++ b/examples/csgoserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/csgoserver.yml up -d volumes: - serverfiles: + csgoserver-files: name: lgsm @@ -14,14 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - csgoserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27015:27015/udp" - # Query / RCON - - "27015:27015/tcp" - # SourceTV - - "27020:27020/udp" - # Client - - "27005:27005/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/csserver.yml b/examples/csserver.yml index dc2b862..b6ec842 100644 --- a/examples/csserver.yml +++ b/examples/csserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/csserver.yml up -d volumes: - serverfiles: + csserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - csserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/cssserver.yml b/examples/cssserver.yml index 1a939c9..e8fe461 100644 --- a/examples/cssserver.yml +++ b/examples/cssserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/cssserver.yml up -d volumes: - serverfiles: + cssserver-files: name: lgsm @@ -14,14 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - cssserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27015:27015/udp" - # Query / RCON - - "27015:27015/tcp" - # SourceTV - - "27020:27020/udp" - # Client - - "27005:27005/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/dabserver.yml b/examples/dabserver.yml index 0d0a211..f56fd2b 100644 --- a/examples/dabserver.yml +++ b/examples/dabserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/dabserver.yml up -d volumes: - serverfiles: + dabserver-files: name: lgsm @@ -14,14 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - dabserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27015:27015/udp" - # Query / RCON - - "27015:27015/tcp" - # SourceTV - - "27020:27020/udp" - # Client - - "27005:27005/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/dayzserver.yml b/examples/dayzserver.yml index 165d49c..5641830 100644 --- a/examples/dayzserver.yml +++ b/examples/dayzserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/dayzserver.yml up -d volumes: - serverfiles: + dayzserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - dayzserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/dmcserver.yml b/examples/dmcserver.yml index 5e95584..9838818 100644 --- a/examples/dmcserver.yml +++ b/examples/dmcserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/dmcserver.yml up -d volumes: - serverfiles: + dmcserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - dmcserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/dodrserver.yml b/examples/dodrserver.yml index 62ae989..c6beb87 100644 --- a/examples/dodrserver.yml +++ b/examples/dodrserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/dodrserver.yml up -d volumes: - serverfiles: + dodrserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - dodrserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "7777:7777/udp" + # Query + - "27015:27015/udp" diff --git a/examples/dodserver.yml b/examples/dodserver.yml index 4328898..204893f 100644 --- a/examples/dodserver.yml +++ b/examples/dodserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/dodserver.yml up -d volumes: - serverfiles: + dodserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - dodserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/dodsserver.yml b/examples/dodsserver.yml index 895ce8a..099b853 100644 --- a/examples/dodsserver.yml +++ b/examples/dodsserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/dodsserver.yml up -d volumes: - serverfiles: + dodsserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - dodsserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/doiserver.yml b/examples/doiserver.yml index d1d8c8e..2c1f085 100644 --- a/examples/doiserver.yml +++ b/examples/doiserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/doiserver.yml up -d volumes: - serverfiles: + doiserver-files: name: lgsm @@ -14,9 +14,14 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - doiserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/dstserver.yml b/examples/dstserver.yml index 33fca91..5c0c091 100644 --- a/examples/dstserver.yml +++ b/examples/dstserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/dstserver.yml up -d volumes: - serverfiles: + dstserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - dstserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/dysserver.yml b/examples/dysserver.yml index 959d5b3..f6b50df 100644 --- a/examples/dysserver.yml +++ b/examples/dysserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/dysserver.yml up -d volumes: - serverfiles: + dysserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - dysserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/ecoserver.yml b/examples/ecoserver.yml index 797bf3f..9b65ad8 100644 --- a/examples/ecoserver.yml +++ b/examples/ecoserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/ecoserver.yml up -d volumes: - serverfiles: + ecoserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - ecoserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/emserver.yml b/examples/emserver.yml index 4e677df..4f6922e 100644 --- a/examples/emserver.yml +++ b/examples/emserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/emserver.yml up -d volumes: - serverfiles: + emserver-files: name: lgsm @@ -14,9 +14,14 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - emserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/etlserver.yml b/examples/etlserver.yml index c1c296f..e483c97 100644 --- a/examples/etlserver.yml +++ b/examples/etlserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/etlserver.yml up -d volumes: - serverfiles: + etlserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - etlserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/fctrserver.yml b/examples/fctrserver.yml index 000ff5f..aac5598 100644 --- a/examples/fctrserver.yml +++ b/examples/fctrserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/fctrserver.yml up -d volumes: - serverfiles: + fctrserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - fctrserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "34197:34197/udp" + # RCON + - "34198:34198/tcp" diff --git a/examples/fofserver.yml b/examples/fofserver.yml index 0299378..0b663bf 100644 --- a/examples/fofserver.yml +++ b/examples/fofserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/fofserver.yml up -d volumes: - serverfiles: + fofserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - fofserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/gmodserver.yml b/examples/gmodserver.yml index 096ec40..0f76ad6 100644 --- a/examples/gmodserver.yml +++ b/examples/gmodserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/gmodserver.yml up -d volumes: - serverfiles: + gmodserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - gmodserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/hl2dmserver.yml b/examples/hl2dmserver.yml index 8a8e789..8ccaaea 100644 --- a/examples/hl2dmserver.yml +++ b/examples/hl2dmserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/hl2dmserver.yml up -d volumes: - serverfiles: + hl2dmserver-files: name: lgsm @@ -14,9 +14,14 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - hl2dmserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/hldmserver.yml b/examples/hldmserver.yml index 9b073bb..97524a2 100644 --- a/examples/hldmserver.yml +++ b/examples/hldmserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/hldmserver.yml up -d volumes: - serverfiles: + hldmserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - hldmserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/hldmsserver.yml b/examples/hldmsserver.yml index b69550b..c3fd545 100644 --- a/examples/hldmsserver.yml +++ b/examples/hldmsserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/hldmsserver.yml up -d volumes: - serverfiles: + hldmsserver-files: name: lgsm @@ -14,14 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - hldmsserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27015:27015/udp" - # Query / RCON - - "27015:27015/tcp" - # SourceTV - - "27020:27020/udp" - # Client - - "27005:27005/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/hwserver.yml b/examples/hwserver.yml index d0bbae2..6f8ec85 100644 --- a/examples/hwserver.yml +++ b/examples/hwserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/hwserver.yml up -d volumes: - serverfiles: + hwserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - hwserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "12871:12871/udp" + # Query + - "12881:12881/udp" diff --git a/examples/insserver.yml b/examples/insserver.yml index f2b9b08..4beae34 100644 --- a/examples/insserver.yml +++ b/examples/insserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/insserver.yml up -d volumes: - serverfiles: + insserver-files: name: lgsm @@ -14,9 +14,14 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - insserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" diff --git a/examples/inssserver.yml b/examples/inssserver.yml index d621e3a..b18d93f 100644 --- a/examples/inssserver.yml +++ b/examples/inssserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/inssserver.yml up -d volumes: - serverfiles: + inssserver-files: name: lgsm @@ -14,9 +14,12 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - inssserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27102:27102/udp" + # Query + - "27131:27131/udp" + # RCON + - "27015:27015/tcp" diff --git a/examples/iosserver.yml b/examples/iosserver.yml index 6615618..9bf536d 100644 --- a/examples/iosserver.yml +++ b/examples/iosserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/iosserver.yml up -d volumes: - serverfiles: + iosserver-files: name: lgsm @@ -14,14 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - iosserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27015:27015/udp" - # Query / RCON - - "27015:27015/tcp" - # SourceTV - - "27020:27020/udp" - # Client - - "27005:27005/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/jc2server.yml b/examples/jc2server.yml index a852b50..634f5b5 100644 --- a/examples/jc2server.yml +++ b/examples/jc2server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/jc2server.yml up -d volumes: - serverfiles: + jc2server-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - jc2server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/jc3server.yml b/examples/jc3server.yml index 9f26011..0035769 100644 --- a/examples/jc3server.yml +++ b/examples/jc3server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/jc3server.yml up -d volumes: - serverfiles: + jc3server-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - jc3server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/jk2server.yml b/examples/jk2server.yml index bdce0bb..fdc9561 100644 --- a/examples/jk2server.yml +++ b/examples/jk2server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/jk2server.yml up -d volumes: - serverfiles: + jk2server-files: name: lgsm @@ -17,7 +17,7 @@ services: - "CONFIGFORCED_steamuser=" - "CONFIGFORCED_steampass=" volumes: - - serverfiles:/home/linuxgsm + - jk2server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/kf2server.yml b/examples/kf2server.yml index 345dcb0..dbc03df 100644 --- a/examples/kf2server.yml +++ b/examples/kf2server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/kf2server.yml up -d volumes: - serverfiles: + kf2server-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - kf2server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/kfserver.yml b/examples/kfserver.yml index 2f74a4f..9e300f1 100644 --- a/examples/kfserver.yml +++ b/examples/kfserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/kfserver.yml up -d volumes: - serverfiles: + kfserver-files: name: lgsm @@ -17,7 +17,7 @@ services: - "CONFIGFORCED_steamuser=" - "CONFIGFORCED_steampass=" volumes: - - serverfiles:/home/linuxgsm + - kfserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/l4d2server.yml b/examples/l4d2server.yml index b9b1410..858276b 100644 --- a/examples/l4d2server.yml +++ b/examples/l4d2server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/l4d2server.yml up -d volumes: - serverfiles: + l4d2server-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - l4d2server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/l4dserver.yml b/examples/l4dserver.yml index debca56..86f4a6b 100644 --- a/examples/l4dserver.yml +++ b/examples/l4dserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/l4dserver.yml up -d volumes: - serverfiles: + l4dserver-files: name: lgsm @@ -14,12 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - l4dserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27015:27015/udp" - # Query / RCON - - "27015:27015/tcp" - # Client - - "27005:27005/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/loserver.yml b/examples/loserver.yml index 134ed84..7071896 100644 --- a/examples/loserver.yml +++ b/examples/loserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/loserver.yml up -d volumes: - serverfiles: + loserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - loserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "7777:7777/udp" + # Query + - "27015:27015/udp" diff --git a/examples/mcbserver.yml b/examples/mcbserver.yml index 6a1b5ce..d730564 100644 --- a/examples/mcbserver.yml +++ b/examples/mcbserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/mcbserver.yml up -d volumes: - serverfiles: + mcbserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - mcbserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/mcserver.yml b/examples/mcserver.yml index 8d6ce14..5936a9f 100644 --- a/examples/mcserver.yml +++ b/examples/mcserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/mcserver.yml up -d volumes: - serverfiles: + mcserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - mcserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/mhserver.yml b/examples/mhserver.yml index 39c5b90..3e47a39 100644 --- a/examples/mhserver.yml +++ b/examples/mhserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/mhserver.yml up -d volumes: - serverfiles: + mhserver-files: name: lgsm @@ -14,12 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - mhserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "7777:7777/udp" - # Query - - "27015:27015/udp" - # Beacon - - "15000:15000/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/mohaaserver.yml b/examples/mohaaserver.yml index a5fc395..705950d 100644 --- a/examples/mohaaserver.yml +++ b/examples/mohaaserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/mohaaserver.yml up -d volumes: - serverfiles: + mohaaserver-files: name: lgsm @@ -14,9 +14,8 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - mohaaserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "12203:12203/udp" diff --git a/examples/momserver.yml b/examples/momserver.yml index 3c61629..b6d3bf6 100644 --- a/examples/momserver.yml +++ b/examples/momserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/momserver.yml up -d volumes: - serverfiles: + momserver-files: name: lgsm @@ -14,10 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - momserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "7777:7777/udp" - # Beacon - - "15000:15000/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/mtaserver.yml b/examples/mtaserver.yml index 266af7a..56d4016 100644 --- a/examples/mtaserver.yml +++ b/examples/mtaserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/mtaserver.yml up -d volumes: - serverfiles: + mtaserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - mtaserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/mumbleserver.yml b/examples/mumbleserver.yml index afc9859..0bbed1b 100644 --- a/examples/mumbleserver.yml +++ b/examples/mumbleserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/mumbleserver.yml up -d volumes: - serverfiles: + mumbleserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - mumbleserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Voice diff --git a/examples/ndserver.yml b/examples/ndserver.yml index 5d5b028..85f2ada 100644 --- a/examples/ndserver.yml +++ b/examples/ndserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/ndserver.yml up -d volumes: - serverfiles: + ndserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - ndserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/nmrihserver.yml b/examples/nmrihserver.yml index fb3e75a..e2c63df 100644 --- a/examples/nmrihserver.yml +++ b/examples/nmrihserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/nmrihserver.yml up -d volumes: - serverfiles: + nmrihserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - nmrihserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/ns2cserver.yml b/examples/ns2cserver.yml index 6b634b7..3e9ee25 100644 --- a/examples/ns2cserver.yml +++ b/examples/ns2cserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/ns2cserver.yml up -d volumes: - serverfiles: + ns2cserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - ns2cserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27015:27015/udp" + # Query + - "27016:27016/udp" diff --git a/examples/ns2server.yml b/examples/ns2server.yml index 9eca9ac..e29ae7f 100644 --- a/examples/ns2server.yml +++ b/examples/ns2server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/ns2server.yml up -d volumes: - serverfiles: + ns2server-files: name: lgsm @@ -17,7 +17,7 @@ services: - "CONFIGFORCED_steamuser=" - "CONFIGFORCED_steampass=" volumes: - - serverfiles:/home/linuxgsm + - ns2server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/nsserver.yml b/examples/nsserver.yml index 909b4c1..9568455 100644 --- a/examples/nsserver.yml +++ b/examples/nsserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/nsserver.yml up -d volumes: - serverfiles: + nsserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - nsserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/opforserver.yml b/examples/opforserver.yml index 0a01a36..eb9774a 100644 --- a/examples/opforserver.yml +++ b/examples/opforserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/opforserver.yml up -d volumes: - serverfiles: + opforserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - opforserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/pc2server.yml b/examples/pc2server.yml index e567eaa..4453175 100644 --- a/examples/pc2server.yml +++ b/examples/pc2server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/pc2server.yml up -d volumes: - serverfiles: + pc2server-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - pc2server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/pcserver.yml b/examples/pcserver.yml index 7cafc81..c40a162 100644 --- a/examples/pcserver.yml +++ b/examples/pcserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/pcserver.yml up -d volumes: - serverfiles: + pcserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - pcserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/pmcserver.yml b/examples/pmcserver.yml index 077fcf6..be929c9 100644 --- a/examples/pmcserver.yml +++ b/examples/pmcserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/pmcserver.yml up -d volumes: - serverfiles: + pmcserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - pmcserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/pstbsserver.yml b/examples/pstbsserver.yml index 03d2076..9c5a140 100644 --- a/examples/pstbsserver.yml +++ b/examples/pstbsserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/pstbsserver.yml up -d volumes: - serverfiles: + pstbsserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - pstbsserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/pvkiiserver.yml b/examples/pvkiiserver.yml index 005f937..db54739 100644 --- a/examples/pvkiiserver.yml +++ b/examples/pvkiiserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/pvkiiserver.yml up -d volumes: - serverfiles: + pvkiiserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - pvkiiserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/pvrserver.yml b/examples/pvrserver.yml index 91b64a6..9995aa5 100644 --- a/examples/pvrserver.yml +++ b/examples/pvrserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/pvrserver.yml up -d volumes: - serverfiles: + pvrserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - pvrserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "7777:7777/udp" + # Game / Query + - "7777:7777/tcp" diff --git a/examples/q2server.yml b/examples/q2server.yml index 28659a3..e3f2b94 100644 --- a/examples/q2server.yml +++ b/examples/q2server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/q2server.yml up -d volumes: - serverfiles: + q2server-files: name: lgsm @@ -14,8 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - q2server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27910:27910/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/q3server.yml b/examples/q3server.yml index 78b4267..ed1b15e 100644 --- a/examples/q3server.yml +++ b/examples/q3server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/q3server.yml up -d volumes: - serverfiles: + q3server-files: name: lgsm @@ -14,8 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - q3server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27960:27960/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/qlserver.yml b/examples/qlserver.yml index 08d72ff..a333632 100644 --- a/examples/qlserver.yml +++ b/examples/qlserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/qlserver.yml up -d volumes: - serverfiles: + qlserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - qlserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/qwserver.yml b/examples/qwserver.yml index e9632e6..d8d136b 100644 --- a/examples/qwserver.yml +++ b/examples/qwserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/qwserver.yml up -d volumes: - serverfiles: + qwserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - qwserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/ricochetserver.yml b/examples/ricochetserver.yml index b1b5bb5..78c75a3 100644 --- a/examples/ricochetserver.yml +++ b/examples/ricochetserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/ricochetserver.yml up -d volumes: - serverfiles: + ricochetserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - ricochetserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/roserver.yml b/examples/roserver.yml index a769fbe..458f55f 100644 --- a/examples/roserver.yml +++ b/examples/roserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/roserver.yml up -d volumes: - serverfiles: + roserver-files: name: lgsm @@ -17,7 +17,7 @@ services: - "CONFIGFORCED_steamuser=" - "CONFIGFORCED_steampass=" volumes: - - serverfiles:/home/linuxgsm + - roserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/rtcwserver.yml b/examples/rtcwserver.yml index 7f79a1d..b8da40b 100644 --- a/examples/rtcwserver.yml +++ b/examples/rtcwserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/rtcwserver.yml up -d volumes: - serverfiles: + rtcwserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - rtcwserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/rustserver.yml b/examples/rustserver.yml index e12dcfe..34749ce 100644 --- a/examples/rustserver.yml +++ b/examples/rustserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/rustserver.yml up -d volumes: - serverfiles: + rustserver-files: name: lgsm @@ -14,12 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - rustserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game / Query - - "28015:28015/udp" - # RCON - - "28016:28016/tcp" - # App - - "28082:28082/tcp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/sampserver.yml b/examples/sampserver.yml index 2d46191..514b83b 100644 --- a/examples/sampserver.yml +++ b/examples/sampserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/sampserver.yml up -d volumes: - serverfiles: + sampserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - sampserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/sbotsserver.yml b/examples/sbotsserver.yml index a432ca0..fca0c1c 100644 --- a/examples/sbotsserver.yml +++ b/examples/sbotsserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/sbotsserver.yml up -d volumes: - serverfiles: + sbotsserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - sbotsserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/sbserver.yml b/examples/sbserver.yml index 24ba71b..e2b4793 100644 --- a/examples/sbserver.yml +++ b/examples/sbserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/sbserver.yml up -d volumes: - serverfiles: + sbserver-files: name: lgsm @@ -17,7 +17,7 @@ services: - "CONFIGFORCED_steamuser=" - "CONFIGFORCED_steampass=" volumes: - - serverfiles:/home/linuxgsm + - sbserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/scpslserver.yml b/examples/scpslserver.yml index db2e472..51c1d4f 100644 --- a/examples/scpslserver.yml +++ b/examples/scpslserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/scpslserver.yml up -d volumes: - serverfiles: + scpslserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - scpslserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/scpslsmserver.yml b/examples/scpslsmserver.yml index cb9f776..aff3998 100644 --- a/examples/scpslsmserver.yml +++ b/examples/scpslsmserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/scpslsmserver.yml up -d volumes: - serverfiles: + scpslsmserver-files: name: lgsm @@ -14,9 +14,8 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - scpslsmserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "7777:7777/tcp" diff --git a/examples/sdtdserver.yml b/examples/sdtdserver.yml index ce3775e..6ba013a 100644 --- a/examples/sdtdserver.yml +++ b/examples/sdtdserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/sdtdserver.yml up -d volumes: - serverfiles: + sdtdserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - sdtdserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/sfcserver.yml b/examples/sfcserver.yml index 00c307a..df12d2c 100644 --- a/examples/sfcserver.yml +++ b/examples/sfcserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/sfcserver.yml up -d volumes: - serverfiles: + sfcserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - sfcserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/sfserver.yml b/examples/sfserver.yml index 819b180..f0ab038 100644 --- a/examples/sfserver.yml +++ b/examples/sfserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/sfserver.yml up -d volumes: - serverfiles: + sfserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - sfserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/sof2server.yml b/examples/sof2server.yml index 86ce907..12aa85c 100644 --- a/examples/sof2server.yml +++ b/examples/sof2server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/sof2server.yml up -d volumes: - serverfiles: + sof2server-files: name: lgsm @@ -14,8 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - sof2server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game / Query - - "20100:20100/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/solserver.yml b/examples/solserver.yml index abca0c3..c96ba13 100644 --- a/examples/solserver.yml +++ b/examples/solserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/solserver.yml up -d volumes: - serverfiles: + solserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - solserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/squadserver.yml b/examples/squadserver.yml index 11843d9..866e223 100644 --- a/examples/squadserver.yml +++ b/examples/squadserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/squadserver.yml up -d volumes: - serverfiles: + squadserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - squadserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/stnserver.yml b/examples/stnserver.yml index 58f76e3..957cd34 100644 --- a/examples/stnserver.yml +++ b/examples/stnserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/stnserver.yml up -d volumes: - serverfiles: + stnserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - stnserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/stserver.yml b/examples/stserver.yml index 75c465d..b917545 100644 --- a/examples/stserver.yml +++ b/examples/stserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/stserver.yml up -d volumes: - serverfiles: + stserver-files: name: lgsm @@ -14,10 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - stserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27500:27500/udp" - # Query - - "27015:27015/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/svenserver.yml b/examples/svenserver.yml index b1be400..9b37bf8 100644 --- a/examples/svenserver.yml +++ b/examples/svenserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/svenserver.yml up -d volumes: - serverfiles: + svenserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - svenserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/tf2server.yml b/examples/tf2server.yml index dbcc0ba..49d0444 100644 --- a/examples/tf2server.yml +++ b/examples/tf2server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/tf2server.yml up -d volumes: - serverfiles: + tf2server-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - tf2server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/tfcserver.yml b/examples/tfcserver.yml index 18f590a..260d10d 100644 --- a/examples/tfcserver.yml +++ b/examples/tfcserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/tfcserver.yml up -d volumes: - serverfiles: + tfcserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - tfcserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/tiserver.yml b/examples/tiserver.yml index 7fccc66..2b69781 100644 --- a/examples/tiserver.yml +++ b/examples/tiserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/tiserver.yml up -d volumes: - serverfiles: + tiserver-files: name: lgsm @@ -14,9 +14,10 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - tiserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "7777:7777/udp" + # Query + - "27015:27015/udp" diff --git a/examples/ts3server.yml b/examples/ts3server.yml index 41eb107..fbf1256 100644 --- a/examples/ts3server.yml +++ b/examples/ts3server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/ts3server.yml up -d volumes: - serverfiles: + ts3server-files: name: lgsm @@ -14,10 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - ts3server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Voice - - "9987:9987/udp" - # Query / Telnet - - "10011:10011/tcp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/tsserver.yml b/examples/tsserver.yml index f270cf0..45288b4 100644 --- a/examples/tsserver.yml +++ b/examples/tsserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/tsserver.yml up -d volumes: - serverfiles: + tsserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - tsserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/tuserver.yml b/examples/tuserver.yml index 354bcb2..85a1b16 100644 --- a/examples/tuserver.yml +++ b/examples/tuserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/tuserver.yml up -d volumes: - serverfiles: + tuserver-files: name: lgsm @@ -14,9 +14,12 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - tuserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro -# couldn't extract ports, can only provide example how to configure it -# ports: -# - "27015:27015/udp" -# - "27015:27015/tcp" + ports: + # Game + - "7777:7777/udp" + # Query + - "27015:27015/udp" + # Steam + - "7778:7778/udp" diff --git a/examples/twserver.yml b/examples/twserver.yml index 79af4f7..b05dc03 100644 --- a/examples/twserver.yml +++ b/examples/twserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/twserver.yml up -d volumes: - serverfiles: + twserver-files: name: lgsm @@ -17,8 +17,9 @@ services: - "CONFIGFORCED_steamuser=" - "CONFIGFORCED_steampass=" volumes: - - serverfiles:/home/linuxgsm + - twserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game / Query - - "8303:8303/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/untserver.yml b/examples/untserver.yml index 3763d35..97b2e77 100644 --- a/examples/untserver.yml +++ b/examples/untserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/untserver.yml up -d volumes: - serverfiles: + untserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - untserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game / Query diff --git a/examples/ut2k4server.yml b/examples/ut2k4server.yml index d5207ec..a12868a 100644 --- a/examples/ut2k4server.yml +++ b/examples/ut2k4server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/ut2k4server.yml up -d volumes: - serverfiles: + ut2k4server-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - ut2k4server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/ut3server.yml b/examples/ut3server.yml index ff865e0..9f8b8fc 100644 --- a/examples/ut3server.yml +++ b/examples/ut3server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/ut3server.yml up -d volumes: - serverfiles: + ut3server-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - ut3server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/ut99server.yml b/examples/ut99server.yml index ad4efce..176626a 100644 --- a/examples/ut99server.yml +++ b/examples/ut99server.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/ut99server.yml up -d volumes: - serverfiles: + ut99server-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - ut99server-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/utserver.yml b/examples/utserver.yml index 6dbb21a..afd9c47 100644 --- a/examples/utserver.yml +++ b/examples/utserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/utserver.yml up -d volumes: - serverfiles: + utserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - utserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/vhserver.yml b/examples/vhserver.yml index 9e592b4..1fc1541 100644 --- a/examples/vhserver.yml +++ b/examples/vhserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/vhserver.yml up -d volumes: - serverfiles: + vhserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - vhserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/vintsserver.yml b/examples/vintsserver.yml index 4081b7c..25c03f4 100644 --- a/examples/vintsserver.yml +++ b/examples/vintsserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/vintsserver.yml up -d volumes: - serverfiles: + vintsserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - vintsserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/vsserver.yml b/examples/vsserver.yml index 0b1f562..4464ced 100644 --- a/examples/vsserver.yml +++ b/examples/vsserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/vsserver.yml up -d volumes: - serverfiles: + vsserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - vsserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game diff --git a/examples/wetserver.yml b/examples/wetserver.yml index efb0573..e18baf5 100644 --- a/examples/wetserver.yml +++ b/examples/wetserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/wetserver.yml up -d volumes: - serverfiles: + wetserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - wetserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/wfserver.yml b/examples/wfserver.yml index 73c1b28..e5cb937 100644 --- a/examples/wfserver.yml +++ b/examples/wfserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/wfserver.yml up -d volumes: - serverfiles: + wfserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - wfserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/wmcserver.yml b/examples/wmcserver.yml index 32f61f3..66bad8e 100644 --- a/examples/wmcserver.yml +++ b/examples/wmcserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/wmcserver.yml up -d volumes: - serverfiles: + wmcserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - wmcserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/wurmserver.yml b/examples/wurmserver.yml index 34a560e..9bb3616 100644 --- a/examples/wurmserver.yml +++ b/examples/wurmserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/wurmserver.yml up -d volumes: - serverfiles: + wurmserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - wurmserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro # couldn't extract ports, can only provide example how to configure it # ports: diff --git a/examples/zmrserver.yml b/examples/zmrserver.yml index 3615a7c..eac37d4 100644 --- a/examples/zmrserver.yml +++ b/examples/zmrserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/zmrserver.yml up -d volumes: - serverfiles: + zmrserver-files: name: lgsm @@ -14,14 +14,9 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - zmrserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro - ports: - # Game - - "27015:27015/udp" - # Query / RCON - - "27015:27015/tcp" - # SourceTV - - "27020:27020/udp" - # Client - - "27005:27005/udp" +# couldn't extract ports, can only provide example how to configure it +# ports: +# - "27015:27015/udp" +# - "27015:27015/tcp" diff --git a/examples/zpsserver.yml b/examples/zpsserver.yml index 1eaaddf..330c4b1 100644 --- a/examples/zpsserver.yml +++ b/examples/zpsserver.yml @@ -2,7 +2,7 @@ # usage: # docker-compose -f ./examples/zpsserver.yml up -d volumes: - serverfiles: + zpsserver-files: name: lgsm @@ -14,7 +14,7 @@ services: environment: - "CRON_update_daily=0 7 * * * update" volumes: - - serverfiles:/home/linuxgsm + - zpsserver-files:/home/linuxgsm - /etc/localtime:/etc/localtime:ro ports: # Game From 7991dee6779780f519f3775d39e7afbf1b45b17a Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Thu, 11 Aug 2022 19:49:12 +0200 Subject: [PATCH 108/116] doc: overview section --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++----- test/testing.md | 3 +-- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index be056d8..a4b0952 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,55 @@ Dockerhub https://hub.docker.com/r/gameservermanagers/linuxgsm-docker/ - Stopping container and keep files `docker-compose -f examples/SERVER.yml down` or `docker stop lgsm-SERVER-1` - Stopping container and remove files `docker-compose -f examples/SERVER.yml down --volumes` -## Details - -- build with: - - `./test/single.sh --build-only servercode` - - `./test/single.sh --help` +## Overview +- build with `./test/single.sh --build-only servercode` +- test with `./test/single.sh servercode` +- get help `./test/single.sh --help` +- LinuxGSM monitor executed every few seconds as health check +- `docker stop CONTAINER` is redirected to lgsm-stop +- `docker logs CONTAINER` show the game server log +- `docker exec -it CONTAINER update` every linuxgsm command is available as long e.g. `lgsm-update` and short e.g. `update` variant. Like `details`, `backup`, `force-update`, ... - [Repository / Container / Dev structure documentation](DEVELOPER.md) - [How to build this / How to use it for lgsm testing](test/testing.md) + +### How to configure LinuxGSM in docker? + +You can configure LinuxGSM and some gameservers(alpha state) with environment variables directly. +E.g. you want to set steamuser / steampass which is a LinuxGSM option: +- `CONFIG_steamuser=...` its checked if this variable exists before its set, container will exit very early if the configuration option isn't already part of _default.cfg +- `CONFIGFORCED_steamuser=...` The variable will be set always, no check done. +- These options will be written to the instance.cfg, thereforce you can use it to set options like `CONFIG_startparameters`, `CONFIG_discordalert` and so on. + +### How to use cronjobs? +You can create cron jobs with environment variables. `CRON_update_daily=0 7 * * * update` will create a cronjob which will check for updates once a day. + +### Example ahl2server yml: +```yml +volumes: + ahl2server-files: + +name: lgsm + +services: + ahl2server: + image: "gameservermanagers/linuxgsm-docker:ahl2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + - "CONFIGFORCED_steamuser=MySteamName" + - "CONFIGFORCED_steampass=my steam password" + volumes: + - ahl2server-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query / RCON + - "27015:27015/tcp" + # SourceTV + - "27020:27020/udp" + # Client + - "27005:27005/udp" +``` diff --git a/test/testing.md b/test/testing.md index 28e6573..63f4ffe 100644 --- a/test/testing.md +++ b/test/testing.md @@ -10,7 +10,6 @@ - `LGSM_GITHUBBRANCH / LGSM_GITHUBREPO / LGSM_GITHUBUSER` can be set with `--git-[branch,repo,user] "value"` - Do you want to test a single servercode? E.g. to test a patch affecting just one server. - `./single.sh [--volume v] [--version commit/tag/branch] servercode` - - testing a single servercode, e.g. if current is working or for testing your lgsm fork - Do you want to test multiple or all servercodes? E.g. you refactoring code affecting multiple or all - `./multiple.sh [--version commit/tag/branch] [servercode1 servercode2 ...]` - if no servercode is provided every servercode is tested! @@ -20,7 +19,7 @@ #!/bin/bash ./test/multiple.sh --version v22.1.0 --log-debug ``` - 2. invoke it `tmux new -d -s lgsm-testing bash tmux.sh // TODO: should work without extra script, maybe add option to scripts? + 2. invoke it `tmux new -d -s lgsm-testing bash tmux.sh ## Examples: From b49970ca00e110340fc25a685fb647bc0da4c0ce Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Fri, 12 Aug 2022 23:30:42 +0200 Subject: [PATCH 109/116] clean: fix shellcheck --- test/debug-utils/compare_multiple_result_folders.sh | 4 +++- test/internal/api_various.sh | 1 + test/multiple.sh | 8 ++++---- test/shellcheck.sh | 2 +- test/single.sh | 12 ++++-------- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/test/debug-utils/compare_multiple_result_folders.sh b/test/debug-utils/compare_multiple_result_folders.sh index a19a41c..dc4ae1a 100644 --- a/test/debug-utils/compare_multiple_result_folders.sh +++ b/test/debug-utils/compare_multiple_result_folders.sh @@ -1,11 +1,13 @@ #!/bin/bash +set -euo pipefail + ( cd "$(dirname "$0")/.." mapfile -t results_folder < <(find "." -maxdepth 1 -type d -iname "results*") - mapfile -t servercodes < <(find ./${results_folder[0]}/ -type f -iname "*.log" | grep -Poe '(?<=.)[^./]+(?=.log)' | sort) + mapfile -t servercodes < <(find ./"${results_folder[0]}"/ -type f -iname "*.log" | grep -Poe '(?<=.)[^./]+(?=.log)' | sort) for servercode in "${servercodes[@]}"; do successful=() failed=() diff --git a/test/internal/api_various.sh b/test/internal/api_various.sh index b0ad9ea..fd3a813 100755 --- a/test/internal/api_various.sh +++ b/test/internal/api_various.sh @@ -1,5 +1,6 @@ #!/bin/bash +#shellcheck disable=SC2034 # external used DEFAULT_DOCKER_REPOSITORY="gameservermanagers/linuxgsm-docker" function isEmpty() { diff --git a/test/multiple.sh b/test/multiple.sh index 44aec65..46469b9 100755 --- a/test/multiple.sh +++ b/test/multiple.sh @@ -4,10 +4,10 @@ set -o errexit set -o pipefail set -o nounset -# shellcheck source=test/internal/api_various.sh -source "$(dirname "$0")/internal/api_various.sh" -# shellcheck source=test/steam_test_credentials -source "$(dirname "$0")/steam_test_credentials" +cd "$(dirname "$0")/.." + +source "test/internal/api_various.sh" +source "test/steam_test_credentials" ROOT_FOLDER="$(realpath "$(dirname "$0")/..")" diff --git a/test/shellcheck.sh b/test/shellcheck.sh index 617be55..9b5abeb 100755 --- a/test/shellcheck.sh +++ b/test/shellcheck.sh @@ -7,7 +7,7 @@ set -o nounset cd "$(dirname "$0")/.." files=() - mapfile -d $'\0' files < <( find runtime build test -type f ! -iname "*.log" ! -iname "*.yml" -print0 ) + mapfile -d $'\0' files < <( find runtime build test -type f ! -iname "*.log" ! -iname "*.yml" ! -iname "Dockerfile" ! -iname "*.md" -print0 ) echo "[info][shellcheck] testing on ${#files[@]} files" diff --git a/test/single.sh b/test/single.sh index 36170e4..1cb27be 100755 --- a/test/single.sh +++ b/test/single.sh @@ -1,6 +1,6 @@ #!/bin/bash -echo "single.sh $@" +echo "single.sh $*" set -o errexit set -o nounset @@ -8,13 +8,9 @@ set -o pipefail cd "$(dirname "$0")/.." -# shellcheck source=test/internal/api_docker.sh -source "$(dirname "$0")/internal/api_docker.sh" -# shellcheck source=test/internal/api_various.sh -source "$(dirname "$0")/internal/api_various.sh" -# shellcheck source=test/steam_test_credentials -source "$(dirname "$0")/steam_test_credentials" - +source "test/internal/api_docker.sh" +source "test/internal/api_various.sh" +source "test/steam_test_credentials" LOGS="false" From 75a2d63c4032b0666d38d0331d737294e9f8a4a8 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sat, 13 Aug 2022 00:54:51 +0200 Subject: [PATCH 110/116] test: feature tests added todos --- test/features.sh | 16 +++++++++------- test/features/testCron.sh | 2 +- test/features/testUpdateUidGuid.sh | 12 ++++++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/test/features.sh b/test/features.sh index 7bce6ff..399a5f5 100755 --- a/test/features.sh +++ b/test/features.sh @@ -4,6 +4,8 @@ set -o errexit set -o nounset set -o pipefail +cd "$(dirname "$0")/.." + VERSION="$1" if [ "${1}" = "--version" ] || [ "${1}" = "-v" ]; then VERSION="$2" @@ -18,14 +20,14 @@ VOLUME="linuxgsm-$GAMESERVER-testFeatures" if "$CLEAR"; then docker volume rm "$VOLUME" || true fi - ./tests/single.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + ./test/single.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" - ./tests/features/testCron.sh "$VERSION" "$GAMESERVER" "$VOLUME" - ./tests/features/testDockerLogs.sh "$VERSION" "$GAMESERVER" "$VOLUME" - ./tests/features/testFixPermissions.sh "$VERSION" "$GAMESERVER" "$VOLUME" - ./tests/features/testUpdateUidGuid.sh "$VERSION" "$GAMESERVER" "$VOLUME" - ./tests/features/testLgsmUpdate.sh "$VERSION" "$GAMESERVER" "$VOLUME" - ./tests/features/testLoadConfig.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./test/features/testCron.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./test/features/testDockerLogs.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./test/features/testFixPermissions.sh "$VERSION" "$GAMESERVER" "$VOLUME" + ./test/features/testUpdateUidGuid.sh "$VERSION" "$GAMESERVER" "$VOLUME" + #TODO: ./test/features/testLgsmUpdate.sh "$VERSION" "$GAMESERVER" "$VOLUME" + #TODO: ./test/features/testLoadConfig.sh "$VERSION" "$GAMESERVER" "$VOLUME" echo "[info][features] successful" ) diff --git a/test/features/testCron.sh b/test/features/testCron.sh index 9da83d5..bd029e6 100755 --- a/test/features/testCron.sh +++ b/test/features/testCron.sh @@ -13,7 +13,7 @@ source "$(dirname "$0")/../internal/api_docker.sh" ( cd "$(dirname "$0")/../.." - DOCKERFILE_CRONLOCATION="$(grep -Po '(?<=SUPERCRONIC_CONFIG=")[^"]*' Dockerfile)" + DOCKERFILE_CRONLOCATION="$(grep -Po '(?<=SUPERCRONIC_CONFIG=")[^"]*' build/Dockerfile)" function fn_exit() { diff --git a/test/features/testUpdateUidGuid.sh b/test/features/testUpdateUidGuid.sh index 6dbf560..dcbf7d3 100755 --- a/test/features/testUpdateUidGuid.sh +++ b/test/features/testUpdateUidGuid.sh @@ -25,10 +25,12 @@ gid="750" } dockerRun=(docker run -it --rm -v "$VOLUME:/home" --workdir "/home") - if [ "0" != "$("${dockerRun[@]}" alpine find . ! -user "$uid" ! -iname "tmux.pipe" | wc -l )" ]; then + "${dockerRun[@]}" alpine chown -R "$uid:$gid" . + + if [ "0" != "$("${dockerRun[@]}" alpine find . ! -user "$uid" ! -iname "tmux.pipe" ! -iname "server.started" | wc -l )" ]; then log "precondition failed, there are files in \"$VOLUME\" which aren't owned by user \"$uid\"" 20 "$("${dockerRun[@]}" alpine find . ! -user "$uid" ! -iname "tmux.pipe" | tail)" - elif [ "0" != "$("${dockerRun[@]}" alpine find . ! -group "$gid" ! -iname "tmux.pipe" | wc -l )" ]; then + elif [ "0" != "$("${dockerRun[@]}" alpine find . ! -group "$gid" ! -iname "tmux.pipe" ! -iname "server.started" | wc -l )" ]; then log "precondition failed, there are files in \"$VOLUME\" which aren't owned by group \"$gid\"" 21 "$("${dockerRun[@]}" alpine find . ! -group "$gid" ! -iname "tmux.pipe" | tail)" else @@ -36,10 +38,12 @@ gid="750" fi ./test/single.sh --very-fast --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" -e "USER_ID=1234" -e "GROUP_ID=5678" - if [ "0" != "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | wc -l )" ]; then + if [ "0" != "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" ! -iname "server.started" | wc -l )" ]; then + "${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" ! -iname "server.started" log "update failed, there are files in \"$VOLUME\" which aren't owned by user \"1234\"" 22 "$("${dockerRun[@]}" alpine find . ! -user "1234" ! -iname "tmux.pipe" | tail)" - elif [ "0" != "$("${dockerRun[@]}" alpine find . ! -group "5678" ! -iname "tmux.pipe" | wc -l )" ]; then + elif [ "0" != "$("${dockerRun[@]}" alpine find . ! -group "5678" ! -iname "tmux.pipe" ! -iname "server.started" | wc -l )" ]; then + "${dockerRun[@]}" alpine find . ! -group "5678" ! -iname "tmux.pipe" ! -iname "server.started" log "update failed, there are files in \"$VOLUME\" which aren't owned by group \"5678\"" 23 "$("${dockerRun[@]}" alpine find . ! -group "5678" ! -iname "tmux.pipe" | tail)" else From 39859e717dc6ad3bc076babf9b91c04bc957cbe4 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 14 Aug 2022 15:16:19 +0200 Subject: [PATCH 111/116] deploy: push.sh wdir not moved --- deploy/push.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deploy/push.sh b/deploy/push.sh index 12f9392..bdfb5b2 100755 --- a/deploy/push.sh +++ b/deploy/push.sh @@ -25,9 +25,9 @@ while [ $# -ge 1 ]; do done ( - cd "$(dirname "$0")" - mapfile -t results < <(find "results" -type f) - echo "[info][push] found ${#results[@]} from full.sh" + cd "$(dirname "$0")/.." + mapfile -t results < <(find ./test/results -type f) + echo "[info][push] found ${#results[@]} result logs" push=() for result in "${results[@]}"; do if ! "$ONLY_SUCCESFUL" || grep -q 'successful' <<< "$result"; then From 87ca6ee199e4c716d2d4388adcb4d0adc8ab53c3 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 14 Aug 2022 15:28:31 +0200 Subject: [PATCH 112/116] test: single.sh changed wdir --- test/single.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/single.sh b/test/single.sh index 1cb27be..c7b2b2d 100755 --- a/test/single.sh +++ b/test/single.sh @@ -24,8 +24,8 @@ LGSM_GITHUBUSER="" LGSM_GITHUBREPO="" LGSM_GITHUBBRANCH="" -build=(./internal/build.sh) -run=(./internal/run.sh) +build=(./test/internal/build.sh) +run=(./test/internal/run.sh) while [ $# -ge 1 ]; do key="$1" shift From 95a65211026d2576d3243782cb6bc4642bcbe074 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 14 Aug 2022 21:13:26 +0200 Subject: [PATCH 113/116] test: test scripts shouldn't rely on wdir --- test/multiple.sh | 433 ++++++++++++++++++++++++----------------------- test/single.sh | 361 +++++++++++++++++++-------------------- 2 files changed, 402 insertions(+), 392 deletions(-) diff --git a/test/multiple.sh b/test/multiple.sh index 46469b9..0908ea3 100755 --- a/test/multiple.sh +++ b/test/multiple.sh @@ -4,143 +4,204 @@ set -o errexit set -o pipefail set -o nounset -cd "$(dirname "$0")/.." - -source "test/internal/api_various.sh" -source "test/steam_test_credentials" - -ROOT_FOLDER="$(realpath "$(dirname "$0")/..")" - -PARRALEL="$(lscpu -p | grep -Ev '^#' | sort -u -t, -k 2,4 | wc -l)" -IMAGE="$DEFAULT_DOCKER_REPOSITORY" -FLAKY="1" -LOG_DEBUG="false" -RERUN="false" -SUFFIX="" -VOLUMES="false" -VERSION="master" -LGSM_GITHUBUSER="" -LGSM_GITHUBREPO="" -LGSM_GITHUBBRANCH="" - -GAMESERVER=() -while [ $# -ge 1 ]; do - key="$1" - shift - - case "$key" in - -h|--help) - echo "[help][multiple] testing every feature of specified server" - echo "[help][multiple] full.sh [option] [server]" - echo "[help][multiple] " - echo "[help][multiple] options:" - echo "[help][multiple] -c --cpus x run x servers in parralel, default x = physical cores" - echo "[help][multiple] -d --log-debug IMPORTANT: logs will leak your steam credentials!" - echo "[help][multiple] --image x set target image" - echo "[help][multiple] --flaky x test for flaky results x times, x should be greater as 1" - echo "[help][multiple] --rerun check results and runs every gameserver which wasn't successful" - echo "[help][multiple] --git-branch x sets LGSM_GITHUBBRANCH" - echo "[help][multiple] --git-repo x sets LGSM_GITHUBREPO" - echo "[help][multiple] --git-user x sets LGSM_GITHUBUSER" - echo "[help][multiple] --suffix suffix to add to every image" - echo "[help][multiple] --volumes use volumes \"linuxgsm-SERVERCODE\"" - echo "[help][multiple] -v --version x use linuxgsm version x e.g. \"v21.4.1\"" - echo "[help][multiple] " - echo "[help][multiple] " - echo "[help][multiple] server:" - echo "[help][multiple] *empty* test every server" - echo "[help][multiple] gmodserver ... run only given servers" - exit 0;; - -c|--cpus) - PARRALEL="$1" - shift;; - -d|--log-debug) - LOG_DEBUG="true";; - --image) - IMAGE="$1" - shift;; - --flaky) - FLAKY="$1" - shift;; - --rerun) - RERUN="true";; - --git-branch) - LGSM_GITHUBBRANCH="$1" - shift;; - --git-repo) - LGSM_GITHUBREPO="$1" - shift;; - --git-user) - LGSM_GITHUBUSER="$1" - shift;; - --suffix) - SUFFIX="$1" - shift;; - --volumes) - VOLUMES="true";; - -v|--version) - VERSION="$1" - shift;; - *) - if grep -qE '^-' <<< "$key"; then - echo "[error][multiple] unknown option $key" - exit 1 - else - echo "[info][multiple] only testing servercode \"$key\"" - fi - GAMESERVER+=("$key");; - esac -done -testAllServer="$([ "${#GAMESERVER[@]}" = "0" ] && echo true || echo false )" -if [ "$(whoami)" = "root" ]; then - echo "[error][multiple] please dont execute me as root, iam invoking linuxgsm.sh directly and this will not work as root" - exit 1 -fi - -for run in $(seq 1 "$FLAKY"); do - # prepare results folder - RESULTS="$ROOT_FOLDER/test/results" - # for multiple runs move previous results folder - if [ "$FLAKY" != "1" ] && [ "$run" -gt "1" ]; then - rm -rf "$RESULTS.$((run-1))" > /dev/null 2>&1 - cp -rf "$RESULTS/" "$RESULTS.$((run-1))/" - fi - if [ "${#GAMESERVER[@]}" = "0" ]; then - if "$RERUN"; then - find "$RESULTS" -type f ! -name "successful.*" -exec rm -f "{}" \; - else - rm -rf "$RESULTS" - fi - else - # rerun only remove specific log - for servercode in "${GAMESERVER[@]}"; do - rm -rf "${RESULTS:?}/"*".$servercode.log" - done +( + cd "$(dirname "$0")/.." + + source "test/internal/api_various.sh" + source "test/steam_test_credentials" + + ROOT_FOLDER="$(pwd)" + + BUILD_ONLY="false" + PARRALEL="$(lscpu -p | grep -Ev '^#' | sort -u -t, -k 2,4 | wc -l)" + IMAGE="$DEFAULT_DOCKER_REPOSITORY" + FLAKY="1" + LOG_DEBUG="false" + RERUN="false" + SUFFIX="" + VOLUMES="false" + VERSION="master" + LGSM_GITHUBUSER="" + LGSM_GITHUBREPO="" + LGSM_GITHUBBRANCH="" + + GAMESERVER=() + while [ $# -ge 1 ]; do + key="$1" + shift + + case "$key" in + -h|--help) + echo "[help][multiple] testing every feature of specified server" + echo "[help][multiple] full.sh [option] [server]" + echo "[help][multiple] " + echo "[help][multiple] options:" + echo "[help][multiple] -b --build-only build images but dont test them" + echo "[help][multiple] -c --cpus x run x servers in parralel, default x = physical cores" + echo "[help][multiple] -d --log-debug IMPORTANT: logs will leak your steam credentials!" + echo "[help][multiple] --image x set target image" + echo "[help][multiple] --flaky x test for flaky results x times, x should be greater as 1" + echo "[help][multiple] --rerun check results and runs every gameserver which wasn't successful" + echo "[help][multiple] --git-branch x sets LGSM_GITHUBBRANCH" + echo "[help][multiple] --git-repo x sets LGSM_GITHUBREPO" + echo "[help][multiple] --git-user x sets LGSM_GITHUBUSER" + echo "[help][multiple] --suffix suffix to add to every image" + echo "[help][multiple] --volumes use volumes \"linuxgsm-SERVERCODE\"" + echo "[help][multiple] -v --version x use linuxgsm version x e.g. \"v21.4.1\"" + echo "[help][multiple] " + echo "[help][multiple] " + echo "[help][multiple] server:" + echo "[help][multiple] *empty* test every server" + echo "[help][multiple] gmodserver ... run only given servers" + exit 0;; + -b|--build-only) + BUILD_ONLY="true";; + -c|--cpus) + PARRALEL="$1" + shift;; + -d|--log-debug) + LOG_DEBUG="true";; + --image) + IMAGE="$1" + shift;; + --flaky) + FLAKY="$1" + shift;; + --rerun) + RERUN="true";; + --git-branch) + LGSM_GITHUBBRANCH="$1" + shift;; + --git-repo) + LGSM_GITHUBREPO="$1" + shift;; + --git-user) + LGSM_GITHUBUSER="$1" + shift;; + --suffix) + SUFFIX="$1" + shift;; + --volumes) + VOLUMES="true";; + -v|--version) + VERSION="$1" + shift;; + *) + if grep -qE '^-' <<< "$key"; then + echo "[error][multiple] unknown option $key" + exit 1 + else + echo "[info][multiple] only testing servercode \"$key\"" + fi + GAMESERVER+=("$key");; + esac + done + testAllServer="$([ "${#GAMESERVER[@]}" = "0" ] && echo true || echo false )" + if [ "$(whoami)" = "root" ]; then + echo "[error][multiple] please dont execute me as root, iam invoking linuxgsm.sh directly and this will not work as root" + exit 1 fi - mkdir -p "$RESULTS" - ( - if "$RERUN" || [ "$run" -gt "1" ]; then - echo "[info][multiple] skipping building linuxgsm because rerun" + for run in $(seq 1 "$FLAKY"); do + # prepare results folder + RESULTS="$ROOT_FOLDER/test/results" + # for multiple runs move previous results folder + if [ "$FLAKY" != "1" ] && [ "$run" -gt "1" ]; then + rm -rf "$RESULTS.$((run-1))" > /dev/null 2>&1 + cp -rf "$RESULTS/" "$RESULTS.$((run-1))/" + fi + if [ "${#GAMESERVER[@]}" = "0" ]; then + if "$RERUN"; then + find "$RESULTS" -type f ! -name "successful.*" -exec rm -f "{}" \; + else + rm -rf "$RESULTS" + fi else - echo "[info][multiple] building linuxgsm base once" - ./test/internal/build.sh --version "$VERSION" --image "$IMAGE" --latest --suffix "$SUFFIX" + # rerun only remove specific log + for servercode in "${GAMESERVER[@]}"; do + rm -rf "${RESULTS:?}/"*".$servercode.log" + done fi + mkdir -p "$RESULTS" + + ( + if "$RERUN" || [ "$run" -gt "1" ]; then + echo "[info][multiple] skipping building linuxgsm because rerun" + else + echo "[info][multiple] building linuxgsm base once" + ./test/internal/build.sh --version "$VERSION" --image "$IMAGE" --latest --suffix "$SUFFIX" + fi - subprocesses=() - function handleInterrupt() { - for pid in "${subprocesses[@]}"; do - kill -s SIGINT "$pid" || true - done - } - trap handleInterrupt SIGTERM SIGINT + subprocesses=() + function handleInterrupt() { + for pid in "${subprocesses[@]}"; do + kill -s SIGINT "$pid" || true + done + } + trap handleInterrupt SIGTERM SIGINT + + mapfile -d $'\n' -t servers < <(getServerCodeList "$VERSION") + for server_code in "${servers[@]}"; do + cd "$ROOT_FOLDER" + + # only start $PARRALEL amount of tests + while [ "${#subprocesses[@]}" -ge "$PARRALEL" ]; do + sleep 1s + temp=() + for pid in "${subprocesses[@]}"; do + if ps -p "$pid" -o pid= > /dev/null 2>&1; then + temp+=("$pid") + fi + done + subprocesses=("${temp[@]}") + done - mapfile -d $'\n' -t servers < <(getServerCodeList "$VERSION") - for server_code in "${servers[@]}"; do - cd "$ROOT_FOLDER" - # only start $PARRALEL amount of tests - while [ "${#subprocesses[@]}" -ge "$PARRALEL" ]; do + isServercodeInServerlist="$(grep -qF "$server_code" <<< "${GAMESERVER[@]}" && echo true || echo false )" + serverDidntStartSuccessful="$([ ! -f "$RESULTS/successful.$server_code.log" ] && echo true || echo false )" + testThisServercode="$( ("$testAllServer" || "$isServercodeInServerlist") && echo true || echo false )" + rerunIsFine="$( ( ! "$RERUN" || "$serverDidntStartSuccessful" ) && echo true || echo false )" + if "$testThisServercode" && "$rerunIsFine"; then + echo "[info][multiple] testing: $server_code" + ( + single=(./test/single.sh --logs --version "$VERSION" --image "$IMAGE" --skip-lgsm --suffix "$SUFFIX" --git-branch "$LGSM_GITHUBBRANCH" --git-repo "$LGSM_GITHUBREPO" --git-user "$LGSM_GITHUBUSER") + if "$VOLUMES"; then + single+=(--volume "linuxgsm-$server_code") + fi + if "$LOG_DEBUG"; then + single+=(--log-debug) + fi + if "$BUILD_ONLY"; then + single+=(--build-only) + fi + single+=("$server_code") + + echo "${single[@]}" + is_successful="false" + if "${single[@]}" > "$RESULTS/$server_code.log" 2>&1; then + is_successful="true" + fi + + # sanitize secrets in log like used steamuser / steampass + if [ -n "$steam_test_password" ]; then + sed -i "s/$(sed_sanitize "$steam_test_password")/SECRET_PASSWORD/g" "$RESULTS/$server_code.log" > /dev/null 2>&1 || true + fi + if [ -n "$steam_test_username" ]; then + sed -i "s/$(sed_sanitize "$steam_test_username")/SECRET_USERNAME/g" "$RESULTS/$server_code.log" > /dev/null 2>&1 || true + fi + + if "$is_successful"; then + mv "$RESULTS/$server_code.log" "$RESULTS/successful.$server_code.log" + else + mv "$RESULTS/$server_code.log" "$RESULTS/failed.$server_code.log" + fi + ) | tee /dev/tty > /dev/null 2>&1 & + subprocesses+=("$!") + fi + done + + # await every job is done + while [ "${#subprocesses[@]}" -gt "0" ]; do sleep 1s temp=() for pid in "${subprocesses[@]}"; do @@ -151,88 +212,36 @@ for run in $(seq 1 "$FLAKY"); do subprocesses=("${temp[@]}") done + echo "[info][multiple] successful: $(find "$RESULTS/" -iname "successful.*" | wc -l)" + echo "[info][multiple] failed: $(find "$RESULTS/" -iname "failed.*" | wc -l)" - isServercodeInServerlist="$(grep -qF "$server_code" <<< "${GAMESERVER[@]}" && echo true || echo false )" - serverDidntStartSuccessful="$([ ! -f "$RESULTS/successful.$server_code.log" ] && echo true || echo false )" - testThisServercode="$( ("$testAllServer" || "$isServercodeInServerlist") && echo true || echo false )" - rerunIsFine="$( ( ! "$RERUN" || "$serverDidntStartSuccessful" ) && echo true || echo false )" - if "$testThisServercode" && "$rerunIsFine"; then - echo "[info][multiple] testing: $server_code" - ( - single=(./test/single.sh --logs --version "$VERSION" --image "$IMAGE" --skip-lgsm --suffix "$SUFFIX" --git-branch "$LGSM_GITHUBBRANCH" --git-repo "$LGSM_GITHUBREPO" --git-user "$LGSM_GITHUBUSER") - if "$VOLUMES"; then - single+=(--volume "linuxgsm-$server_code") - fi - if "$LOG_DEBUG"; then - single+=(--log-debug) - fi - single+=("$server_code") + mapfile -t failed_credentials_missing < <(grep --include "*failed*" -rlF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) + echo "[info][multiple] failed - unset steam credentials: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_credentials_missing[@]}" | tr '\n' ' ' || true)" + # print filenames + very high line number to jump right at eof on click if IDE supports it + printf '%s\n' "${failed_credentials_missing[@]/%/:100000}" - echo "${single[@]}" - is_successful="false" - if "${single[@]}" > "$RESULTS/$server_code.log" 2>&1; then - is_successful="true" - fi - - # sanitize secrets in log like used steamuser / steampass - if [ -n "$steam_test_password" ]; then - sed -i "s/$(sed_sanitize "$steam_test_password")/SECRET_PASSWORD/g" "$RESULTS/$server_code.log" > /dev/null 2>&1 || true - fi - if [ -n "$steam_test_username" ]; then - sed -i "s/$(sed_sanitize "$steam_test_username")/SECRET_USERNAME/g" "$RESULTS/$server_code.log" > /dev/null 2>&1 || true - fi + mapfile -t failed_other < <(grep --include "*failed*" -rLF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) + echo "[info][multiple] failed - other error: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_other[@]}" | tr '\n' ' ' || true)" + printf '%s\n' "${failed_other[@]/%/:100000}" - if "$is_successful"; then - mv "$RESULTS/$server_code.log" "$RESULTS/successful.$server_code.log" - else - mv "$RESULTS/$server_code.log" "$RESULTS/failed.$server_code.log" - fi - ) | tee /dev/tty > /dev/null 2>&1 & - subprocesses+=("$!") - fi - done - - # await every job is done - while [ "${#subprocesses[@]}" -gt "0" ]; do - sleep 1s - temp=() - for pid in "${subprocesses[@]}"; do - if ps -p "$pid" -o pid= > /dev/null 2>&1; then - temp+=("$pid") - fi - done - subprocesses=("${temp[@]}") - done - - echo "[info][multiple] successful: $(find "$RESULTS/" -iname "successful.*" | wc -l)" - echo "[info][multiple] failed: $(find "$RESULTS/" -iname "failed.*" | wc -l)" - - mapfile -t failed_credentials_missing < <(grep --include "*failed*" -rlF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) - echo "[info][multiple] failed - unset steam credentials: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_credentials_missing[@]}" | tr '\n' ' ' || true)" - # print filenames + very high line number to jump right at eof on click if IDE supports it - printf '%s\n' "${failed_credentials_missing[@]/%/:100000}" - - mapfile -t failed_other < <(grep --include "*failed*" -rLF 'Change steamuser="username"' "$RESULTS" | sort | uniq || true) - echo "[info][multiple] failed - other error: $(grep -Po '(?<=failed.)[^.]*' <<< "${failed_other[@]}" | tr '\n' ' ' || true)" - printf '%s\n' "${failed_other[@]/%/:100000}" - - echo "" - echo "[info][multiple] searching in log for command errors \"command not found\" please add this as minimal dependency!" - grep -rnF 'command not found' "$RESULTS" || true - - echo "" - echo "[info][multiple] searching in log for errors where health check got SIGKILL" - grep -rnF '"ExitCode": 137' "$RESULTS" || true - - echo "" - echo "[info][multiple] log contains message \"provide content log to LinuxGSM developers\"" - grep -rnF 'LinuxGSM developers' "$RESULTS" || true - ) -done - -if [ "$FLAKY" != "1" ]; then - ( - cd "$ROOT_FOLDER" - ./test/debug-utils/compare_multiple_result_folders.sh - ) -fi + echo "" + echo "[info][multiple] searching in log for command errors \"command not found\" please add this as minimal dependency!" + grep -rnF 'command not found' "$RESULTS" || true + + echo "" + echo "[info][multiple] searching in log for errors where health check got SIGKILL" + grep -rnF '"ExitCode": 137' "$RESULTS" || true + + echo "" + echo "[info][multiple] log contains message \"provide content log to LinuxGSM developers\"" + grep -rnF 'LinuxGSM developers' "$RESULTS" || true + ) + done + + if [ "$FLAKY" != "1" ]; then + ( + cd "$ROOT_FOLDER" + ./test/debug-utils/compare_multiple_result_folders.sh + ) + fi +) \ No newline at end of file diff --git a/test/single.sh b/test/single.sh index c7b2b2d..dd55330 100755 --- a/test/single.sh +++ b/test/single.sh @@ -6,190 +6,191 @@ set -o errexit set -o nounset set -o pipefail -cd "$(dirname "$0")/.." - -source "test/internal/api_docker.sh" -source "test/internal/api_various.sh" -source "test/steam_test_credentials" - - -LOGS="false" -LOG_DEBUG="false" -DEBUG="false" -IMAGE="$DEFAULT_DOCKER_REPOSITORY" -RETRY="1" -GAMESERVER="" -BUILD_ONLY="false" -LGSM_GITHUBUSER="" -LGSM_GITHUBREPO="" -LGSM_GITHUBBRANCH="" - -build=(./test/internal/build.sh) -run=(./test/internal/run.sh) -while [ $# -ge 1 ]; do - key="$1" - shift - - case "$key" in - -h|--help) - echo "[help][single] single testing of provided gameserver" - echo "[help][single] single.sh [option] server" - echo "[help][single] " - echo "[help][single] options:" - echo "[help][single] -c --no-cache run without docker cache" - echo "[help][single] -b --build-only just build it" - echo "[help][single] -d --debug run gameserver and overwrite entrypoint to bash" - echo "[help][single] --image x target image" - echo "[help][single] -l --logs print complete docker log afterwards" - echo "[help][single] --log-debug enables LGSM_DEBUG, log can contain your steam credentials, dont share it!" - echo "[help][single] --retry if run failed, rebuild and rerun up to 3 times" - echo "[help][single] --git-branch x sets LGSM_GITHUBBRANCH" - echo "[help][single] --git-repo x sets LGSM_GITHUBREPO" - echo "[help][single] --git-user x sets LGSM_GITHUBUSER" - echo "[help][single] --skip-lgsm skip build lgsm" - echo "[help][single] --very-fast overwrite healthcheck, only use it with volumes / lancache because container will else fail pretty fast" - echo "[help][single] --version x use linuxgsm version x e.g. \"v21.4.1\" can be a commit id(even fork) / branch" - echo "[help][single] --volume x use volume x e.g. \"lgsm\"" - echo "[help][single] " - echo "[help][single] server e.g. gmodserver" - exit 0;; - -c|--no-cache) - build+=(--no-cache);; - -b|--build-only) - BUILD_ONLY="true";; - -d|--debug) - run+=(--debug) - DEBUG="true";; - --image) - IMAGE="$1" - shift;; - -l|--logs) - LOGS="true" - LOG_DEBUG="true";; - --log-debug) - LOG_DEBUG="true";; - --retry) - RETRY="3";; - --git-branch) - LGSM_GITHUBBRANCH="$1" - shift;; - --git-repo) - LGSM_GITHUBREPO="$1" - shift;; - --git-user) - LGSM_GITHUBUSER="$1" - shift;; - --skip-lgsm) - build+=(--skip-lgsm);; - --suffix) - build+=(--suffix "$1") - run+=(--suffix "$1" ) - shift;; - --very-fast) - run+=(--quick);; - --version) - build+=(--version "$1") - shift;; - --volume) - run+=(--volume "$1") - shift;; - *) - if [ -z "$GAMESERVER" ]; then - GAMESERVER="$key" - else - echo "[info][single] additional argument to docker: \"$key\"" - run+=("$key") - fi;; - esac -done - -if [ -z "$GAMESERVER" ]; then - echo "[error][single] no gameserver provided" - exit 1 -elif grep -qEe "(^|\s)$GAMESERVER(\s|$)" <<< "${credentials_enabled[@]}" && ! "$BUILD_ONLY"; then - echo "[info][single] $GAMESERVER can only be tested with steam credential" - if [ -n "$steam_test_username" ] && [ -n "$steam_test_password" ]; then - run+=(-e CONFIGFORCED_steamuser="$steam_test_username" -e CONFIGFORCED_steampass="$steam_test_password") - else - echo "[error][single] $GAMESERVER can only be tested with steam credentials, please fill $(realpath "$(dirname "$0")/steam_test_credentials")" - exit 2 - fi -else - echo "[warning][single] no steam credentials provided, some servers will fail without it" -fi - -if [ -n "$LGSM_GITHUBUSER" ]; then - run+=(-e "LGSM_GITHUBUSER=$LGSM_GITHUBUSER") -fi -if [ -n "$LGSM_GITHUBREPO" ]; then - run+=(-e "LGSM_GITHUBREPO=$LGSM_GITHUBREPO") -fi -if [ -n "$LGSM_GITHUBBRANCH" ]; then - run+=(-e "LGSM_GITHUBBRANCH=$LGSM_GITHUBBRANCH") -fi - -CONTAINER="linuxgsm-$GAMESERVER" -build+=(--image "$IMAGE" --latest "$GAMESERVER") -run+=(--image "$IMAGE" --tag "$GAMESERVER" --container "$CONTAINER") -if ! "$DEBUG"; then - run+=(--detach) -fi -if "$LOG_DEBUG"; then - run+=(-e LGSM_DEBUG="true") -fi - -function handleInterrupt() { - removeContainer "$CONTAINER" -} -trap handleInterrupt SIGTERM SIGINT - ( - cd "$(dirname "$0")" - successful="false" - try="1" - while [ "$try" -le "$RETRY" ] && ! "$successful"; do - echo "[info][single] try $try" - try="$(( try+1 ))" - removeContainer "$CONTAINER" - echo "${build[@]}" - "${build[@]}" + cd "$(dirname "$0")/.." + + source "test/internal/api_docker.sh" + source "test/internal/api_various.sh" + source "test/steam_test_credentials" + + + LOGS="false" + LOG_DEBUG="false" + DEBUG="false" + IMAGE="$DEFAULT_DOCKER_REPOSITORY" + RETRY="1" + GAMESERVER="" + BUILD_ONLY="false" + LGSM_GITHUBUSER="" + LGSM_GITHUBREPO="" + LGSM_GITHUBBRANCH="" + + build=(./test/internal/build.sh) + run=(./test/internal/run.sh) + while [ $# -ge 1 ]; do + key="$1" + shift + + case "$key" in + -h|--help) + echo "[help][single] single testing of provided gameserver" + echo "[help][single] single.sh [option] server" + echo "[help][single] " + echo "[help][single] options:" + echo "[help][single] -c --no-cache run without docker cache" + echo "[help][single] -b --build-only just build it" + echo "[help][single] -d --debug run gameserver and overwrite entrypoint to bash" + echo "[help][single] --image x target image" + echo "[help][single] -l --logs print complete docker log afterwards" + echo "[help][single] --log-debug enables LGSM_DEBUG, log can contain your steam credentials, dont share it!" + echo "[help][single] --retry if run failed, rebuild and rerun up to 3 times" + echo "[help][single] --git-branch x sets LGSM_GITHUBBRANCH" + echo "[help][single] --git-repo x sets LGSM_GITHUBREPO" + echo "[help][single] --git-user x sets LGSM_GITHUBUSER" + echo "[help][single] --skip-lgsm skip build lgsm" + echo "[help][single] --very-fast overwrite healthcheck, only use it with volumes / lancache because container will else fail pretty fast" + echo "[help][single] --version x use linuxgsm version x e.g. \"v21.4.1\" can be a commit id(even fork) / branch" + echo "[help][single] --volume x use volume x e.g. \"lgsm\"" + echo "[help][single] " + echo "[help][single] server e.g. gmodserver" + exit 0;; + -c|--no-cache) + build+=(--no-cache);; + -b|--build-only) + BUILD_ONLY="true";; + -d|--debug) + run+=(--debug) + DEBUG="true";; + --image) + IMAGE="$1" + shift;; + -l|--logs) + LOGS="true" + LOG_DEBUG="true";; + --log-debug) + LOG_DEBUG="true";; + --retry) + RETRY="3";; + --git-branch) + LGSM_GITHUBBRANCH="$1" + shift;; + --git-repo) + LGSM_GITHUBREPO="$1" + shift;; + --git-user) + LGSM_GITHUBUSER="$1" + shift;; + --skip-lgsm) + build+=(--skip-lgsm);; + --suffix) + build+=(--suffix "$1") + run+=(--suffix "$1" ) + shift;; + --very-fast) + run+=(--quick);; + --version) + build+=(--version "$1") + shift;; + --volume) + run+=(--volume "$1") + shift;; + *) + if [ -z "$GAMESERVER" ]; then + GAMESERVER="$key" + else + echo "[info][single] additional argument to docker: \"$key\"" + run+=("$key") + fi;; + esac + done - if "$BUILD_ONLY"; then - successful="true" + if [ -z "$GAMESERVER" ]; then + echo "[error][single] no gameserver provided" + exit 1 + elif grep -qEe "(^|\s)$GAMESERVER(\s|$)" <<< "${credentials_enabled[@]}" && ! "$BUILD_ONLY"; then + echo "[info][single] $GAMESERVER can only be tested with steam credential" + if [ -n "$steam_test_username" ] && [ -n "$steam_test_password" ]; then + run+=(-e CONFIGFORCED_steamuser="$steam_test_username" -e CONFIGFORCED_steampass="$steam_test_password") else - echo "${run[@]}" | sed -E 's/(steamuser|steampass)=\S+/\1="xxx"/g' - "${run[@]}" + echo "[error][single] $GAMESERVER can only be tested with steam credentials, please fill $(realpath "$(dirname "$0")/steam_test_credentials")" + exit 2 + fi + else + echo "[warning][single] no steam credentials provided, some servers will fail without it" + fi + + if [ -n "$LGSM_GITHUBUSER" ]; then + run+=(-e "LGSM_GITHUBUSER=$LGSM_GITHUBUSER") + fi + if [ -n "$LGSM_GITHUBREPO" ]; then + run+=(-e "LGSM_GITHUBREPO=$LGSM_GITHUBREPO") + fi + if [ -n "$LGSM_GITHUBBRANCH" ]; then + run+=(-e "LGSM_GITHUBBRANCH=$LGSM_GITHUBBRANCH") + fi + + CONTAINER="linuxgsm-$GAMESERVER" + build+=(--image "$IMAGE" --latest "$GAMESERVER") + run+=(--image "$IMAGE" --tag "$GAMESERVER" --container "$CONTAINER") + if ! "$DEBUG"; then + run+=(--detach) + fi + if "$LOG_DEBUG"; then + run+=(-e LGSM_DEBUG="true") + fi - if "$DEBUG" || awaitHealthCheck "$CONTAINER"; then + function handleInterrupt() { + removeContainer "$CONTAINER" + } + trap handleInterrupt SIGTERM SIGINT + + ( + successful="false" + try="1" + while [ "$try" -le "$RETRY" ] && ! "$successful"; do + echo "[info][single] try $try" + try="$(( try+1 ))" + removeContainer "$CONTAINER" + echo "${build[@]}" + "${build[@]}" + + if "$BUILD_ONLY"; then successful="true" + else + echo "${run[@]}" | sed -E 's/(steamuser|steampass)=\S+/\1="xxx"/g' + "${run[@]}" + + if "$DEBUG" || awaitHealthCheck "$CONTAINER"; then + successful="true" + fi + + echo "" + echo "[info][single] printing dev-debug-function-order.log" + docker exec -it "$CONTAINER" cat "dev-debug-function-order.log" || true + stty sane + echo "" + echo "[info][single] printing dev-debug.log" + docker exec -it "$CONTAINER" cat "dev-debug.log" || true + echo "" + stty sane + + stopContainer "$CONTAINER" + if "$LOGS"; then + printf "[info][single] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" + elif ! "$successful"; then + printf "[info][single] logs:\n%s\n" "$(docker logs -n 20 "$CONTAINER" 2>&1 || true)" + fi + printf "[info][single] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq | sed 's/\\r/\n/g' | sed 's/\\n/\n/g' || true)" fi - - echo "" - echo "[info][single] printing dev-debug-function-order.log" - docker exec -it "$CONTAINER" cat "dev-debug-function-order.log" || true - stty sane - echo "" - echo "[info][single] printing dev-debug.log" - docker exec -it "$CONTAINER" cat "dev-debug.log" || true - echo "" - stty sane - - stopContainer "$CONTAINER" - if "$LOGS"; then - printf "[info][single] logs:\n%s\n" "$(docker logs "$CONTAINER" 2>&1 || true)" - elif ! "$successful"; then - printf "[info][single] logs:\n%s\n" "$(docker logs -n 20 "$CONTAINER" 2>&1 || true)" - fi - printf "[info][single] healthcheck log:\n%s\n" "$(docker inspect -f '{{json .State.Health.Log}}' "$CONTAINER" | jq | sed 's/\\r/\n/g' | sed 's/\\n/\n/g' || true)" - fi - done - removeContainer "$CONTAINER" + done + removeContainer "$CONTAINER" - if "$successful"; then - echo "[info][single] successful" - exit 0 - else - echo "[error][single] failed" - exit 1 - fi -) + if "$successful"; then + echo "[info][single] successful" + exit 0 + else + echo "[error][single] failed" + exit 1 + fi + ) +) \ No newline at end of file From e9af3c32a685fd56efc9788a5da308b1b4483bf8 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Sun, 14 Aug 2022 21:19:14 +0200 Subject: [PATCH 114/116] feat: safer lgsm alias generation + help --- README.md | 2 +- build/createAlias.sh | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a4b0952..0a451a1 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Dockerhub https://hub.docker.com/r/gameservermanagers/linuxgsm-docker/ - LinuxGSM monitor executed every few seconds as health check - `docker stop CONTAINER` is redirected to lgsm-stop - `docker logs CONTAINER` show the game server log -- `docker exec -it CONTAINER update` every linuxgsm command is available as long e.g. `lgsm-update` and short e.g. `update` variant. Like `details`, `backup`, `force-update`, ... +- `docker exec -it CONTAINER --help` every linuxgsm command is available in two forms e.g. `lgsm-update` and `update`. Available commands differ for different servercodes. - [Repository / Container / Dev structure documentation](DEVELOPER.md) - [How to build this / How to use it for lgsm testing](test/testing.md) diff --git a/build/createAlias.sh b/build/createAlias.sh index 0ba7605..b3579e2 100755 --- a/build/createAlias.sh +++ b/build/createAlias.sh @@ -38,8 +38,22 @@ function createAlias() { fi } -#TODO if linuxgsm supports -h / --help to list commands this can be generated -for cmd in install auto-install start stop restart details postdetails backup update-lgsm monitor test-alert update check-update force-update validate console debug \ - change-password map-compressor developer detect-deps detect-glibc detect-ldd query-raw clear-functions; do - createAlias "$cmd" -done +lgsm-init +( + cd "$LGSM_PATH" + + help_command="$LGSM_SCRIPTS/lgsm-help" + printf '%s\n%s' '#!/bin/bash' > "$help_command" + chmod +x "$help_command" + ln -s "$help_command" "$LGSM_SCRIPTS/--help" + ln -s "$help_command" "$LGSM_SCRIPTS/-h" + + # IMPORTANT: assuming ./server will provide commands in format "[ddmlong\s+short\s+| description" # TODO lgsm supporting --help, best unformated + mapfile -t commands < <(gosu "$USER_NAME" ./"$LGSM_GAMESERVER" | grep -Eo '\[[0-9]+m[a-zA-Z_]+[^|]+\|.*' | sed -E 's/\[[0-9]+m//') + for command in "${commands[@]}"; do + name="$(echo "$command" | grep -o '^[^ ]*')" + description="$(echo "$command" | grep -o '[^|]*$')" + createAlias "${name}" + printf "echo '%-40s| %s'\n" "$name lgsm-$name" "$description" >> "$help_command" + done +) From 4637629eba8a92be022a33a5b52078039cbd76b0 Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Fri, 31 Mar 2023 20:00:27 +0200 Subject: [PATCH 115/116] fix: pinned conan<2.0 --- build/installOpenSSL_1.1.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/installOpenSSL_1.1.sh b/build/installOpenSSL_1.1.sh index d978456..00e004a 100755 --- a/build/installOpenSSL_1.1.sh +++ b/build/installOpenSSL_1.1.sh @@ -5,14 +5,14 @@ version="$1" apt-get update apt-get install -y python3-pip gcc-multilib -pip3 install --force-reinstall conan +pip3 install --force-reinstall "conan<2.0" conan profile new default --detect conan profile update settings.compiler.libcxx=libstdc++11 default -conan install -if "$(mktemp -d)" -s arch=x86 -s arch_build=x86 --build=missing -o openssl:shared=True -s compiler.libcxx=libstdc++11 -s build_type=Release "openssl/$version@_/_" +conan install -if "$(mktemp -d)" -s arch=x86 --build=missing -o openssl:shared=True -s compiler.libcxx=libstdc++11 -s build_type=Release "openssl/$version@_/_" mkdir -p "/usr/local/lib/openssl_x86" cp -vf ~/.conan/data/openssl/"$version"/_/_/package/*/lib/*.so.1.1 "/usr/local/lib/openssl_x86" rm -rf ~/.conan/data/openssl/"$version"/_/_/package/ -conan install -if "$(mktemp -d)" -s arch=x86_64 -s arch_build=x86_64 --build=missing -o openssl:shared=True -s compiler.libcxx=libstdc++11 -s build_type=Release "openssl/$version@_/_" +conan install -if "$(mktemp -d)" -s arch=x86_64 --build=missing -o openssl:shared=True -s compiler.libcxx=libstdc++11 -s build_type=Release "openssl/$version@_/_" mkdir -p "/usr/local/lib/openssl_x64" cp -vf ~/.conan/data/openssl/"$version"/_/_/package/*/lib/*.so.1.1 "/usr/local/lib/openssl_x64" # reindex with: ldconfig /usr/local/lib From 9dcb678eb80783978c063991731bb1a94bb397bd Mon Sep 17 00:00:00 2001 From: Lucas Briese Date: Fri, 31 Mar 2023 20:01:45 +0200 Subject: [PATCH 116/116] deps: gosu 1.16, ossl 1.1.1t, scron 0.2.2 --- build/Dockerfile | 106 +++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index 3083df6..a90b4bd 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -3,14 +3,14 @@ FROM ubuntu:22.04 as dependencyStage COPY build/installGosu.sh \ - build/installOpenSSL_1.1.sh \ - build/installSupercronic.sh \ - / + build/installOpenSSL_1.1.sh \ + build/installSupercronic.sh \ + / RUN chmod +x installGosu.sh RUN set -eux; \ - ./installGosu.sh 1.14; \ - ./installSupercronic.sh v0.2.1 5eb5e2533fe75acffa63e437c0d8c4cb1f0c96891b84ae10ef4e53d602505f60; \ - ./installOpenSSL_1.1.sh 1.1.1q + ./installGosu.sh 1.16; \ + ./installSupercronic.sh v0.2.2 8c509ffd2f4adfb722e388cc3ad65ac0baf5e69eb472e298144f50303216903d; \ + ./installOpenSSL_1.1.sh 1.1.1t # create linuxgsm image # this stage should be usable by existing developers @@ -18,56 +18,56 @@ FROM ubuntu:22.04 as linuxgsm ARG ARG_LGSM_VERSION="master" ENV LGSM_VERSION="${ARG_LGSM_VERSION:?}" \ - LGSM_GAMESERVER="" \ + LGSM_GAMESERVER="" \ LGSM_USE_GAMEDIG="true" \ - LGSM_CONFIG_PATTERN_GAME="" \ - USER_ID="750" \ - GROUP_ID="750" \ - LGSM_DEBUG="false" \ - \ - USER_NAME="linuxgsm" \ - LGSM_PATH="/home/linuxgsm" \ - LGSM_SCRIPTS="/home/linuxgsm-scripts" \ - PATH="$PATH:/home/linuxgsm-scripts/" \ - LANG="en_US.UTF-8" \ - LANGUAGE="en_US.UTF-8" \ - LC_ALL="en_US.UTF-8" \ - TERM="xterm" \ - SUPERCRONIC_CONFIG="/home/linuxgsm-scripts/cron.config" \ - LGSM_STARTED="/home/linuxgsm/server.started" \ - LGSM_CURRENT_COMMAND="/home/linuxgsm/lgsm-cmd.currently" + LGSM_CONFIG_PATTERN_GAME="" \ + USER_ID="750" \ + GROUP_ID="750" \ + LGSM_DEBUG="false" \ + \ + USER_NAME="linuxgsm" \ + LGSM_PATH="/home/linuxgsm" \ + LGSM_SCRIPTS="/home/linuxgsm-scripts" \ + PATH="$PATH:/home/linuxgsm-scripts/" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US.UTF-8" \ + LC_ALL="en_US.UTF-8" \ + TERM="xterm" \ + SUPERCRONIC_CONFIG="/home/linuxgsm-scripts/cron.config" \ + LGSM_STARTED="/home/linuxgsm/server.started" \ + LGSM_CURRENT_COMMAND="/home/linuxgsm/lgsm-cmd.currently" COPY --from=dependencyStage \ - /usr/local/bin/gosu \ - /usr/local/bin/supercronic \ - /usr/local/bin/ + /usr/local/bin/gosu \ + /usr/local/bin/supercronic \ + /usr/local/bin/ COPY --from=dependencyStage \ - /usr/local/lib \ - /usr/local/lib/ + /usr/local/lib \ + /usr/local/lib/ COPY build/installMinimalDependencies.sh \ - build/setupUser.sh \ - build/installLGSM.sh \ - build/installGamedig.sh \ - build/cleanImage.sh \ - build/installServerDependencies.sh \ - build/createAlias.sh \ - \ - runtime/entrypoint.sh \ - runtime/lgsm-cron-init \ - runtime/lgsm-cron-start \ - runtime/lgsm-init \ - runtime/lgsm-fix-permission \ - runtime/lgsm-load-config \ - runtime/lgsm-tmux-attach \ - runtime/lgsm-update-uid-gid \ - "$LGSM_SCRIPTS"/ + build/setupUser.sh \ + build/installLGSM.sh \ + build/installGamedig.sh \ + build/cleanImage.sh \ + build/installServerDependencies.sh \ + build/createAlias.sh \ + \ + runtime/entrypoint.sh \ + runtime/lgsm-cron-init \ + runtime/lgsm-cron-start \ + runtime/lgsm-init \ + runtime/lgsm-fix-permission \ + runtime/lgsm-load-config \ + runtime/lgsm-tmux-attach \ + runtime/lgsm-update-uid-gid \ + "$LGSM_SCRIPTS"/ RUN set -eux; \ - installMinimalDependencies.sh; \ - setupUser.sh; \ - installLGSM.sh; \ - installGamedig.sh; \ - cleanImage.sh + installMinimalDependencies.sh; \ + setupUser.sh; \ + installLGSM.sh; \ + installGamedig.sh; \ + cleanImage.sh VOLUME "$LGSM_PATH" WORKDIR "$LGSM_PATH" @@ -77,11 +77,11 @@ FROM linuxgsm as specific ARG ARG_LGSM_GAMESERVER="" ENV LGSM_GAMESERVER="${ARG_LGSM_GAMESERVER:? To build the container by hand you need to set build argument ARG_LGSM_GAMESERVER to your desired servercode}" RUN set -eux; \ - installServerDependencies.sh "$LGSM_GAMESERVER"; \ - createAlias.sh "$LGSM_GAMESERVER"; \ - cleanImage.sh + installServerDependencies.sh "$LGSM_GAMESERVER"; \ + createAlias.sh "$LGSM_GAMESERVER"; \ + cleanImage.sh HEALTHCHECK --start-period=3600s --interval=90s --timeout=900s --retries=3 \ - CMD [ -f "$LGSM_STARTED" ] && lgsm-monitor || exit 1 + CMD [ -f "$LGSM_STARTED" ] && lgsm-monitor || exit 1 ENTRYPOINT ["./../linuxgsm-scripts/entrypoint.sh"]