Skip to content

Commit

Permalink
fix healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
dgibbs64 committed Jan 13, 2023
1 parent a7a6a57 commit 21bc02f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.ubuntu-1804
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ RUN echo "**** Add linuxgsm user ****" \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& chown $USERNAME:$USERNAME /home/$USERNAME

HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/*server monitor || exit 1
HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/entrypoint-healthcheck.sh || exit 1

## Download linuxgsm.sh
RUN echo "**** Download linuxgsm.sh ****" \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.ubuntu-2004
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ RUN echo "**** Add linuxgsm user ****" \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& chown $USERNAME:$USERNAME /home/$USERNAME

HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/*server monitor || exit 1
HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/entrypoint-healthcheck.sh || exit 1

## Download linuxgsm.sh
RUN echo "**** Download linuxgsm.sh ****" \
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.ubuntu-2204
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ RUN echo "**** Add linuxgsm user ****" \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& chown $USERNAME:$USERNAME /home/$USERNAME

HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/*server monitor || exit 1
HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/entrypoint-healthcheck.sh || exit 1

## Download linuxgsm.sh
RUN echo "**** Download linuxgsm.sh ****" \
Expand All @@ -127,6 +127,7 @@ RUN echo "**** Get LinuxGSM Modules ****" \

COPY entrypoint.sh /linuxgsm/entrypoint.sh
COPY entrypoint-user.sh /linuxgsm/entrypoint-user.sh
COPY entrypoint-healthcheck.sh /linuxgsm/entrypoint-healthcheck.sh

RUN date > /build-time.txt

Expand Down
3 changes: 3 additions & 0 deletions entrypoint-healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
echo HEALTHCHECK
exec s6-setuidgid ${USERNAME} /linuxgsm/*server monitor
14 changes: 7 additions & 7 deletions entrypoint-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ ! -f "${GAMESERVER}" ]; then
echo -e ""
echo -e "creating ${GAMESERVER}"
echo -e "================================="
exec s6-setuidgid ${USERNAME} ./linuxgsm.sh ${GAMESERVER}
./linuxgsm.sh ${GAMESERVER}
fi

# Clear functions directory if not master
Expand All @@ -22,32 +22,32 @@ if [ -z "$(ls -A -- "serverfiles" >/dev/null 2>&1)" ]; then
echo -e ""
echo -e "Installing ${GAMESERVER}"
echo -e "================================="
exec s6-setuidgid ${USERNAME} ./${GAMESERVER} auto-install
./${GAMESERVER} auto-install
install=1
else
# Donate to display logo
exec s6-setuidgid ${USERNAME} ./${GAMESERVER} donate
exec ./${GAMESERVER} donate
fi
echo -e ""
echo -e "Starting Update Checks"
echo -e "================================="
nohup watch -n "${UPDATE_CHECK}" exec s6-setuidgid ${USERNAME} ./${GAMESERVER} update >/dev/null 2>&1 &
nohup watch -n "${UPDATE_CHECK}" exec ./${GAMESERVER} update >/dev/null 2>&1 &
echo -e "update will check every ${UPDATE_CHECK} minutes"

# Update game server
if [ -z "${install}" ]; then
echo -e ""
echo -e "Checking for Update ${GAMESERVER}"
echo -e "================================="
exec s6-setuidgid ${USERNAME} ./${GAMESERVER} update
./${GAMESERVER} update
fi

echo -e ""
echo -e "Starting ${GAMESERVER}"
echo -e "================================="
exec s6-setuidgid ${USERNAME} ./${GAMESERVER} start
./${GAMESERVER} start
sleep 5
exec s6-setuidgid ${USERNAME} ./${GAMESERVER} details
./${GAMESERVER} details
sleep 2
echo -e "Tail log files"
echo -e "================================="
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exit_handler() {
# Execute the shutdown commands
echo -e "stopping ${GAMESERVER}"
./${GAMESERVER} stop
exec s6-setuidgid ${USERNAME} ./${GAMESERVER} stop
exitcode=$?
exit ${exitcode}
}
Expand Down

0 comments on commit 21bc02f

Please sign in to comment.