From 389bd02af7b4df75993403d9509b5666afad0228 Mon Sep 17 00:00:00 2001 From: server Date: Tue, 14 Apr 2026 08:49:32 +0200 Subject: [PATCH] deploy: add login healthcheck wrapper --- deploy/healthcheck/README.md | 14 +++ deploy/healthcheck/metin-login-healthcheck.sh | 114 ++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 deploy/healthcheck/README.md create mode 100755 deploy/healthcheck/metin-login-healthcheck.sh diff --git a/deploy/healthcheck/README.md b/deploy/healthcheck/README.md new file mode 100644 index 0000000..e84393c --- /dev/null +++ b/deploy/healthcheck/README.md @@ -0,0 +1,14 @@ +`metin-login-healthcheck.sh` is a root-only operational check for the Debian VPS. + +What it does: +- creates a temporary account in MariaDB +- runs `metin_login_smoke` against auth and channel ports +- verifies `AUTH_SUCCESS`, `EMPIRE`, and `LOGIN_SUCCESS4` +- deletes the temporary account on exit + +Default paths and ports are tuned for the current VPS layout. Override with env vars if needed: +- `RUN_AS_USER` +- `SERVER_HOST` +- `AUTH_PORT` +- `CHANNEL_PORT` +- `SMOKE_BIN` diff --git a/deploy/healthcheck/metin-login-healthcheck.sh b/deploy/healthcheck/metin-login-healthcheck.sh new file mode 100755 index 0000000..10051eb --- /dev/null +++ b/deploy/healthcheck/metin-login-healthcheck.sh @@ -0,0 +1,114 @@ +#!/usr/bin/env bash +set -euo pipefail + +umask 077 + +if [[ "${EUID}" -ne 0 ]]; then + echo "Run as root." >&2 + exit 1 +fi + +: "${RUN_AS_USER:=mt2.jakubkadlec.dev}" +: "${SERVER_HOST:=173.249.9.66}" +: "${AUTH_PORT:=11000}" +: "${CHANNEL_PORT:=11011}" +: "${SMOKE_BIN:=/home/${RUN_AS_USER}/metin/build/server-src/bin/metin_login_smoke}" + +if [[ ! -x "${SMOKE_BIN}" ]]; then + echo "Smoke binary not found: ${SMOKE_BIN}" >&2 + exit 1 +fi + +if ! id "${RUN_AS_USER}" >/dev/null 2>&1; then + echo "Missing runtime user: ${RUN_AS_USER}" >&2 + exit 1 +fi + +LOGIN="smkhc$(date +%s)" +PASSWORD="$(openssl rand -hex 6)" +SOCIAL_ID="$(date +%s%N | tail -c 14)" +EMAIL="${LOGIN}@example.invalid" + +cleanup() { + mysql player >/dev/null 2>&1 </dev/null 2>&1 </dev/null <