deploy: extend login healthcheck to entergame
This commit is contained in:
@@ -3,8 +3,10 @@
|
|||||||
What it does:
|
What it does:
|
||||||
- creates a temporary account in MariaDB
|
- creates a temporary account in MariaDB
|
||||||
- runs `metin_login_smoke` against auth and channel ports
|
- runs `metin_login_smoke` against auth and channel ports
|
||||||
- verifies `AUTH_SUCCESS`, `EMPIRE`, and `LOGIN_SUCCESS4`
|
- verifies `AUTH_SUCCESS`, `EMPIRE`, `LOGIN_SUCCESS4`, character select, and `ENTERGAME`
|
||||||
- deletes the temporary account on exit
|
- 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:
|
Default paths and ports are tuned for the current VPS layout. Override with env vars if needed:
|
||||||
- `RUN_AS_USER`
|
- `RUN_AS_USER`
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ fi
|
|||||||
: "${AUTH_PORT:=11000}"
|
: "${AUTH_PORT:=11000}"
|
||||||
: "${CHANNEL_PORT:=11011}"
|
: "${CHANNEL_PORT:=11011}"
|
||||||
: "${SMOKE_BIN:=/home/${RUN_AS_USER}/metin/build/server-src/bin/metin_login_smoke}"
|
: "${SMOKE_BIN:=/home/${RUN_AS_USER}/metin/build/server-src/bin/metin_login_smoke}"
|
||||||
|
: "${CLIENT_VERSION:=1215955205}"
|
||||||
|
|
||||||
if [[ ! -x "${SMOKE_BIN}" ]]; then
|
if [[ ! -x "${SMOKE_BIN}" ]]; then
|
||||||
echo "Smoke binary not found: ${SMOKE_BIN}" >&2
|
echo "Smoke binary not found: ${SMOKE_BIN}" >&2
|
||||||
@@ -28,8 +29,31 @@ LOGIN="smkhc$(date +%s)"
|
|||||||
PASSWORD="$(openssl rand -hex 6)"
|
PASSWORD="$(openssl rand -hex 6)"
|
||||||
SOCIAL_ID="$(date +%s%N | tail -c 14)"
|
SOCIAL_ID="$(date +%s%N | tail -c 14)"
|
||||||
EMAIL="${LOGIN}@example.invalid"
|
EMAIL="${LOGIN}@example.invalid"
|
||||||
|
CHARACTER_NAME="c${LOGIN}"
|
||||||
|
ACCOUNT_ID=""
|
||||||
|
|
||||||
cleanup() {
|
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
|
mysql player >/dev/null 2>&1 <<SQL || true
|
||||||
DELETE FROM player_index
|
DELETE FROM player_index
|
||||||
WHERE id IN (
|
WHERE id IN (
|
||||||
@@ -109,6 +133,8 @@ SQL
|
|||||||
echo "Running login healthcheck for temporary account ${LOGIN}"
|
echo "Running login healthcheck for temporary account ${LOGIN}"
|
||||||
sudo -iu "${RUN_AS_USER}" env METIN_LOGIN_SMOKE_PASSWORD="${PASSWORD}" \
|
sudo -iu "${RUN_AS_USER}" env METIN_LOGIN_SMOKE_PASSWORD="${PASSWORD}" \
|
||||||
"${SMOKE_BIN}" "${SERVER_HOST}" "${AUTH_PORT}" "${CHANNEL_PORT}" "${LOGIN}" \
|
"${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"
|
echo "Login healthcheck passed"
|
||||||
|
|||||||
@@ -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`.
|
7. Send `LOGIN2` with `login` + `login_key`.
|
||||||
8. Verify `EMPIRE`.
|
8. Verify `EMPIRE`.
|
||||||
9. Verify `LOGIN_SUCCESS4`.
|
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.
|
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:
|
`metin-login-healthcheck.sh` does the following:
|
||||||
|
|
||||||
- creates a temporary account in MariaDB
|
- creates a temporary account in MariaDB
|
||||||
|
- lets `metin_login_smoke` create a temporary character when the account is empty
|
||||||
- runs `metin_login_smoke`
|
- runs `metin_login_smoke`
|
||||||
- verifies a successful auth + channel login
|
- verifies a successful auth + channel + `ENTERGAME` flow
|
||||||
- deletes the temporary account on exit
|
- 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.
|
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
|
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
|
## Security Notes
|
||||||
|
|
||||||
This does not open a new public network surface. It is a local operational tool.
|
This does not open a new public network surface. It is a local operational tool.
|
||||||
|
|||||||
Reference in New Issue
Block a user