The HEALTHCHECK LinuxGSM "monitor" command restarts game server in a loop when server shuts down cleanly...
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
Research direction
Read entrypoint-healthcheck.sh and the Dockerfile HEALTHCHECK reference first. Make the health monitor skip its check when /tmp/disable-monitor exists without exiting 0 or 1, while retaining normal monitoring otherwise; done means a cleanly stopped game server is not restarted until the container is restarted.
Written by the indexing model from the issue text.
Description
- Many games have mods that let an admin trigger a shutdown such as "15 minutes until shutdown. Please log out...".
- After 15 minutes, the game itself shuts off the server.
- But because LinuxGSM's docker images have a HEALTHCHECK line that runs the
monitorcommand endlessly every minute, it will detect that the server has shut down and will start itself again. - Therefore LinuxGSM prevents the game from shutting itself down and interrupts a common scenario (servers that shut themselves down with a timer/warning).
This is only fixable by improving the containers to have a /tmp killswitch for the health monitor externally. Like this:
Dockerfileexample:
HEALTHCHECK CMD [ "/bin/sh", "-c", "[ -f /tmp/disable-monitor ] || curl -f http://localhost/health" ]
- How to kill such a healthcheck monitor externally:
podman exec sdtdserver touch /tmp/disable-monitor
And because it's in /tmp it will vanish when the container starts up the next time.
In LinuxGSM's case, that type of logic would have to be added to this file instead:
https://github.com/GameServerManagers/docker-linuxgsm/blob/main/entrypoint-healthcheck.sh
Basically adapt that file to not do a "monitor" check if /tmp/disable-monitor exists.
Do NOT exit 0 (or exit 1) if that file exists. Simply skip the health check. Because otherwise, the "disabled" healthcheck itself would trigger an instant container shutdown every minute, which is not correct.
Instead, simply skip it, perhaps echoing a log message saying that health monitor is disabled and being skipped.
After that, the server will simply sit in a shutdown state and the health check will do nothing. The server admin then "simply" has to stop the container itself after that state has been reached.
If LinuxGSM supports a feature like this, I would then be able to just add that command to the same script that sends the "15 minute shutdown" command to the server itself. Then the game would take care of shutting down, and the monitor would not restart the game anymore. After the server itself has shut itself down, I would just have to manually stop the container as usual.
Next time I start the container again, the health check would be running as usual again (since /tmp is a tmpfs and isn't preserved).
This is the solution.
- Dominant language
- Shell
- Stars
- 347
- Forks
- 26
- Avg merge
- 8h 2m
- Merged PRs (30d)
- 2
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GameServerManagers/docker-gameserver
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
GameServerManagers/docker-gameserver#144 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
GameServerManagers/docker-gameserver#142 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
GameServerManagers/docker-gameserver#113 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
GameServerManagers/docker-gameserver#100 · 2 comments ·
All issues in GameServerManagers/docker-gameserver
Similar issues
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
varnish/helm-varnish#173 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
command: update-lgsm distro: Debian engine: source2 game: Counter-Strike 2 regression: yes reproducible: always severity: low type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
GameServerManagers/LinuxGSM#5242 ·
Maintainers usually reply within 1 day
-
📦 Update Request
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
cdnjs/packages#2225 · 1 comment ·
Maintainers usually reply within 3 days