diff --git a/.dockerignore b/.dockerignore index 1f12e98..5dcedf5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,8 @@ -live/ -README.md +test/ +.gitignore +.editorconfig +examples/ +LICENSE +linuxgsm-docker.sh +*.md + 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/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 diff --git a/.gitignore b/.gitignore index b25c15b..89051c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ *~ +test/*results* +**/*.log +test/steam_test_credentials +*.patch \ No newline at end of file diff --git a/DEVELOPER.md b/DEVELOPER.md new file mode 100644 index 0000000..28213a3 --- /dev/null +++ b/DEVELOPER.md @@ -0,0 +1,34 @@ +# 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`, sometimes usable by extending dockerimages +- runtime scripts `/runtime`, intended to be used by extending dockerimages and available in PATH +- test scripts `/test` + +Please check and use its telling you if you need to install tools and prevents commiting your steam credentials by accident. + +## features + +- 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-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 + +- `/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` + diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 40d0bd8..0000000 --- a/Dockerfile +++ /dev/null @@ -1,102 +0,0 @@ -# -# LinuxGSM Base Dockerfile -# -# https://github.com/GameServerManagers/LinuxGSM-Docker -# - -FROM ubuntu:20.04 - -LABEL maintainer="LinuxGSM " - -ENV DEBIAN_FRONTEND noninteractive -SHELL ["/bin/bash", "-o", "pipefail", "-c"] - -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 - -RUN apt-get update \ - && apt-get install -y locales apt-utils debconf-utils -RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 - -## Base System -RUN apt-get update; \ - apt-get upgrade -y - -RUN apt-get update \ - && apt-get install -y software-properties-common \ - && add-apt-repository multiverse \ - && apt-get update \ - && apt-get install -y \ - sudo \ - curl \ - wget \ - file \ - tar \ - bzip2 \ - gzip \ - unzip \ - cpio \ - bsdmainutils \ - python \ - util-linux \ - ca-certificates \ - binutils \ - bc \ - jq \ - tmux \ - netcat \ - lib32gcc1 \ - lib32stdc++6 \ - iproute2 \ - nano \ - iputils-ping \ - -# Install SteamCMD -&& echo steam steam/question select "I AGREE" | debconf-set-selections \ -&& echo steam steam/license note '' | debconf-set-selections \ -&& dpkg --add-architecture i386 \ -&& apt-get update -y \ -&& apt-get install -y --no-install-recommends ca-certificates locales steamcmd \ - -# Install Gamedig https://docs.linuxgsm.com/requirements/gamedig -&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \ -&& apt-get update && apt-get install -y nodejs \ -&& npm install -g gamedig \ - -# Cleanup -&& apt-get -y autoremove \ -&& apt-get -y clean \ -&& rm -rf /var/lib/apt/lists/* \ -&& rm -rf /tmp/* \ -&& rm -rf /var/tmp/* - -## user config -RUN adduser \ ---disabled-login \ ---disabled-password \ ---shell /bin/bash \ ---gecos "" \ -linuxgsm \ -&& usermod -G tty linuxgsm \ -&& echo "linuxgsm ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \ -&& chown -R linuxgsm:linuxgsm /home/linuxgsm \ - -## linuxgsm.sh -RUN set -ex; \ -mkdir /opt/linuxgsm; \ -chown linuxgsm:linuxgsm /opt/linuxgsm; \ -wget -O /opt/linuxgsm/linuxgsm.sh https://linuxgsm.sh; \ -chmod +x /opt/linuxgsm/linuxgsm.sh - -USER linuxgsm - -WORKDIR /home/linuxgsm - -# need use xterm for LinuxGSM -ENV TERM=xterm - -## Docker Details -ENV PATH=$PATH:/home/linuxgsm diff --git a/README.md b/README.md index cee8c83..0a451a1 100644 --- a/README.md +++ b/README.md @@ -11,38 +11,66 @@ A dockerised version of LinuxGSM https://linuxgsm.com Dockerhub https://hub.docker.com/r/gameservermanagers/linuxgsm-docker/ -# How to Use +## How to use: -## Create Persistant Storage -Game servers require persistant storage to store the server files and configs. The docker reccomended way is to use Persistant storage +1. Choose your servercode and replace in below +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` +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` -``` -docker volume create csgoserver -``` +## Overview -# 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. +- 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 --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) -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. +### How to configure LinuxGSM in docker? -``` -docker exec -it csgoserver nano server.cfg +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/build/Dockerfile b/build/Dockerfile new file mode 100644 index 0000000..a90b4bd --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,87 @@ +# download / build / verify dependencies +# own stage = additional deps needed which are only here used +FROM ubuntu:22.04 as dependencyStage + +COPY build/installGosu.sh \ + build/installOpenSSL_1.1.sh \ + build/installSupercronic.sh \ + / +RUN chmod +x installGosu.sh +RUN set -eux; \ + ./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 +FROM ubuntu:22.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" \ + 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/ +COPY --from=dependencyStage \ + /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"/ + +RUN set -eux; \ + installMinimalDependencies.sh; \ + setupUser.sh; \ + installLGSM.sh; \ + installGamedig.sh; \ + cleanImage.sh + +VOLUME "$LGSM_PATH" +WORKDIR "$LGSM_PATH" + +# install server specific dependencies +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 + +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/build/cleanImage.sh b/build/cleanImage.sh new file mode 100755 index 0000000..8de2dd4 --- /dev/null +++ b/build/cleanImage.sh @@ -0,0 +1,21 @@ +#!/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 + set -o xtrace +fi +echo "[info][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:?}"/* /tmp/* /var/tmp/* || true +rm "$LGSM_SCRIPTS/installMinimalDependencies.sh" \ + "$LGSM_SCRIPTS/installLGSM.sh" \ + "$LGSM_SCRIPTS/installGamedig.sh" \ + "$LGSM_SCRIPTS/setupUser.sh" \ + "$LGSM_PATH"/* >> /dev/null 2>&1 || true diff --git a/build/createAlias.sh b/build/createAlias.sh new file mode 100755 index 0000000..b3579e2 --- /dev/null +++ b/build/createAlias.sh @@ -0,0 +1,59 @@ +#!/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" + exit 1 +fi + +set -o errexit +set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi +echo "[info][createAlias] creating linuxgsm alias" + +function createAlias() { + name="$(tr '[:upper:]' '[:lower:]' <<< "$1")" + command="$LGSM_PATH/$LGSM_GAMESERVER" + file="$LGSM_SCRIPTS/$name" + + if [ -f "$file" ]; then + echo "[error][createAlias.sh]file already exists => cant create alias with this method" + else + echo "[info][createAlias.sh] $command $name" + cat > "$file" <<- EOM + #!/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 + ln -s "$file" "$LGSM_SCRIPTS/lgsm-$name" + fi +} + +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 +) diff --git a/build/installGamedig.sh b/build/installGamedig.sh new file mode 100755 index 0000000..22cac2c --- /dev/null +++ b/build/installGamedig.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +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 + +apt-get update +DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends xz-utils jq + +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" +rm "node-$NODE_VERSION-linux-x64.tar.xz" + +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 diff --git a/build/installGosu.sh b/build/installGosu.sh new file mode 100755 index 0000000..8c3f417 --- /dev/null +++ b/build/installGosu.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +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 +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 +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 +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 diff --git a/build/installLGSM.sh b/build/installLGSM.sh new file mode 100755 index 0000000..b75fd47 --- /dev/null +++ b/build/installLGSM.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +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" +chmod +x "$LGSM_SCRIPTS/linuxgsm.sh" diff --git a/build/installMinimalDependencies.sh b/build/installMinimalDependencies.sh new file mode 100755 index 0000000..a0f2b88 --- /dev/null +++ b/build/installMinimalDependencies.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# install minimal dependencies needed for build / runtime scripts + +set -o errexit +set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi +echo "[info][installMinimalDependencies] installing ..." + +apt-get update +# iproute2, fix "-o: command not found", fix "ss: command not found" +# 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 \ + tmux \ + unzip \ + wget +localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 diff --git a/build/installOpenSSL_1.1.sh b/build/installOpenSSL_1.1.sh new file mode 100755 index 0000000..00e004a --- /dev/null +++ b/build/installOpenSSL_1.1.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -euo pipefail +version="$1" + +apt-get update +apt-get install -y python3-pip gcc-multilib +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 --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 --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 +# ldd *.so should be fine and ldconfig -p should list the so diff --git a/build/installServerDependencies.sh b/build/installServerDependencies.sh new file mode 100755 index 0000000..880c9f7 --- /dev/null +++ b/build/installServerDependencies.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +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" . +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 +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 + echo steam steam/license note '' | debconf-set-selections + + # install dependencies + echo "[info][installDependencies] installing dependencies:" + if grep -qe ':i386' <<< "${cmds[@]}"; then + dpkg --add-architecture i386 + fi + apt-get update + + 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!" + else + echo "[error][installDependencies] failed" + exit 10 + fi + 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/build/installSupercronic.sh b/build/installSupercronic.sh new file mode 100755 index 0000000..6885336 --- /dev/null +++ b/build/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/build/setupUser.sh b/build/setupUser.sh new file mode 100755 index 0000000..c69596d --- /dev/null +++ b/build/setupUser.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# create linuxgsm user + +set -o errexit +set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi +GROUP_NAME="$USER_NAME" + +# 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" +chmod 755 "$LGSM_PATH" diff --git a/deploy/generateExamples.sh b/deploy/generateExamples.sh new file mode 100755 index 0000000..de920b2 --- /dev/null +++ b/deploy/generateExamples.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +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") + 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 "$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" + 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 " + 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)" + + 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: +# docker-compose -f ./examples/$server.yml up -d +volumes: + $server-files: + +name: lgsm + +services: + $server: + image: \"$image:$server\" + tty: true + restart: unless-stopped + environment: + - \"CRON_update_daily=0 7 * * * update\"$steam_credentials_needed + volumes: + - $server-files:/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 + done +) diff --git a/deploy/push.sh b/deploy/push.sh new file mode 100755 index 0000000..bdfb5b2 --- /dev/null +++ b/deploy/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 ./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 + 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/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index 85ec79c..0000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,10 +0,0 @@ -services: - linuxgsm: - image: gameservermanagers/linuxgsm-docker - container_name: lgsm-docker - hostname: 'LGSM' - user: '750:750' - network_mode: host - volumes: - - '/path/to/lgsm:/home/linuxgsm' - restart: always 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/examples/ahl2server.yml b/examples/ahl2server.yml new file mode 100644 index 0000000..aba99cf --- /dev/null +++ b/examples/ahl2server.yml @@ -0,0 +1,30 @@ + +# usage: +# docker-compose -f ./examples/ahl2server.yml up -d +volumes: + ahl2server-files: + +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: + - 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/examples/ahlserver.yml b/examples/ahlserver.yml new file mode 100644 index 0000000..0b93cfb --- /dev/null +++ b/examples/ahlserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/ahlserver.yml up -d +volumes: + ahlserver-files: + +name: lgsm + +services: + ahlserver: + image: "gameservermanagers/linuxgsm-docker:ahlserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - ahlserver-files:/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..74e684a --- /dev/null +++ b/examples/arkserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/arkserver.yml up -d +volumes: + arkserver-files: + +name: lgsm + +services: + arkserver: + image: "gameservermanagers/linuxgsm-docker:arkserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - arkserver-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" diff --git a/examples/arma3server.yml b/examples/arma3server.yml new file mode 100644 index 0000000..9b6d07e --- /dev/null +++ b/examples/arma3server.yml @@ -0,0 +1,28 @@ + +# usage: +# docker-compose -f ./examples/arma3server.yml up -d +volumes: + arma3server-files: + +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: + - arma3server-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game / Voice + - "2302:2302/udp" + # Query + - "2303:2303/udp" + # BattleEye + - "2306:2306/udp" diff --git a/examples/armarserver.yml b/examples/armarserver.yml new file mode 100644 index 0000000..6428c26 --- /dev/null +++ b/examples/armarserver.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/armarserver.yml up -d +volumes: + armarserver-files: + +name: lgsm + +services: + armarserver: + image: "gameservermanagers/linuxgsm-docker:armarserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - armarserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "0:0/udp" diff --git a/examples/avserver.yml b/examples/avserver.yml new file mode 100644 index 0000000..759e0a7 --- /dev/null +++ b/examples/avserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/avserver.yml up -d +volumes: + avserver-files: + +name: lgsm + +services: + avserver: + image: "gameservermanagers/linuxgsm-docker:avserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - avserver-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" diff --git a/examples/bb2server.yml b/examples/bb2server.yml new file mode 100644 index 0000000..4b596c6 --- /dev/null +++ b/examples/bb2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/bb2server.yml up -d +volumes: + bb2server-files: + +name: lgsm + +services: + bb2server: + image: "gameservermanagers/linuxgsm-docker:bb2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - bb2server-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" diff --git a/examples/bbserver.yml b/examples/bbserver.yml new file mode 100644 index 0000000..bc82224 --- /dev/null +++ b/examples/bbserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/bbserver.yml up -d +volumes: + bbserver-files: + +name: lgsm + +services: + bbserver: + image: "gameservermanagers/linuxgsm-docker:bbserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - bbserver-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" diff --git a/examples/bdserver.yml b/examples/bdserver.yml new file mode 100644 index 0000000..0b8d24f --- /dev/null +++ b/examples/bdserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/bdserver.yml up -d +volumes: + bdserver-files: + +name: lgsm + +services: + bdserver: + image: "gameservermanagers/linuxgsm-docker:bdserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - bdserver-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" diff --git a/examples/bf1942server.yml b/examples/bf1942server.yml new file mode 100644 index 0000000..b2f32ad --- /dev/null +++ b/examples/bf1942server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/bf1942server.yml up -d +volumes: + bf1942server-files: + +name: lgsm + +services: + bf1942server: + image: "gameservermanagers/linuxgsm-docker:bf1942server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - bf1942server-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" diff --git a/examples/bfvserver.yml b/examples/bfvserver.yml new file mode 100644 index 0000000..1e75f3d --- /dev/null +++ b/examples/bfvserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/bfvserver.yml up -d +volumes: + bfvserver-files: + +name: lgsm + +services: + bfvserver: + image: "gameservermanagers/linuxgsm-docker:bfvserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - bfvserver-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" diff --git a/examples/bmdmserver.yml b/examples/bmdmserver.yml new file mode 100644 index 0000000..4bb5a8b --- /dev/null +++ b/examples/bmdmserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/bmdmserver.yml up -d +volumes: + bmdmserver-files: + +name: lgsm + +services: + bmdmserver: + image: "gameservermanagers/linuxgsm-docker:bmdmserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - bmdmserver-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" diff --git a/examples/boserver.yml b/examples/boserver.yml new file mode 100644 index 0000000..8c929a2 --- /dev/null +++ b/examples/boserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/boserver.yml up -d +volumes: + boserver-files: + +name: lgsm + +services: + boserver: + image: "gameservermanagers/linuxgsm-docker:boserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - boserver-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" diff --git a/examples/bsserver.yml b/examples/bsserver.yml new file mode 100644 index 0000000..9d07164 --- /dev/null +++ b/examples/bsserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/bsserver.yml up -d +volumes: + bsserver-files: + +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: + - bsserver-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" diff --git a/examples/bt1944server.yml b/examples/bt1944server.yml new file mode 100644 index 0000000..dd084ef --- /dev/null +++ b/examples/bt1944server.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/bt1944server.yml up -d +volumes: + bt1944server-files: + +name: lgsm + +services: + bt1944server: + image: "gameservermanagers/linuxgsm-docker:bt1944server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - bt1944server-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Query + - "7780:7780/udp" + # RCON + - "7779:7779/tcp" diff --git a/examples/btserver.yml b/examples/btserver.yml new file mode 100644 index 0000000..7239f3c --- /dev/null +++ b/examples/btserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/btserver.yml up -d +volumes: + btserver-files: + +name: lgsm + +services: + btserver: + image: "gameservermanagers/linuxgsm-docker:btserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - btserver-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" diff --git a/examples/ccserver.yml b/examples/ccserver.yml new file mode 100644 index 0000000..bcaf27d --- /dev/null +++ b/examples/ccserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/ccserver.yml up -d +volumes: + ccserver-files: + +name: lgsm + +services: + ccserver: + image: "gameservermanagers/linuxgsm-docker:ccserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - ccserver-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" diff --git a/examples/cdserver.yml b/examples/cdserver.yml new file mode 100644 index 0000000..4d517b1 --- /dev/null +++ b/examples/cdserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/cdserver.yml up -d +volumes: + cdserver-files: + +name: lgsm + +services: + cdserver: + image: "gameservermanagers/linuxgsm-docker:cdserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - cdserver-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" diff --git a/examples/cmwserver.yml b/examples/cmwserver.yml new file mode 100644 index 0000000..d31e987 --- /dev/null +++ b/examples/cmwserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/cmwserver.yml up -d +volumes: + cmwserver-files: + +name: lgsm + +services: + cmwserver: + image: "gameservermanagers/linuxgsm-docker:cmwserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - cmwserver-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" diff --git a/examples/cod2server.yml b/examples/cod2server.yml new file mode 100644 index 0000000..d3d2adb --- /dev/null +++ b/examples/cod2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/cod2server.yml up -d +volumes: + cod2server-files: + +name: lgsm + +services: + cod2server: + image: "gameservermanagers/linuxgsm-docker:cod2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - cod2server-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" diff --git a/examples/cod4server.yml b/examples/cod4server.yml new file mode 100644 index 0000000..cf31dce --- /dev/null +++ b/examples/cod4server.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/cod4server.yml up -d +volumes: + cod4server-files: + +name: lgsm + +services: + cod4server: + image: "gameservermanagers/linuxgsm-docker:cod4server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - cod4server-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game / Query + - "28960:28960/udp" diff --git a/examples/codserver.yml b/examples/codserver.yml new file mode 100644 index 0000000..96c085d --- /dev/null +++ b/examples/codserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/codserver.yml up -d +volumes: + codserver-files: + +name: lgsm + +services: + codserver: + image: "gameservermanagers/linuxgsm-docker:codserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - codserver-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" diff --git a/examples/coduoserver.yml b/examples/coduoserver.yml new file mode 100644 index 0000000..c33388d --- /dev/null +++ b/examples/coduoserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/coduoserver.yml up -d +volumes: + coduoserver-files: + +name: lgsm + +services: + coduoserver: + image: "gameservermanagers/linuxgsm-docker:coduoserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - coduoserver-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" diff --git a/examples/codwawserver.yml b/examples/codwawserver.yml new file mode 100644 index 0000000..130ea1f --- /dev/null +++ b/examples/codwawserver.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/codwawserver.yml up -d +volumes: + codwawserver-files: + +name: lgsm + +services: + codwawserver: + image: "gameservermanagers/linuxgsm-docker:codwawserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - codwawserver-files:/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..298d12d --- /dev/null +++ b/examples/colserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/colserver.yml up -d +volumes: + colserver-files: + +name: lgsm + +services: + colserver: + image: "gameservermanagers/linuxgsm-docker:colserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - colserver-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" diff --git a/examples/csczserver.yml b/examples/csczserver.yml new file mode 100644 index 0000000..765a8e2 --- /dev/null +++ b/examples/csczserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/csczserver.yml up -d +volumes: + csczserver-files: + +name: lgsm + +services: + csczserver: + image: "gameservermanagers/linuxgsm-docker:csczserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - csczserver-files:/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..6bdedce --- /dev/null +++ b/examples/csgoserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/csgoserver.yml up -d +volumes: + csgoserver-files: + +name: lgsm + +services: + csgoserver: + image: "gameservermanagers/linuxgsm-docker:csgoserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - csgoserver-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" diff --git a/examples/csserver.yml b/examples/csserver.yml new file mode 100644 index 0000000..b6ec842 --- /dev/null +++ b/examples/csserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/csserver.yml up -d +volumes: + csserver-files: + +name: lgsm + +services: + csserver: + image: "gameservermanagers/linuxgsm-docker:csserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - csserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/cssserver.yml b/examples/cssserver.yml new file mode 100644 index 0000000..e8fe461 --- /dev/null +++ b/examples/cssserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/cssserver.yml up -d +volumes: + cssserver-files: + +name: lgsm + +services: + cssserver: + image: "gameservermanagers/linuxgsm-docker:cssserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - cssserver-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" diff --git a/examples/dabserver.yml b/examples/dabserver.yml new file mode 100644 index 0000000..f56fd2b --- /dev/null +++ b/examples/dabserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/dabserver.yml up -d +volumes: + dabserver-files: + +name: lgsm + +services: + dabserver: + image: "gameservermanagers/linuxgsm-docker:dabserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - dabserver-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" diff --git a/examples/dayzserver.yml b/examples/dayzserver.yml new file mode 100644 index 0000000..5641830 --- /dev/null +++ b/examples/dayzserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/dayzserver.yml up -d +volumes: + dayzserver-files: + +name: lgsm + +services: + dayzserver: + image: "gameservermanagers/linuxgsm-docker:dayzserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - dayzserver-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" diff --git a/examples/dmcserver.yml b/examples/dmcserver.yml new file mode 100644 index 0000000..9838818 --- /dev/null +++ b/examples/dmcserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/dmcserver.yml up -d +volumes: + dmcserver-files: + +name: lgsm + +services: + dmcserver: + image: "gameservermanagers/linuxgsm-docker:dmcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - dmcserver-files:/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..c6beb87 --- /dev/null +++ b/examples/dodrserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/dodrserver.yml up -d +volumes: + dodrserver-files: + +name: lgsm + +services: + dodrserver: + image: "gameservermanagers/linuxgsm-docker:dodrserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - dodrserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Query + - "27015:27015/udp" diff --git a/examples/dodserver.yml b/examples/dodserver.yml new file mode 100644 index 0000000..204893f --- /dev/null +++ b/examples/dodserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/dodserver.yml up -d +volumes: + dodserver-files: + +name: lgsm + +services: + dodserver: + image: "gameservermanagers/linuxgsm-docker:dodserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - dodserver-files:/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..099b853 --- /dev/null +++ b/examples/dodsserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/dodsserver.yml up -d +volumes: + dodsserver-files: + +name: lgsm + +services: + dodsserver: + image: "gameservermanagers/linuxgsm-docker:dodsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - dodsserver-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" diff --git a/examples/doiserver.yml b/examples/doiserver.yml new file mode 100644 index 0000000..2c1f085 --- /dev/null +++ b/examples/doiserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/doiserver.yml up -d +volumes: + doiserver-files: + +name: lgsm + +services: + doiserver: + image: "gameservermanagers/linuxgsm-docker:doiserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - doiserver-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/examples/dstserver.yml b/examples/dstserver.yml new file mode 100644 index 0000000..5c0c091 --- /dev/null +++ b/examples/dstserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/dstserver.yml up -d +volumes: + dstserver-files: + +name: lgsm + +services: + dstserver: + image: "gameservermanagers/linuxgsm-docker:dstserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - dstserver-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" diff --git a/examples/dysserver.yml b/examples/dysserver.yml new file mode 100644 index 0000000..f6b50df --- /dev/null +++ b/examples/dysserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/dysserver.yml up -d +volumes: + dysserver-files: + +name: lgsm + +services: + dysserver: + image: "gameservermanagers/linuxgsm-docker:dysserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - dysserver-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/examples/ecoserver.yml b/examples/ecoserver.yml new file mode 100644 index 0000000..9b65ad8 --- /dev/null +++ b/examples/ecoserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/ecoserver.yml up -d +volumes: + ecoserver-files: + +name: lgsm + +services: + ecoserver: + image: "gameservermanagers/linuxgsm-docker:ecoserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - ecoserver-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" diff --git a/examples/emserver.yml b/examples/emserver.yml new file mode 100644 index 0000000..4f6922e --- /dev/null +++ b/examples/emserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/emserver.yml up -d +volumes: + emserver-files: + +name: lgsm + +services: + emserver: + image: "gameservermanagers/linuxgsm-docker:emserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - emserver-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/examples/etlserver.yml b/examples/etlserver.yml new file mode 100644 index 0000000..e483c97 --- /dev/null +++ b/examples/etlserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/etlserver.yml up -d +volumes: + etlserver-files: + +name: lgsm + +services: + etlserver: + image: "gameservermanagers/linuxgsm-docker:etlserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - etlserver-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" diff --git a/examples/fctrserver.yml b/examples/fctrserver.yml new file mode 100644 index 0000000..aac5598 --- /dev/null +++ b/examples/fctrserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/fctrserver.yml up -d +volumes: + fctrserver-files: + +name: lgsm + +services: + fctrserver: + image: "gameservermanagers/linuxgsm-docker:fctrserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - fctrserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "34197:34197/udp" + # RCON + - "34198:34198/tcp" diff --git a/examples/fofserver.yml b/examples/fofserver.yml new file mode 100644 index 0000000..0b663bf --- /dev/null +++ b/examples/fofserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/fofserver.yml up -d +volumes: + fofserver-files: + +name: lgsm + +services: + fofserver: + image: "gameservermanagers/linuxgsm-docker:fofserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - fofserver-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/examples/gmodserver.yml b/examples/gmodserver.yml new file mode 100644 index 0000000..0f76ad6 --- /dev/null +++ b/examples/gmodserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/gmodserver.yml up -d +volumes: + gmodserver-files: + +name: lgsm + +services: + gmodserver: + image: "gameservermanagers/linuxgsm-docker:gmodserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - gmodserver-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/examples/hl2dmserver.yml b/examples/hl2dmserver.yml new file mode 100644 index 0000000..8ccaaea --- /dev/null +++ b/examples/hl2dmserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/hl2dmserver.yml up -d +volumes: + hl2dmserver-files: + +name: lgsm + +services: + hl2dmserver: + image: "gameservermanagers/linuxgsm-docker:hl2dmserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - hl2dmserver-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/examples/hldmserver.yml b/examples/hldmserver.yml new file mode 100644 index 0000000..97524a2 --- /dev/null +++ b/examples/hldmserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/hldmserver.yml up -d +volumes: + hldmserver-files: + +name: lgsm + +services: + hldmserver: + image: "gameservermanagers/linuxgsm-docker:hldmserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - hldmserver-files:/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..c3fd545 --- /dev/null +++ b/examples/hldmsserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/hldmsserver.yml up -d +volumes: + hldmsserver-files: + +name: lgsm + +services: + hldmsserver: + image: "gameservermanagers/linuxgsm-docker:hldmsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - hldmsserver-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" diff --git a/examples/hwserver.yml b/examples/hwserver.yml new file mode 100644 index 0000000..6f8ec85 --- /dev/null +++ b/examples/hwserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/hwserver.yml up -d +volumes: + hwserver-files: + +name: lgsm + +services: + hwserver: + image: "gameservermanagers/linuxgsm-docker:hwserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - hwserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "12871:12871/udp" + # Query + - "12881:12881/udp" diff --git a/examples/insserver.yml b/examples/insserver.yml new file mode 100644 index 0000000..4beae34 --- /dev/null +++ b/examples/insserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/insserver.yml up -d +volumes: + insserver-files: + +name: lgsm + +services: + insserver: + image: "gameservermanagers/linuxgsm-docker:insserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - insserver-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/examples/inssserver.yml b/examples/inssserver.yml new file mode 100644 index 0000000..b18d93f --- /dev/null +++ b/examples/inssserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/inssserver.yml up -d +volumes: + inssserver-files: + +name: lgsm + +services: + inssserver: + image: "gameservermanagers/linuxgsm-docker:inssserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - inssserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27102:27102/udp" + # Query + - "27131:27131/udp" + # RCON + - "27015:27015/tcp" diff --git a/examples/iosserver.yml b/examples/iosserver.yml new file mode 100644 index 0000000..9bf536d --- /dev/null +++ b/examples/iosserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/iosserver.yml up -d +volumes: + iosserver-files: + +name: lgsm + +services: + iosserver: + image: "gameservermanagers/linuxgsm-docker:iosserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - iosserver-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" diff --git a/examples/jc2server.yml b/examples/jc2server.yml new file mode 100644 index 0000000..634f5b5 --- /dev/null +++ b/examples/jc2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/jc2server.yml up -d +volumes: + jc2server-files: + +name: lgsm + +services: + jc2server: + image: "gameservermanagers/linuxgsm-docker:jc2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - jc2server-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" diff --git a/examples/jc3server.yml b/examples/jc3server.yml new file mode 100644 index 0000000..0035769 --- /dev/null +++ b/examples/jc3server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/jc3server.yml up -d +volumes: + jc3server-files: + +name: lgsm + +services: + jc3server: + image: "gameservermanagers/linuxgsm-docker:jc3server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - jc3server-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" diff --git a/examples/jk2server.yml b/examples/jk2server.yml new file mode 100644 index 0000000..fdc9561 --- /dev/null +++ b/examples/jk2server.yml @@ -0,0 +1,24 @@ + +# usage: +# docker-compose -f ./examples/jk2server.yml up -d +volumes: + jk2server-files: + +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: + - jk2server-files:/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..dbc03df --- /dev/null +++ b/examples/kf2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/kf2server.yml up -d +volumes: + kf2server-files: + +name: lgsm + +services: + kf2server: + image: "gameservermanagers/linuxgsm-docker:kf2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - kf2server-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" diff --git a/examples/kfserver.yml b/examples/kfserver.yml new file mode 100644 index 0000000..9e300f1 --- /dev/null +++ b/examples/kfserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/kfserver.yml up -d +volumes: + kfserver-files: + +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: + - kfserver-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" diff --git a/examples/l4d2server.yml b/examples/l4d2server.yml new file mode 100644 index 0000000..858276b --- /dev/null +++ b/examples/l4d2server.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/l4d2server.yml up -d +volumes: + l4d2server-files: + +name: lgsm + +services: + l4d2server: + image: "gameservermanagers/linuxgsm-docker:l4d2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - l4d2server-files:/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..86f4a6b --- /dev/null +++ b/examples/l4dserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/l4dserver.yml up -d +volumes: + l4dserver-files: + +name: lgsm + +services: + l4dserver: + image: "gameservermanagers/linuxgsm-docker:l4dserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - l4dserver-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" diff --git a/examples/loserver.yml b/examples/loserver.yml new file mode 100644 index 0000000..7071896 --- /dev/null +++ b/examples/loserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/loserver.yml up -d +volumes: + loserver-files: + +name: lgsm + +services: + loserver: + image: "gameservermanagers/linuxgsm-docker:loserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - loserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Query + - "27015:27015/udp" diff --git a/examples/mcbserver.yml b/examples/mcbserver.yml new file mode 100644 index 0000000..d730564 --- /dev/null +++ b/examples/mcbserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/mcbserver.yml up -d +volumes: + mcbserver-files: + +name: lgsm + +services: + mcbserver: + image: "gameservermanagers/linuxgsm-docker:mcbserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - mcbserver-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" diff --git a/examples/mcserver.yml b/examples/mcserver.yml new file mode 100644 index 0000000..5936a9f --- /dev/null +++ b/examples/mcserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/mcserver.yml up -d +volumes: + mcserver-files: + +name: lgsm + +services: + mcserver: + image: "gameservermanagers/linuxgsm-docker:mcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - mcserver-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" diff --git a/examples/mhserver.yml b/examples/mhserver.yml new file mode 100644 index 0000000..3e47a39 --- /dev/null +++ b/examples/mhserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/mhserver.yml up -d +volumes: + mhserver-files: + +name: lgsm + +services: + mhserver: + image: "gameservermanagers/linuxgsm-docker:mhserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - mhserver-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" diff --git a/examples/mohaaserver.yml b/examples/mohaaserver.yml new file mode 100644 index 0000000..705950d --- /dev/null +++ b/examples/mohaaserver.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/mohaaserver.yml up -d +volumes: + mohaaserver-files: + +name: lgsm + +services: + mohaaserver: + image: "gameservermanagers/linuxgsm-docker:mohaaserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - mohaaserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "12203:12203/udp" diff --git a/examples/momserver.yml b/examples/momserver.yml new file mode 100644 index 0000000..b6d3bf6 --- /dev/null +++ b/examples/momserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/momserver.yml up -d +volumes: + momserver-files: + +name: lgsm + +services: + momserver: + image: "gameservermanagers/linuxgsm-docker:momserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - momserver-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" diff --git a/examples/mtaserver.yml b/examples/mtaserver.yml new file mode 100644 index 0000000..56d4016 --- /dev/null +++ b/examples/mtaserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/mtaserver.yml up -d +volumes: + mtaserver-files: + +name: lgsm + +services: + mtaserver: + image: "gameservermanagers/linuxgsm-docker:mtaserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - mtaserver-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" diff --git a/examples/mumbleserver.yml b/examples/mumbleserver.yml new file mode 100644 index 0000000..0bbed1b --- /dev/null +++ b/examples/mumbleserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/mumbleserver.yml up -d +volumes: + mumbleserver-files: + +name: lgsm + +services: + mumbleserver: + image: "gameservermanagers/linuxgsm-docker:mumbleserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - mumbleserver-files:/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..85f2ada --- /dev/null +++ b/examples/ndserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/ndserver.yml up -d +volumes: + ndserver-files: + +name: lgsm + +services: + ndserver: + image: "gameservermanagers/linuxgsm-docker:ndserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - ndserver-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/examples/nmrihserver.yml b/examples/nmrihserver.yml new file mode 100644 index 0000000..e2c63df --- /dev/null +++ b/examples/nmrihserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/nmrihserver.yml up -d +volumes: + nmrihserver-files: + +name: lgsm + +services: + nmrihserver: + image: "gameservermanagers/linuxgsm-docker:nmrihserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - nmrihserver-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/examples/ns2cserver.yml b/examples/ns2cserver.yml new file mode 100644 index 0000000..3e9ee25 --- /dev/null +++ b/examples/ns2cserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/ns2cserver.yml up -d +volumes: + ns2cserver-files: + +name: lgsm + +services: + ns2cserver: + image: "gameservermanagers/linuxgsm-docker:ns2cserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - ns2cserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Query + - "27016:27016/udp" diff --git a/examples/ns2server.yml b/examples/ns2server.yml new file mode 100644 index 0000000..e29ae7f --- /dev/null +++ b/examples/ns2server.yml @@ -0,0 +1,26 @@ + +# usage: +# docker-compose -f ./examples/ns2server.yml up -d +volumes: + ns2server-files: + +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: + - ns2server-files:/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..9568455 --- /dev/null +++ b/examples/nsserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/nsserver.yml up -d +volumes: + nsserver-files: + +name: lgsm + +services: + nsserver: + image: "gameservermanagers/linuxgsm-docker:nsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - nsserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/opforserver.yml b/examples/opforserver.yml new file mode 100644 index 0000000..eb9774a --- /dev/null +++ b/examples/opforserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/opforserver.yml up -d +volumes: + opforserver-files: + +name: lgsm + +services: + opforserver: + image: "gameservermanagers/linuxgsm-docker:opforserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - opforserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/pc2server.yml b/examples/pc2server.yml new file mode 100644 index 0000000..4453175 --- /dev/null +++ b/examples/pc2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/pc2server.yml up -d +volumes: + pc2server-files: + +name: lgsm + +services: + pc2server: + image: "gameservermanagers/linuxgsm-docker:pc2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - pc2server-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" diff --git a/examples/pcserver.yml b/examples/pcserver.yml new file mode 100644 index 0000000..c40a162 --- /dev/null +++ b/examples/pcserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/pcserver.yml up -d +volumes: + pcserver-files: + +name: lgsm + +services: + pcserver: + image: "gameservermanagers/linuxgsm-docker:pcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - pcserver-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" diff --git a/examples/pmcserver.yml b/examples/pmcserver.yml new file mode 100644 index 0000000..be929c9 --- /dev/null +++ b/examples/pmcserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/pmcserver.yml up -d +volumes: + pmcserver-files: + +name: lgsm + +services: + pmcserver: + image: "gameservermanagers/linuxgsm-docker:pmcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - pmcserver-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" diff --git a/examples/pstbsserver.yml b/examples/pstbsserver.yml new file mode 100644 index 0000000..9c5a140 --- /dev/null +++ b/examples/pstbsserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/pstbsserver.yml up -d +volumes: + pstbsserver-files: + +name: lgsm + +services: + pstbsserver: + image: "gameservermanagers/linuxgsm-docker:pstbsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - pstbsserver-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" diff --git a/examples/pvkiiserver.yml b/examples/pvkiiserver.yml new file mode 100644 index 0000000..db54739 --- /dev/null +++ b/examples/pvkiiserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/pvkiiserver.yml up -d +volumes: + pvkiiserver-files: + +name: lgsm + +services: + pvkiiserver: + image: "gameservermanagers/linuxgsm-docker:pvkiiserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - pvkiiserver-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/examples/pvrserver.yml b/examples/pvrserver.yml new file mode 100644 index 0000000..9995aa5 --- /dev/null +++ b/examples/pvrserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/pvrserver.yml up -d +volumes: + pvrserver-files: + +name: lgsm + +services: + pvrserver: + image: "gameservermanagers/linuxgsm-docker:pvrserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - pvrserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Game / Query + - "7777:7777/tcp" diff --git a/examples/q2server.yml b/examples/q2server.yml new file mode 100644 index 0000000..e3f2b94 --- /dev/null +++ b/examples/q2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/q2server.yml up -d +volumes: + q2server-files: + +name: lgsm + +services: + q2server: + image: "gameservermanagers/linuxgsm-docker:q2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - q2server-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" diff --git a/examples/q3server.yml b/examples/q3server.yml new file mode 100644 index 0000000..ed1b15e --- /dev/null +++ b/examples/q3server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/q3server.yml up -d +volumes: + q3server-files: + +name: lgsm + +services: + q3server: + image: "gameservermanagers/linuxgsm-docker:q3server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - q3server-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" diff --git a/examples/qlserver.yml b/examples/qlserver.yml new file mode 100644 index 0000000..a333632 --- /dev/null +++ b/examples/qlserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/qlserver.yml up -d +volumes: + qlserver-files: + +name: lgsm + +services: + qlserver: + image: "gameservermanagers/linuxgsm-docker:qlserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - qlserver-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" diff --git a/examples/qwserver.yml b/examples/qwserver.yml new file mode 100644 index 0000000..d8d136b --- /dev/null +++ b/examples/qwserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/qwserver.yml up -d +volumes: + qwserver-files: + +name: lgsm + +services: + qwserver: + image: "gameservermanagers/linuxgsm-docker:qwserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - qwserver-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" diff --git a/examples/ricochetserver.yml b/examples/ricochetserver.yml new file mode 100644 index 0000000..78c75a3 --- /dev/null +++ b/examples/ricochetserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/ricochetserver.yml up -d +volumes: + ricochetserver-files: + +name: lgsm + +services: + ricochetserver: + image: "gameservermanagers/linuxgsm-docker:ricochetserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - ricochetserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/roserver.yml b/examples/roserver.yml new file mode 100644 index 0000000..458f55f --- /dev/null +++ b/examples/roserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/roserver.yml up -d +volumes: + roserver-files: + +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: + - roserver-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" diff --git a/examples/rtcwserver.yml b/examples/rtcwserver.yml new file mode 100644 index 0000000..b8da40b --- /dev/null +++ b/examples/rtcwserver.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/rtcwserver.yml up -d +volumes: + rtcwserver-files: + +name: lgsm + +services: + rtcwserver: + image: "gameservermanagers/linuxgsm-docker:rtcwserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - rtcwserver-files:/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..34749ce --- /dev/null +++ b/examples/rustserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/rustserver.yml up -d +volumes: + rustserver-files: + +name: lgsm + +services: + rustserver: + image: "gameservermanagers/linuxgsm-docker:rustserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - rustserver-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" diff --git a/examples/sampserver.yml b/examples/sampserver.yml new file mode 100644 index 0000000..514b83b --- /dev/null +++ b/examples/sampserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/sampserver.yml up -d +volumes: + sampserver-files: + +name: lgsm + +services: + sampserver: + image: "gameservermanagers/linuxgsm-docker:sampserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - sampserver-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" diff --git a/examples/sbotsserver.yml b/examples/sbotsserver.yml new file mode 100644 index 0000000..fca0c1c --- /dev/null +++ b/examples/sbotsserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/sbotsserver.yml up -d +volumes: + sbotsserver-files: + +name: lgsm + +services: + sbotsserver: + image: "gameservermanagers/linuxgsm-docker:sbotsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - sbotsserver-files:/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..e2b4793 --- /dev/null +++ b/examples/sbserver.yml @@ -0,0 +1,28 @@ + +# usage: +# docker-compose -f ./examples/sbserver.yml up -d +volumes: + sbserver-files: + +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: + - sbserver-files:/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..51c1d4f --- /dev/null +++ b/examples/scpslserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/scpslserver.yml up -d +volumes: + scpslserver-files: + +name: lgsm + +services: + scpslserver: + image: "gameservermanagers/linuxgsm-docker:scpslserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - scpslserver-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" diff --git a/examples/scpslsmserver.yml b/examples/scpslsmserver.yml new file mode 100644 index 0000000..aff3998 --- /dev/null +++ b/examples/scpslsmserver.yml @@ -0,0 +1,21 @@ + +# usage: +# docker-compose -f ./examples/scpslsmserver.yml up -d +volumes: + scpslsmserver-files: + +name: lgsm + +services: + scpslsmserver: + image: "gameservermanagers/linuxgsm-docker:scpslsmserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - scpslsmserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/tcp" diff --git a/examples/sdtdserver.yml b/examples/sdtdserver.yml new file mode 100644 index 0000000..6ba013a --- /dev/null +++ b/examples/sdtdserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/sdtdserver.yml up -d +volumes: + sdtdserver-files: + +name: lgsm + +services: + sdtdserver: + image: "gameservermanagers/linuxgsm-docker:sdtdserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - sdtdserver-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" diff --git a/examples/sfcserver.yml b/examples/sfcserver.yml new file mode 100644 index 0000000..df12d2c --- /dev/null +++ b/examples/sfcserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/sfcserver.yml up -d +volumes: + sfcserver-files: + +name: lgsm + +services: + sfcserver: + image: "gameservermanagers/linuxgsm-docker:sfcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - sfcserver-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" diff --git a/examples/sfserver.yml b/examples/sfserver.yml new file mode 100644 index 0000000..f0ab038 --- /dev/null +++ b/examples/sfserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/sfserver.yml up -d +volumes: + sfserver-files: + +name: lgsm + +services: + sfserver: + image: "gameservermanagers/linuxgsm-docker:sfserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - sfserver-files:/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..12aa85c --- /dev/null +++ b/examples/sof2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/sof2server.yml up -d +volumes: + sof2server-files: + +name: lgsm + +services: + sof2server: + image: "gameservermanagers/linuxgsm-docker:sof2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - sof2server-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" diff --git a/examples/solserver.yml b/examples/solserver.yml new file mode 100644 index 0000000..c96ba13 --- /dev/null +++ b/examples/solserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/solserver.yml up -d +volumes: + solserver-files: + +name: lgsm + +services: + solserver: + image: "gameservermanagers/linuxgsm-docker:solserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - solserver-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" diff --git a/examples/squadserver.yml b/examples/squadserver.yml new file mode 100644 index 0000000..866e223 --- /dev/null +++ b/examples/squadserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/squadserver.yml up -d +volumes: + squadserver-files: + +name: lgsm + +services: + squadserver: + image: "gameservermanagers/linuxgsm-docker:squadserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - squadserver-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" diff --git a/examples/stnserver.yml b/examples/stnserver.yml new file mode 100644 index 0000000..957cd34 --- /dev/null +++ b/examples/stnserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/stnserver.yml up -d +volumes: + stnserver-files: + +name: lgsm + +services: + stnserver: + image: "gameservermanagers/linuxgsm-docker:stnserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - stnserver-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" diff --git a/examples/stserver.yml b/examples/stserver.yml new file mode 100644 index 0000000..b917545 --- /dev/null +++ b/examples/stserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/stserver.yml up -d +volumes: + stserver-files: + +name: lgsm + +services: + stserver: + image: "gameservermanagers/linuxgsm-docker:stserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - stserver-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" diff --git a/examples/svenserver.yml b/examples/svenserver.yml new file mode 100644 index 0000000..9b37bf8 --- /dev/null +++ b/examples/svenserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/svenserver.yml up -d +volumes: + svenserver-files: + +name: lgsm + +services: + svenserver: + image: "gameservermanagers/linuxgsm-docker:svenserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - svenserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/tf2server.yml b/examples/tf2server.yml new file mode 100644 index 0000000..49d0444 --- /dev/null +++ b/examples/tf2server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/tf2server.yml up -d +volumes: + tf2server-files: + +name: lgsm + +services: + tf2server: + image: "gameservermanagers/linuxgsm-docker:tf2server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - tf2server-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" diff --git a/examples/tfcserver.yml b/examples/tfcserver.yml new file mode 100644 index 0000000..260d10d --- /dev/null +++ b/examples/tfcserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/tfcserver.yml up -d +volumes: + tfcserver-files: + +name: lgsm + +services: + tfcserver: + image: "gameservermanagers/linuxgsm-docker:tfcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - tfcserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "27015:27015/udp" + # Client + - "27005:27005/udp" diff --git a/examples/tiserver.yml b/examples/tiserver.yml new file mode 100644 index 0000000..2b69781 --- /dev/null +++ b/examples/tiserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/tiserver.yml up -d +volumes: + tiserver-files: + +name: lgsm + +services: + tiserver: + image: "gameservermanagers/linuxgsm-docker:tiserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - tiserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Query + - "27015:27015/udp" diff --git a/examples/ts3server.yml b/examples/ts3server.yml new file mode 100644 index 0000000..fbf1256 --- /dev/null +++ b/examples/ts3server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/ts3server.yml up -d +volumes: + ts3server-files: + +name: lgsm + +services: + ts3server: + image: "gameservermanagers/linuxgsm-docker:ts3server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - ts3server-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" diff --git a/examples/tsserver.yml b/examples/tsserver.yml new file mode 100644 index 0000000..45288b4 --- /dev/null +++ b/examples/tsserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/tsserver.yml up -d +volumes: + tsserver-files: + +name: lgsm + +services: + tsserver: + image: "gameservermanagers/linuxgsm-docker:tsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - tsserver-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" diff --git a/examples/tuserver.yml b/examples/tuserver.yml new file mode 100644 index 0000000..85a1b16 --- /dev/null +++ b/examples/tuserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/tuserver.yml up -d +volumes: + tuserver-files: + +name: lgsm + +services: + tuserver: + image: "gameservermanagers/linuxgsm-docker:tuserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - tuserver-files:/home/linuxgsm + - /etc/localtime:/etc/localtime:ro + ports: + # Game + - "7777:7777/udp" + # Query + - "27015:27015/udp" + # Steam + - "7778:7778/udp" diff --git a/examples/twserver.yml b/examples/twserver.yml new file mode 100644 index 0000000..b05dc03 --- /dev/null +++ b/examples/twserver.yml @@ -0,0 +1,25 @@ + +# usage: +# docker-compose -f ./examples/twserver.yml up -d +volumes: + twserver-files: + +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: + - twserver-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" diff --git a/examples/untserver.yml b/examples/untserver.yml new file mode 100644 index 0000000..97b2e77 --- /dev/null +++ b/examples/untserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/untserver.yml up -d +volumes: + untserver-files: + +name: lgsm + +services: + untserver: + image: "gameservermanagers/linuxgsm-docker:untserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - untserver-files:/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..a12868a --- /dev/null +++ b/examples/ut2k4server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/ut2k4server.yml up -d +volumes: + ut2k4server-files: + +name: lgsm + +services: + ut2k4server: + image: "gameservermanagers/linuxgsm-docker:ut2k4server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - ut2k4server-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" diff --git a/examples/ut3server.yml b/examples/ut3server.yml new file mode 100644 index 0000000..9f8b8fc --- /dev/null +++ b/examples/ut3server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/ut3server.yml up -d +volumes: + ut3server-files: + +name: lgsm + +services: + ut3server: + image: "gameservermanagers/linuxgsm-docker:ut3server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - ut3server-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" diff --git a/examples/ut99server.yml b/examples/ut99server.yml new file mode 100644 index 0000000..176626a --- /dev/null +++ b/examples/ut99server.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/ut99server.yml up -d +volumes: + ut99server-files: + +name: lgsm + +services: + ut99server: + image: "gameservermanagers/linuxgsm-docker:ut99server" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - ut99server-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" diff --git a/examples/utserver.yml b/examples/utserver.yml new file mode 100644 index 0000000..afd9c47 --- /dev/null +++ b/examples/utserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/utserver.yml up -d +volumes: + utserver-files: + +name: lgsm + +services: + utserver: + image: "gameservermanagers/linuxgsm-docker:utserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - utserver-files:/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..1fc1541 --- /dev/null +++ b/examples/vhserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/vhserver.yml up -d +volumes: + vhserver-files: + +name: lgsm + +services: + vhserver: + image: "gameservermanagers/linuxgsm-docker:vhserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - vhserver-files:/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..25c03f4 --- /dev/null +++ b/examples/vintsserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/vintsserver.yml up -d +volumes: + vintsserver-files: + +name: lgsm + +services: + vintsserver: + image: "gameservermanagers/linuxgsm-docker:vintsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - vintsserver-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" diff --git a/examples/vsserver.yml b/examples/vsserver.yml new file mode 100644 index 0000000..4464ced --- /dev/null +++ b/examples/vsserver.yml @@ -0,0 +1,23 @@ + +# usage: +# docker-compose -f ./examples/vsserver.yml up -d +volumes: + vsserver-files: + +name: lgsm + +services: + vsserver: + image: "gameservermanagers/linuxgsm-docker:vsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - vsserver-files:/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..e18baf5 --- /dev/null +++ b/examples/wetserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/wetserver.yml up -d +volumes: + wetserver-files: + +name: lgsm + +services: + wetserver: + image: "gameservermanagers/linuxgsm-docker:wetserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - wetserver-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" diff --git a/examples/wfserver.yml b/examples/wfserver.yml new file mode 100644 index 0000000..e5cb937 --- /dev/null +++ b/examples/wfserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/wfserver.yml up -d +volumes: + wfserver-files: + +name: lgsm + +services: + wfserver: + image: "gameservermanagers/linuxgsm-docker:wfserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - wfserver-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" diff --git a/examples/wmcserver.yml b/examples/wmcserver.yml new file mode 100644 index 0000000..66bad8e --- /dev/null +++ b/examples/wmcserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/wmcserver.yml up -d +volumes: + wmcserver-files: + +name: lgsm + +services: + wmcserver: + image: "gameservermanagers/linuxgsm-docker:wmcserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - wmcserver-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" diff --git a/examples/wurmserver.yml b/examples/wurmserver.yml new file mode 100644 index 0000000..9bb3616 --- /dev/null +++ b/examples/wurmserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/wurmserver.yml up -d +volumes: + wurmserver-files: + +name: lgsm + +services: + wurmserver: + image: "gameservermanagers/linuxgsm-docker:wurmserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - wurmserver-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" diff --git a/examples/zmrserver.yml b/examples/zmrserver.yml new file mode 100644 index 0000000..eac37d4 --- /dev/null +++ b/examples/zmrserver.yml @@ -0,0 +1,22 @@ + +# usage: +# docker-compose -f ./examples/zmrserver.yml up -d +volumes: + zmrserver-files: + +name: lgsm + +services: + zmrserver: + image: "gameservermanagers/linuxgsm-docker:zmrserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - zmrserver-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" diff --git a/examples/zpsserver.yml b/examples/zpsserver.yml new file mode 100644 index 0000000..330c4b1 --- /dev/null +++ b/examples/zpsserver.yml @@ -0,0 +1,27 @@ + +# usage: +# docker-compose -f ./examples/zpsserver.yml up -d +volumes: + zpsserver-files: + +name: lgsm + +services: + zpsserver: + image: "gameservermanagers/linuxgsm-docker:zpsserver" + tty: true + restart: unless-stopped + environment: + - "CRON_update_daily=0 7 * * * update" + volumes: + - zpsserver-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/init_dev_environment.sh b/init_dev_environment.sh new file mode 100644 index 0000000..71109a7 --- /dev/null +++ b/init_dev_environment.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +tools=(jq) + +( + cd "$(dirname "$0")" + + if which sudo > /dev/null 2>&1; then + 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 test/steam_test_credentials + + # fix permissions + 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/runtime/entrypoint.sh b/runtime/entrypoint.sh new file mode 100755 index 0000000..21c87e3 --- /dev/null +++ b/runtime/entrypoint.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +set -o errexit +set -o pipefail +set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace + touch ".dev-debug" + rm dev-debug*.log > /dev/null 2>&1 || true # remove from last execution +else + rm ".dev-debug" || true +fi + +if ! "$LGSM_USE_GAMEDIG"; then + npm uninstall -g gamedig +fi + +cd "$LGSM_PATH" +rm "$LGSM_STARTED" > /dev/null 2>&1 || true + +lgsm-update-uid-gid +lgsm-fix-permission +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 + 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 + +# 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" + 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" + +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 & + 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" + 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 + + # 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 with exitcode=$errorcode" +exit "$errorcode" diff --git a/runtime/lgsm-cron-init b/runtime/lgsm-cron-init new file mode 100755 index 0000000..bcd13ed --- /dev/null +++ b/runtime/lgsm-cron-init @@ -0,0 +1,20 @@ +#!/bin/sh + +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")" +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 +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 -test -debug "$SUPERCRONIC_CONFIG" diff --git a/runtime/lgsm-cron-start b/runtime/lgsm-cron-start new file mode 100755 index 0000000..06be44c --- /dev/null +++ b/runtime/lgsm-cron-start @@ -0,0 +1,9 @@ +#!/bin/sh + +set -o errexit +set -o nounset +if "$LGSM_DEBUG"; then + set -o xtrace +fi + +gosu "$USER_NAME" supercronic -debug "$SUPERCRONIC_CONFIG" diff --git a/runtime/lgsm-fix-permission b/runtime/lgsm-fix-permission new file mode 100755 index 0000000..2c49bf0 --- /dev/null +++ b/runtime/lgsm-fix-permission @@ -0,0 +1,17 @@ +#!/bin/sh + +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 + +GROUP_NAME="$USER_NAME" +chown -R "$USER_NAME:$GROUP_NAME" "$LGSM_PATH" +chmod 750 "$LGSM_PATH" +if [ -f "$LGSM_PATH/$LGSM_GAMESERVER" ]; then + chmod 750 "$LGSM_PATH/$LGSM_GAMESERVER" +fi +chmod -R ug+rw,o= "$LGSM_PATH" diff --git a/runtime/lgsm-init b/runtime/lgsm-init new file mode 100755 index 0000000..4c89b15 --- /dev/null +++ b/runtime/lgsm-init @@ -0,0 +1,20 @@ +#!/bin/sh + +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 +# 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 "[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 +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/runtime/lgsm-load-config b/runtime/lgsm-load-config new file mode 100755 index 0000000..01163e5 --- /dev/null +++ b/runtime/lgsm-load-config @@ -0,0 +1,139 @@ +#!/bin/bash + +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" + exit 10 +fi +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 )" + +if [ ! -f "$configfile_default" ]; then + echo "[error][lgsm-load-config] expected _default config file doesn't exist at \"$configfile_default\"" + 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 + 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" # dont print value, could contain secrets + + # 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:-}" + + #shellcheck disable=SC1087 #prefix is no array + for config in $( env | grep -Eo "^$prefix[^=]*" ); do + key="${config:${#prefix}}" + value="$( eval echo "\"\$$config\"" )" + + echo "[info][lgsm-load-config] processing $key" + 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] can't check if $key is part of $check_file because the file doesn't exist" + exit 13 + fi + else + 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" "%s=\"%s\"" "$configfile_default" +# CONFIGFORCED_ -> skip check, e.g. +handleEnvironmentVariablePrefix "CONFIGFORCED_" "$configfile_common" "%s=\"%s\"" + +# GAME_ is added to game specific config file +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/runtime/lgsm-set-steam-credentials b/runtime/lgsm-set-steam-credentials new file mode 100644 index 0000000..e69de29 diff --git a/runtime/lgsm-tmux-attach b/runtime/lgsm-tmux-attach new file mode 100755 index 0000000..bd6a3f5 --- /dev/null +++ b/runtime/lgsm-tmux-attach @@ -0,0 +1,10 @@ +#!/bin/sh + +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/runtime/lgsm-update-uid-gid b/runtime/lgsm-update-uid-gid new file mode 100755 index 0000000..37c02ba --- /dev/null +++ b/runtime/lgsm-update-uid-gid @@ -0,0 +1,20 @@ +#!/bin/sh + +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 + 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 "[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" "{}" \; +fi diff --git a/test/debug-utils/compare_multiple_result_folders.sh b/test/debug-utils/compare_multiple_result_folders.sh new file mode 100644 index 0000000..dc4ae1a --- /dev/null +++ b/test/debug-utils/compare_multiple_result_folders.sh @@ -0,0 +1,37 @@ +#!/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) + 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 "./test/${result//.\//}:10000" + done + elif [ "${#successful[@]}" -eq "0" ]; then + echo "" + echo "$servercode always failing" + for result in "${successful[@]}" "${failed[@]}"; do + echo "./test/${result//.\//}:10000" + done + fi + done +) diff --git a/test/debug-utils/extract_health_check.sh b/test/debug-utils/extract_health_check.sh new file mode 100755 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/features.sh b/test/features.sh new file mode 100755 index 0000000..399a5f5 --- /dev/null +++ b/test/features.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +cd "$(dirname "$0")/.." + +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" + + +( + cd "$(dirname "$0")/.." + if "$CLEAR"; then + docker volume rm "$VOLUME" || true + fi + ./test/single.sh --version "$VERSION" --volume "$VOLUME" "$GAMESERVER" + + ./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 new file mode 100755 index 0000000..bd029e6 --- /dev/null +++ b/test/features/testCron.sh @@ -0,0 +1,101 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +#VERSION="$1" +GAMESERVER="$2" +VOLUME="$3" +CONTAINER="linuxgsm-$GAMESERVER-testCron" +# shellcheck source=test/internal/api_docker.sh +source "$(dirname "$0")/../internal/api_docker.sh" + +( + cd "$(dirname "$0")/../.." + DOCKERFILE_CRONLOCATION="$(grep -Po '(?<=SUPERCRONIC_CONFIG=")[^"]*' build/Dockerfile)" + + + function fn_exit() { + removeContainer "$CONTAINER" + exit "${1:-1}" + } + trap fn_exit SIGTERM SIGINT + + function log() { + if [ -n "${2:-}" ]; then + echo "[error][testCron] $1" + fn_exit "$2" + else + echo "[info][testCron] $1" + fi + } + + # initial run = no cron + removeContainer "$CONTAINER" + ./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" + else + log "container shouldn't have a cronjob" 20 + fi + else + log "container is unhealthy" 10 + fi + + # inject one cron + CRON_TEST1="* * * * * echo \"hello world1\"" + removeContainer "$CONTAINER" + ./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 + 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 + else + log "successfully tested one cronjob" + fi + else + log "container is unhealthy" 11 + fi + + # inject multiple cron + CRON_TEST2="* * * * * echo \"hello world2\"" + removeContainer "$CONTAINER" + ./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 + log "expected 3 cron lines, found $(echo "$crontab" | wc -l)" 23 + elif ! grep -qE "^$CRON_TEST1" <<< "$crontab"; then + log "provided first crontab isn't part of container but should be" 24 + elif ! grep -qE "^$CRON_TEST2" <<< "$crontab"; then + log "provided second crontab isn't part of container but should be" 25 + else + log "successfully tested two cronjobs" + log "$crontab" + fi + else + log "container is unhealthy" 12 + fi + + # check supercron is running + if docker exec -it "$CONTAINER" pidof supercronic > /dev/null; then + log "supercronic started!" + else + log "supercronic NOT started" 13 + fi + + # fail for illegal cron job + removeContainer "$CONTAINER" + ./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 + log "container is healthy for illegal cronjob which should fail early" 14 + fi + + removeContainer "$CONTAINER" +) diff --git a/test/features/testDockerLogs.sh b/test/features/testDockerLogs.sh new file mode 100755 index 0000000..1650c47 --- /dev/null +++ b/test/features/testDockerLogs.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +VERSION="$1" +GAMESERVER="$2" +VOLUME="$3" + +( + log="$(realpath "$(dirname "$0")")/testDockerLogs.log" + cd "$(dirname "$0")/../.." + + ./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" + exit 0 + else + echo "[failed][testDockerLogs] failed, check $log" + tail "$log" + exit 1 + fi +) diff --git a/test/features/testFixPermissions.sh b/test/features/testFixPermissions.sh new file mode 100755 index 0000000..1f3af66 --- /dev/null +++ b/test/features/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=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" + +( + 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" + + function log() { + if [ -n "${2:-}" ]; then + echo "[error][testFixPermissions] $1" + echo "${3:-}" + exit "$2" + else + echo "[info][testFixPermissions] $1" + fi + } + + 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 + log "new file has wrong permission \"$permission\"" 20 + + elif ! grep -qE "^[^ ]*\s*[0-9]\s*$uid\s*$gid" <<< "$owner"; then + log "new file has wrong owner \"$owner\"" 21 + else + log "new file has correct permissions / owner" + fi + + permission="$("${dockerRun[@]}" alpine ls -l "lgsm")" + if ! grep -qE '^.rw.r..---' <<< "$permission"; then + log "lgsm folder has wrong permission" 22 + + elif [ "0" != "$("${dockerRun[@]}" alpine find "lgsm" ! -user "$uid" | wc -l)" ]; then + 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 + log "lgsm folder / subfile has false gid" 24 "$("${dockerRun[@]}" alpine find "lgsm" ! -group "$gid" | tail)" + + else + 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 + log "gameserver executable has wrong permission \"$permission\"" 25 + + elif ! grep -qE "^[^ ]*\s*[0-9]\s*$uid\s*$gid" <<< "$owner"; then + log "gameserver executable wrong owner \"$owner\"" 26 + + else + log "gameserver executable has correct permissions / owner" + fi + else + log "permissions not fixed and container failed to start" 10 + fi + + "${dockerRun[@]}" alpine rm "$newFile" +) diff --git a/test/features/testLgsmUpdate.sh b/test/features/testLgsmUpdate.sh new file mode 100755 index 0000000..64cea7a --- /dev/null +++ b/test/features/testLgsmUpdate.sh @@ -0,0 +1,45 @@ +#!/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")/../.." + ./test/single.sh --very-fast --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 + rm "$log_downgrade" "$log_update" > /dev/null 2>&1 || true + echo "[info][testLgsmUpdate] $1" + fi + } + + # old versions are allowed to fail, as long as log contains the expected entry + ./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/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 + log "upgrading successful but container didn't forcefully uninstalled lgsm" 23 + + else + log "successfully downgraded and upgraded lgsm" + fi +) diff --git a/test/features/testLoadConfig.sh b/test/features/testLoadConfig.sh new file mode 100755 index 0000000..e463fc2 --- /dev/null +++ b/test/features/testLoadConfig.sh @@ -0,0 +1,175 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +# shellcheck source=test/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" + ./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" + 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" + ./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" + 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" + ./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)" + 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" + ./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\"" + 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/test/features/testUpdateUidGuid.sh b/test/features/testUpdateUidGuid.sh new file mode 100755 index 0000000..dcbf7d3 --- /dev/null +++ b/test/features/testUpdateUidGuid.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +VERSION="$1" +GAMESERVER="$2" +VOLUME="$3" +uid="750" +gid="750" + +( + cd "$(dirname "$0")/../.." + ./test/single.sh --very-fast --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") + "${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" ! -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 + log "precondition successful" + 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" ! -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" ! -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 + log "update successful" + fi + + log "resetting permissions" + "${dockerRun[@]}" alpine chown -R "$uid:$gid" . +) diff --git a/test/internal/api_docker.sh b/test/internal/api_docker.sh new file mode 100755 index 0000000..e3a4120 --- /dev/null +++ b/test/internal/api_docker.sh @@ -0,0 +1,51 @@ +#!/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 stopContainer() { + docker stop "$1" > /dev/null 2>&1 || true +} + +function removeContainer() { + stopContainer "$1" + # remove anonymous volumes as well + docker rm --volumes "$1" > /dev/null 2>&1 || true +} + +function awaitHealthCheck() { + container="$1" + + if existsContainer "$container" || ! hasContainerHealthCheak "$container"; then + return 1 + fi + + echo -n "[info][awaitHealthCheck] waiting for health check of \"$container\" " + seconds=0 + while isContainerHealthStarting "$container"; do + seconds=$((seconds+1)) + sleep 1s + echo -en "\r[info][awaitHealthCheck] waiting for health check of \"$container\" currently ${seconds} seconds" + done + echo "" + echo "[info][awaitHealthCheck] \"$container\" health check startup time $seconds" + + isContainerHealthHealthy "$container" +} diff --git a/test/internal/api_various.sh b/test/internal/api_various.sh new file mode 100755 index 0000000..fd3a813 --- /dev/null +++ b/test/internal/api_various.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +#shellcheck disable=SC2034 # external used +DEFAULT_DOCKER_REPOSITORY="gameservermanagers/linuxgsm-docker" + +function isEmpty() { + [ -z "$1" ] +} + +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 | grep -vE '^fetching' + rm -rf "$working_folder" > /dev/null 2>&1 + ) +} + +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/test/internal/build.sh b/test/internal/build.sh new file mode 100755 index 0000000..51d6b78 --- /dev/null +++ b/test/internal/build.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +set -o errexit +set -o pipefail +set -o nounset + +# shellcheck source=test/internal/api_docker.sh +source "$(dirname "$0")/api_docker.sh" +# shellcheck source=test/internal/api_various.sh +source "$(dirname "$0")/api_various.sh" + +server="" +image="$DEFAULT_DOCKER_REPOSITORY" +latest="false" +skip_lgsm="false" +suffix="" +lgsm_version="master" +lgsm_tags_latest=() + +build_lgsm=(docker build -f build/Dockerfile) +build_specific=("${build_lgsm[@]}") +while [ $# -ge 1 ]; do + key="$1" + shift + + case "$key" in + -h|--help) + 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=$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" + exit 0;; + -c|--no-cache) + build_lgsm+=(--no-cache);; + -i|--image) + image="$1" + shift;; + --latest) + latest="true";; + --skip-lgsm) + skip_lgsm="true";; + --suffix) + if [ -n "$1" ]; then + suffix="-$1" + else + echo "[warning][build] you provided an empty suffix, skipping" + fi + shift;; + -v|--version) + 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 + 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 + +lgsm_main_tag="$lgsm_version$suffix" +specific_main_tag="$lgsm_version-${server}$suffix" +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")/../.." + +# build lgsm image +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 "$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 + +# build specific image +if [ -n "$server" ]; then + echo "${build_specific[@]}" + "${build_specific[@]}" + echo "[info][build] created tag: $image:$specific_main_tag" + if "$latest"; then + 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/test/internal/run.sh b/test/internal/run.sh new file mode 100755 index 0000000..c9b7606 --- /dev/null +++ b/test/internal/run.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +# shellcheck source=test/internal/api_various.sh +source "$(dirname "$0")/api_various.sh" + +TAG="" +SUFFIX="" +docker_run_mode="-it" +IMAGE="$DEFAULT_DOCKER_REPOSITORY" +container="lgsm-test" + +run_image=(docker run) +while [ $# -ge 1 ]; do + key="$1" + shift + + case "$key" in + -h|--help) + 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] --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] " + 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) + run_image+=(--entrypoint "bash");; + --detach) + docker_run_mode="-dt";; + -i|--image) + IMAGE="$1" + shift;; + --suffix) + if [ -n "$1" ]; then + SUFFIX="-$1" + else + echo "[warning][run] skipping suffix because its empty" + fi + shift;; + -t|--tag) + TAG="$1" + shift;; + --quick) + run_image+=("--health-interval=10s" "--health-start-period=60s");; + -v|--volume) + run_image+=(-v "$1:/home/linuxgsm") + shift;; + *) + if [ -n "$key" ]; then + echo "[info][run] additional argument to docker: $key" | sed -E 's/(steamuser|steampass)=\S+/\1="xxx"/g' + run_image+=("$key") + fi + ;; + esac +done +run_image+=("$docker_run_mode" --name "$container" "$IMAGE:$TAG$SUFFIX") + +echo "${run_image[@]}" | sed -E 's/(steamuser|steampass)=\S+/\1="xxx"/g' +"${run_image[@]}" + diff --git a/test/multiple.sh b/test/multiple.sh new file mode 100755 index 0000000..0908ea3 --- /dev/null +++ b/test/multiple.sh @@ -0,0 +1,247 @@ +#!/bin/bash + +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="$(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 + + 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 + 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 + + 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][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 + 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 +) \ No newline at end of file diff --git a/test/shellcheck.sh b/test/shellcheck.sh new file mode 100755 index 0000000..9b5abeb --- /dev/null +++ b/test/shellcheck.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -o errexit +set -o nounset + +( + cd "$(dirname "$0")/.." + + files=() + 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" + + if shellcheck "${files[@]}"; then + echo "[info][shellcheck] successful" + else + echo "[info][shellcheck] failed" + fi +) diff --git a/test/single.sh b/test/single.sh new file mode 100755 index 0000000..dd55330 --- /dev/null +++ b/test/single.sh @@ -0,0 +1,196 @@ +#!/bin/bash + +echo "single.sh $*" + +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 + + ( + 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 + done + removeContainer "$CONTAINER" + + if "$successful"; then + echo "[info][single] successful" + exit 0 + else + echo "[error][single] failed" + exit 1 + fi + ) +) \ No newline at end of file diff --git a/test/steam_test_credentials b/test/steam_test_credentials new file mode 100644 index 0000000..74ed2ae --- /dev/null +++ b/test/steam_test_credentials @@ -0,0 +1,11 @@ +#!/bin/bash +# exclude from git with: +# git update-index --skip-worktree test/steam_test_credentials +# revert: +# git update-index --no-skip-worktree test/steam_test_credentials +#shellcheck disable=SC2034 # used elsewhere +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) diff --git a/test/testing.md b/test/testing.md new file mode 100644 index 0000000..63f4ffe --- /dev/null +++ b/test/testing.md @@ -0,0 +1,61 @@ +# 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` + - 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` +- 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 + + +## Examples: + +### I just want to build this image, how? + +- `./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 + +1. You have created a fork +2. You have commited and pushed your changes to your repository +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