deploy: extend login healthcheck to entergame

This commit is contained in:
server
2026-04-14 10:33:04 +02:00
parent d81b6fda8e
commit 2353e0fc8d
3 changed files with 48 additions and 5 deletions

View File

@@ -3,8 +3,10 @@
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
- verifies `AUTH_SUCCESS`, `EMPIRE`, `LOGIN_SUCCESS4`, character select, and `ENTERGAME`
- creates a temporary character when the temporary account is empty
- deletes the temporary account and temporary character rows on exit
- passes the expected client version string to the smoke client
Default paths and ports are tuned for the current VPS layout. Override with env vars if needed:
- `RUN_AS_USER`

View File

@@ -13,6 +13,7 @@ fi
: "${AUTH_PORT:=11000}"
: "${CHANNEL_PORT:=11011}"
: "${SMOKE_BIN:=/home/${RUN_AS_USER}/metin/build/server-src/bin/metin_login_smoke}"
: "${CLIENT_VERSION:=1215955205}"
if [[ ! -x "${SMOKE_BIN}" ]]; then
echo "Smoke binary not found: ${SMOKE_BIN}" >&2
@@ -28,8 +29,31 @@ LOGIN="smkhc$(date +%s)"
PASSWORD="$(openssl rand -hex 6)"
SOCIAL_ID="$(date +%s%N | tail -c 14)"
EMAIL="${LOGIN}@example.invalid"
CHARACTER_NAME="c${LOGIN}"
ACCOUNT_ID=""
cleanup() {
if [[ -n "${ACCOUNT_ID}" ]]; then
mysql player >/dev/null 2>&1 <<SQL || true
CREATE TEMPORARY TABLE smoke_pids AS
SELECT id FROM player WHERE account_id = ${ACCOUNT_ID};
DELETE FROM item
WHERE owner_id IN (SELECT id FROM smoke_pids);
DELETE FROM affect
WHERE dwPID IN (SELECT id FROM smoke_pids);
DELETE FROM quest
WHERE dwPID IN (SELECT id FROM smoke_pids);
DELETE FROM player
WHERE id IN (SELECT id FROM smoke_pids);
DROP TEMPORARY TABLE smoke_pids;
SQL
fi
mysql player >/dev/null 2>&1 <<SQL || true
DELETE FROM player_index
WHERE id IN (
@@ -109,6 +133,8 @@ SQL
echo "Running login healthcheck for temporary account ${LOGIN}"
sudo -iu "${RUN_AS_USER}" env METIN_LOGIN_SMOKE_PASSWORD="${PASSWORD}" \
"${SMOKE_BIN}" "${SERVER_HOST}" "${AUTH_PORT}" "${CHANNEL_PORT}" "${LOGIN}" \
--password-env=METIN_LOGIN_SMOKE_PASSWORD
--password-env=METIN_LOGIN_SMOKE_PASSWORD \
--create-character-name="${CHARACTER_NAME}" \
--client-version="${CLIENT_VERSION}"
echo "Login healthcheck passed"

View File

@@ -30,6 +30,9 @@ The check performs the real two-step Metin login flow without a GUI client:
7. Send `LOGIN2` with `login` + `login_key`.
8. Verify `EMPIRE`.
9. Verify `LOGIN_SUCCESS4`.
10. Select a character slot.
11. Send `ENTERGAME`.
12. Verify `MAIN_CHARACTER`, `PHASE_GAME`, `TIME`, and `CHANNEL`.
This is an end-to-end login verification, not just a TCP port check.
@@ -38,9 +41,11 @@ This is an end-to-end login verification, not just a TCP port check.
`metin-login-healthcheck.sh` does the following:
- creates a temporary account in MariaDB
- lets `metin_login_smoke` create a temporary character when the account is empty
- runs `metin_login_smoke`
- verifies a successful auth + channel login
- deletes the temporary account on exit
- verifies a successful auth + channel + `ENTERGAME` flow
- deletes the temporary account and temporary character rows on exit
- passes the configured client version expected by the server
It is intended for manual admin use on the VPS.
@@ -69,6 +74,16 @@ sudo -iu mt2.jakubkadlec.dev env METIN_LOGIN_SMOKE_PASSWORD='<password>' \
173.249.9.66 11000 11011 <login> --password-env=METIN_LOGIN_SMOKE_PASSWORD
```
If you want the smoke client to create a temporary character when the account is empty:
```bash
sudo -iu mt2.jakubkadlec.dev env METIN_LOGIN_SMOKE_PASSWORD='<password>' \
/home/mt2.jakubkadlec.dev/metin/build/server-src/bin/metin_login_smoke \
173.249.9.66 11000 11011 <login> --password-env=METIN_LOGIN_SMOKE_PASSWORD \
--create-character-name=smoketestchar \
--client-version=1215955205
```
## Security Notes
This does not open a new public network surface. It is a local operational tool.