Skip to content

Add healthcheck to the container - #1266

Open
wg1337 wants to merge 2 commits into
openmultiplayer:masterfrom
wg1337:patch-2
Open

Add healthcheck to the container#1266
wg1337 wants to merge 2 commits into
openmultiplayer:masterfrom
wg1337:patch-2

Conversation

@wg1337

@wg1337 wg1337 commented Sep 1, 2026

Copy link
Copy Markdown

In production environments (especially in Kubernetes with readinessProbe and livenessProbe) healthchecks are extremely useful. This PR adds a very simple healthcheck to the container that runs open.mp

The "healthcheck.py" is made to throw an error on every scenario I could think of. The idea is simple: constantly query the server and if the server returns bougus data, then consider the server as failed. Then it is up to the user if they want to restart it or not.

One interesting logic for the script is that I mark the server as failed if the gamemode is "Unknown". I believe this is going to be useful for most users since gamemode is set to "Unknown" when gamemode did not load properly, for example, the server is missing a plugin.

The variables can use environment variables in case some servers need special values, especially hostname's encoding. I ended up setting it to "cp1251" since it worked the best for most servers.

There is going to be a problem with containers that are built using "podman". They will get the following warning when building the container:

WARN[0001] HEALTHCHECK is not supported for OCI image format and will be ignored. Must use `docker` format 

(docker builds (default) are not going to be affected and healthcheck will work properly without additional arguments)

But I intentionally did not change the "podman build" format to "docker" and rather want to rely on the user that they will know that they need to manually specify the healthcheck command as a podman command's argument. Similar situation is going to be to Kubernetes users, they need to specify readinessProbe/livenessProbe themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant