Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Complete rework #43

Draft
wants to merge 120 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
7c02ca8
+ dependent dependency installation
jusito Nov 9, 2021
383e4cb
cleanup
jusito Nov 9, 2021
489af8c
added iproute2 to remoive warnings
jusito Nov 10, 2021
594376e
+ multi stage build for better dev experience
jusito Nov 10, 2021
48e8168
+ pr #35 tmux, gamedig, cleanup
jusito Nov 11, 2021
7a6b6ea
+ cron, cleanup
jusito Nov 12, 2021
9afc13d
fix typo
jusito Nov 13, 2021
d315393
fix graceful stop and improved logging
jusito Nov 13, 2021
b85ff2b
prepared health check testing
jusito Nov 14, 2021
ed31da8
fix health check
jusito Nov 14, 2021
2770d07
fix dockerignore
jusito Nov 14, 2021
491fe38
fix log dir permissions
jusito Nov 14, 2021
ccbd495
fix log not existing very early
jusito Nov 14, 2021
c9e454c
+ shellcheck
jusito Nov 15, 2021
c5e120d
+ auto testing every server
jusito Nov 23, 2021
37efa66
~ fix permissions, untested
jusito Nov 23, 2021
043ea82
~ moved results folder
jusito Nov 23, 2021
5ad9527
fix full.sh wait until done
jusito Nov 23, 2021
37b3440
fix empty arguments + tty issues
jusito Nov 24, 2021
7c22f91
fix full.sh docker logs
jusito Nov 24, 2021
50548e8
initial docker image creation automation
jusito Nov 24, 2021
5a27eb8
fix illegal server in list
jusito Nov 24, 2021
3f1bc30
fix healthcheck, improved logging
jusito Nov 24, 2021
e9fa7a9
fix wsl2 != ubuntu
jusito Nov 24, 2021
0601f6a
+ build arg fail early
jusito Nov 24, 2021
87b0c1b
fix build-arg hidden on some systems
jusito Nov 25, 2021
7ed95ed
+ rerun
jusito Nov 25, 2021
d1bbba6
+ feat interuptable testing
jusito Nov 25, 2021
a61dde3
~ changed healthcheck intervall 90 / 75
jusito Nov 25, 2021
5bdae26
fix healthcheck report to early unhealthy
jusito Nov 25, 2021
2eb1507
+ lgsm-load-config
jusito Nov 25, 2021
946bcbe
+ tests + shellcheck fix
jusito Nov 25, 2021
ac5569f
+ testFixPermissions.sh
jusito Nov 26, 2021
d2f5509
+ cleanup testCron
jusito Nov 26, 2021
43cd4ee
+ testUpdateUidGuid.sh
jusito Nov 26, 2021
3670106
fix cron tests
jusito Nov 26, 2021
4a43b32
+ testCron illegal test
jusito Nov 26, 2021
c1bb9f3
+ testLgsmUpdate
jusito Nov 27, 2021
f1631a1
~ cleanup log entries / shellcheck
jusito Nov 27, 2021
6c0aafa
fix test cleanup
jusito Nov 27, 2021
35d9cec
~ mv functions -> features
jusito Nov 27, 2021
02a7c10
fix rename issues
jusito Nov 27, 2021
096ff17
~ test --quick as default
jusito Nov 27, 2021
e693299
+ testLoadConfig
jusito Nov 29, 2021
5302ab1
+ LGSM_DEBUG
jusito Nov 29, 2021
863d8a1
Merge branch 'master' into develop
jusito Nov 29, 2021
bca276b
~ createImages rm existing images before
jusito Nov 29, 2021
8bcfd77
Merge branch 'develop' of https://github.com/GameServerManagers/Linux…
jusito Nov 29, 2021
14b5d40
Merge branch 'GameServerManagers-develop' into develop
jusito Nov 29, 2021
c604896
~ mv github templates
jusito Nov 29, 2021
533a0fd
+ --slow mode for testing
jusito Nov 29, 2021
ef5a26b
+ cleanup
jusito Nov 29, 2021
5283829
+ init dev env script
jusito Nov 29, 2021
f18b62b
+ createImages suffix / help
jusito Nov 29, 2021
0764a24
+ don't invoke full.sh as root
jusito Nov 29, 2021
2301369
+ full.sh printing failed statistics
jusito Nov 29, 2021
9efe374
fix quick as default will to early fail
jusito Nov 29, 2021
95f8871
fix remove anon volumes after
jusito Nov 29, 2021
55742b3
fix --very-fast
jusito Nov 29, 2021
8954237
+ tests print health log
jusito Nov 29, 2021
326e4a6
+ uniform docker layer -> test -> push
jusito Nov 30, 2021
3fbf426
+ chmod +x for files
jusito Dec 1, 2021
1d45b6c
21.04 -> 20.04
jusito Dec 1, 2021
9f0db5e
Merge branch 'develop' of github.com:jusito/LinuxGSM-Docker into develop
jusito Dec 1, 2021
d61b56b
fix line endings
dgibbs64 Dec 2, 2021
02f9a7a
fix steam credentials in log
jusito Feb 10, 2022
1b9b2f5
fix --debug, credentials usage, config load before install
jusito Feb 10, 2022
6ad1ddb
fix empty suffix for tag creation
jusito Feb 10, 2022
2fb23ea
fix empty suffix in run command
jusito Feb 10, 2022
acba19e
cleanup
jusito Feb 10, 2022
1ea92f6
fix whitelist for steam credential usage
jusito Feb 10, 2022
e2b9bfd
+ Flaky Test
jusito Feb 12, 2022
8fa83ef
fix gamedig, nodejs 12+
jusito Feb 12, 2022
b705a7a
fix executable not found
jusito Feb 13, 2022
13cd17b
~ improved dependency installation
jusito Feb 13, 2022
6296020
~ more automated output for tests
jusito Feb 18, 2022
f483d10
~ improved
jusito Feb 20, 2022
ea1015a
fix restart / update exiting container
jusito Feb 21, 2022
2f9f66b
fix gamedig not found
jusito Feb 21, 2022
ce4af3b
fix full.sh not comparing at the end
jusito Feb 21, 2022
b555061
+ clean volume folder
jusito Feb 22, 2022
73ddbcf
update
jusito Feb 26, 2022
fcc5440
fix exit code, dependency installation
jusito Feb 26, 2022
07603af
feat: ubuntu 22.04
jusito Apr 4, 2022
93d0c4f
doc: build arg error message + rustserver compose
jusito Apr 8, 2022
610a1d4
fix: ubuntu 22.04 only set on one stage
jusito Apr 9, 2022
aeb0192
feat: print console.log if initial start fails
jusito Apr 9, 2022
046dbdc
fix: openssl 1.1n missing
jusito Apr 9, 2022
c3660d7
fix: openssl x86 instead of x64 for svenserver
jusito Apr 10, 2022
0d063f4
doc: docker-compose update
jusito Apr 10, 2022
5680475
renaming
jusito Apr 30, 2022
0dce0f0
fix logging
jusito Jun 3, 2022
12aef0a
fix(dependencies): supercronic v0.2.1
jusito Jul 16, 2022
1d0b360
refactor(structure): clear naming
jusito Jul 16, 2022
376e768
doc: preparing docs
jusito Jul 16, 2022
fec88b5
test: debug-utils
jusito Jul 16, 2022
01a0b5d
doc: relocated entrypoint
jusito Jul 16, 2022
4fab05b
doc: renamed scripts
jusito Jul 16, 2022
b270920
doc: general addition
jusito Jul 16, 2022
b655492
test: fix renaming
jusito Jul 16, 2022
20aa66d
fix: nodejs updated
jusito Jul 16, 2022
855b535
doc: compose examples autogenerated
jusito Jul 17, 2022
7bf7379
test: support for setting LGSM_{BRANCH,USER,REPO}
jusito Jul 31, 2022
8e3fff2
doc: how testing works git --git-* args
jusito Jul 31, 2022
b802ef0
fix: openssl1.1 x86 / x64
jusito Jul 31, 2022
77c5872
build: renaming openssl script
jusito Jul 31, 2022
51e7599
fix: openssl 1.1.1n -> 1.1.1q
jusito Jul 31, 2022
64dfcc2
fix: example generation consider credentials
jusito Aug 8, 2022
5627e63
doc: main readme not linking to others
jusito Aug 10, 2022
796c6e8
doc: added docker usage examples
jusito Aug 10, 2022
89d2eec
examples: volumes should contain service name
jusito Aug 11, 2022
7991dee
doc: overview section
jusito Aug 11, 2022
b49970c
clean: fix shellcheck
jusito Aug 12, 2022
75a2d63
test: feature tests added todos
jusito Aug 12, 2022
39859e7
deploy: push.sh wdir not moved
jusito Aug 14, 2022
87ca6ee
test: single.sh changed wdir
jusito Aug 14, 2022
95a6521
test: test scripts shouldn't rely on wdir
jusito Aug 14, 2022
e9af3c3
feat: safer lgsm alias generation + help
jusito Aug 14, 2022
4637629
fix: pinned conan<2.0
jusito Mar 31, 2023
9dcb678
deps: gosu 1.16, ossl 1.1.1t, scron 0.2.2
jusito Mar 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .dockerignore
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

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*~
tests/results
**/*.log
tests/steam_test_credentials
181 changes: 79 additions & 102 deletions Dockerfile
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 link
Member

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


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"]
20 changes: 20 additions & 0 deletions commands/lgsm-cron-init
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"
9 changes: 9 additions & 0 deletions commands/lgsm-cron-start
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"
17 changes: 17 additions & 0 deletions commands/lgsm-fix-permission
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"
20 changes: 20 additions & 0 deletions commands/lgsm-init
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"
Loading