This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
Complete rework #43
Draft
jusito
wants to merge
120
commits into
GameServerManagers:develop
Choose a base branch
from
jusito:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Complete rework #43
Changes from 62 commits
Commits
Show all changes
120 commits
Select commit
Hold shift + click to select a range
7c02ca8
+ dependent dependency installation
jusito 383e4cb
cleanup
jusito 489af8c
added iproute2 to remoive warnings
jusito 594376e
+ multi stage build for better dev experience
jusito 48e8168
+ pr #35 tmux, gamedig, cleanup
jusito 7a6b6ea
+ cron, cleanup
jusito 9afc13d
fix typo
jusito d315393
fix graceful stop and improved logging
jusito b85ff2b
prepared health check testing
jusito ed31da8
fix health check
jusito 2770d07
fix dockerignore
jusito 491fe38
fix log dir permissions
jusito ccbd495
fix log not existing very early
jusito c9e454c
+ shellcheck
jusito c5e120d
+ auto testing every server
jusito 37efa66
~ fix permissions, untested
jusito 043ea82
~ moved results folder
jusito 5ad9527
fix full.sh wait until done
jusito 37b3440
fix empty arguments + tty issues
jusito 7c22f91
fix full.sh docker logs
jusito 50548e8
initial docker image creation automation
jusito 5a27eb8
fix illegal server in list
jusito 3f1bc30
fix healthcheck, improved logging
jusito e9fa7a9
fix wsl2 != ubuntu
jusito 0601f6a
+ build arg fail early
jusito 87b0c1b
fix build-arg hidden on some systems
jusito 7ed95ed
+ rerun
jusito d1bbba6
+ feat interuptable testing
jusito a61dde3
~ changed healthcheck intervall 90 / 75
jusito 5bdae26
fix healthcheck report to early unhealthy
jusito 2eb1507
+ lgsm-load-config
jusito 946bcbe
+ tests + shellcheck fix
jusito ac5569f
+ testFixPermissions.sh
jusito d2f5509
+ cleanup testCron
jusito 43cd4ee
+ testUpdateUidGuid.sh
jusito 3670106
fix cron tests
jusito 4a43b32
+ testCron illegal test
jusito c1bb9f3
+ testLgsmUpdate
jusito f1631a1
~ cleanup log entries / shellcheck
jusito 6c0aafa
fix test cleanup
jusito 35d9cec
~ mv functions -> features
jusito 02a7c10
fix rename issues
jusito 096ff17
~ test --quick as default
jusito e693299
+ testLoadConfig
jusito 5302ab1
+ LGSM_DEBUG
jusito 863d8a1
Merge branch 'master' into develop
jusito bca276b
~ createImages rm existing images before
jusito 8bcfd77
Merge branch 'develop' of https://github.com/GameServerManagers/Linux…
jusito 14b5d40
Merge branch 'GameServerManagers-develop' into develop
jusito c604896
~ mv github templates
jusito 533a0fd
+ --slow mode for testing
jusito ef5a26b
+ cleanup
jusito 5283829
+ init dev env script
jusito f18b62b
+ createImages suffix / help
jusito 0764a24
+ don't invoke full.sh as root
jusito 2301369
+ full.sh printing failed statistics
jusito 9efe374
fix quick as default will to early fail
jusito 95f8871
fix remove anon volumes after
jusito 55742b3
fix --very-fast
jusito 8954237
+ tests print health log
jusito 326e4a6
+ uniform docker layer -> test -> push
jusito 3fbf426
+ chmod +x for files
jusito 1d45b6c
21.04 -> 20.04
jusito 9f0db5e
Merge branch 'develop' of github.com:jusito/LinuxGSM-Docker into develop
jusito d61b56b
fix line endings
dgibbs64 02f9a7a
fix steam credentials in log
jusito 1b9b2f5
fix --debug, credentials usage, config load before install
jusito 6ad1ddb
fix empty suffix for tag creation
jusito 2fb23ea
fix empty suffix in run command
jusito acba19e
cleanup
jusito 1ea92f6
fix whitelist for steam credential usage
jusito e2b9bfd
+ Flaky Test
jusito 8fa83ef
fix gamedig, nodejs 12+
jusito b705a7a
fix executable not found
jusito 13cd17b
~ improved dependency installation
jusito 6296020
~ more automated output for tests
jusito f483d10
~ improved
jusito ea1015a
fix restart / update exiting container
jusito 2f9f66b
fix gamedig not found
jusito ce4af3b
fix full.sh not comparing at the end
jusito b555061
+ clean volume folder
jusito 73ddbcf
update
jusito fcc5440
fix exit code, dependency installation
jusito 07603af
feat: ubuntu 22.04
jusito 93d0c4f
doc: build arg error message + rustserver compose
jusito 610a1d4
fix: ubuntu 22.04 only set on one stage
jusito aeb0192
feat: print console.log if initial start fails
jusito 046dbdc
fix: openssl 1.1n missing
jusito c3660d7
fix: openssl x86 instead of x64 for svenserver
jusito 0d063f4
doc: docker-compose update
jusito 5680475
renaming
jusito 0dce0f0
fix logging
jusito 12aef0a
fix(dependencies): supercronic v0.2.1
jusito 1d0b360
refactor(structure): clear naming
jusito 376e768
doc: preparing docs
jusito fec88b5
test: debug-utils
jusito 01a0b5d
doc: relocated entrypoint
jusito 4fab05b
doc: renamed scripts
jusito b270920
doc: general addition
jusito b655492
test: fix renaming
jusito 20aa66d
fix: nodejs updated
jusito 855b535
doc: compose examples autogenerated
jusito 7bf7379
test: support for setting LGSM_{BRANCH,USER,REPO}
jusito 8e3fff2
doc: how testing works git --git-* args
jusito b802ef0
fix: openssl1.1 x86 / x64
jusito 77c5872
build: renaming openssl script
jusito 51e7599
fix: openssl 1.1.1n -> 1.1.1q
jusito 64dfcc2
fix: example generation consider credentials
jusito 5627e63
doc: main readme not linking to others
jusito 796c6e8
doc: added docker usage examples
jusito 89d2eec
examples: volumes should contain service name
jusito 7991dee
doc: overview section
jusito b49970c
clean: fix shellcheck
jusito 75a2d63
test: feature tests added todos
jusito 39859e7
deploy: push.sh wdir not moved
jusito 87ca6ee
test: single.sh changed wdir
jusito 95a6521
test: test scripts shouldn't rely on wdir
jusito e9af3c3
feat: safer lgsm alias generation + help
jusito 4637629
fix: pinned conan<2.0
jusito 9dcb678
deps: gosu 1.16, ossl 1.1.1t, scron 0.2.2
jusito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
live/ | ||
tests/ | ||
.gitignore | ||
docker-compose.yml | ||
LICENSE | ||
linuxgsm-docker.sh | ||
README.md | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
*~ | ||
tests/results | ||
**/*.log | ||
tests/steam_test_credentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,79 @@ | ||
# | ||
# LinuxGSM Base Dockerfile | ||
# | ||
# https://github.com/GameServerManagers/LinuxGSM-Docker | ||
# | ||
|
||
FROM ubuntu:20.04 | ||
|
||
LABEL maintainer="LinuxGSM <[email protected]>" | ||
|
||
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 | ||
# download / build / verify dependencies | ||
# own stage = additional deps needed which are only here used | ||
FROM ubuntu:21.04 as dependencyStage | ||
|
||
COPY setup/installGosu.sh \ | ||
setup/installSupercronic.sh \ | ||
/ | ||
RUN set -eux; \ | ||
./installGosu.sh 1.14; \ | ||
./installSupercronic.sh v0.1.12 8d3a575654a6c93524c410ae06f681a3507ca5913627fa92c7086fd140fa12ce | ||
|
||
# create linuxgsm image | ||
# this stage should be usable by existing developers | ||
FROM ubuntu:21.04 as linuxgsm | ||
|
||
ARG ARG_LGSM_VERSION="master" | ||
ENV LGSM_VERSION="${ARG_LGSM_VERSION:?}" \ | ||
LGSM_GAMESERVER="" \ | ||
LGSM_CONFIG_PATTERN_GAME="" \ | ||
USER_ID="750" \ | ||
GROUP_ID="750" \ | ||
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" | ||
|
||
COPY --from=dependencyStage \ | ||
/usr/local/bin/gosu \ | ||
/usr/local/bin/supercronic \ | ||
/usr/local/bin/ | ||
COPY setup/installMinimalDependencies.sh \ | ||
setup/setupUser.sh \ | ||
setup/installLGSM.sh \ | ||
setup/installGamedig.sh \ | ||
setup/cleanImage.sh \ | ||
setup/installDependencies.sh \ | ||
setup/createAlias.sh \ | ||
setup/entrypoint.sh \ | ||
\ | ||
commands/lgsm-cron-init \ | ||
commands/lgsm-cron-start \ | ||
commands/lgsm-init \ | ||
commands/lgsm-fix-permission \ | ||
commands/lgsm-load-config \ | ||
commands/lgsm-tmux-attach \ | ||
commands/lgsm-update-uid-gid \ | ||
"$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:?}" | ||
RUN set -eux; \ | ||
installDependencies.sh "$LGSM_GAMESERVER"; \ | ||
createAlias.sh "$LGSM_GAMESERVER"; \ | ||
cleanImage.sh | ||
|
||
HEALTHCHECK --start-period=3600s --interval=60s --timeout=900s --retries=3 \ | ||
CMD [ -f "$LGSM_STARTED" ] && lgsm-monitor || exit 1 | ||
|
||
ENTRYPOINT ["./../linuxgsm-scripts/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would recommend using 20.04 as it is an LTS release. 22.04 will be the next LTS release