Agent update

This commit is contained in:
Frank Harris 2026-06-06 11:41:17 -05:00
parent c195c0930b
commit cc5f7bb90c
16 changed files with 474 additions and 85 deletions

View file

@ -65,6 +65,12 @@ The status implementation should check:
Marker files such as `SERVER_STOPPED` should not be treated as the final source of truth.
If the configured game port is listening but the managed screen/session is missing, the agent reports `ONLINE` with a warning in `last_error`. This mirrors the Windows agent and prevents a live game process from showing false offline/unknown solely because session tracking failed.
## Optional Resource Stats Database
Resource stats database submission uses Perl `DBI`, but `DBI` is optional for normal agent startup. The agent lazy-loads `DBI` only when resource stats are actually submitted. Missing `DBI.pm` should disable database stats submission with a readable log message, not abort the agent at startup.
## Logging
Relevant function:
@ -106,4 +112,3 @@ The agent also maintains screen logs and helper scripts inside its runtime area.
- It can resolve server ownership and screen users via helper functions such as `find_user_by_screen_id`.
- It must remain portable across distro variants, so avoid assuming one exact init system or one exact binary path.
- For Windows-targeted games running under Linux, Wine-related path conversion appears in startup path handling.

View file

@ -43,6 +43,42 @@ The session naming scheme also follows the OGP convention:
OGP_HOME_000000123
```
### Windows Startup Launcher
Relevant files:
- `Agent-Windows/Install/agent_start.bat`
- `Agent-Windows/Install/agent_start_cygwin.sh`
- `/OGP/Cfg/bash_prefs.cfg` on an installed node
The batch launcher must not assume that `bash` is in the Windows `PATH`. It explicitly checks:
- the Cygwin root beside the launcher
- `C:\cygwin64\bin\bash.exe`
- `C:\cygwin\bin\bash.exe`
The Cygwin-side helper performs the shell work:
1. enter `/OGP`
2. normalize CRLF to LF for `.pl`, `.pm`, `.sh`, and `.cfg` files under `/OGP`
3. source `/OGP/Cfg/bash_prefs.cfg`
4. optionally update only `Agent-Windows/ogp_agent.pl` from Forgejo when `agent_auto_update=1`
5. backup the current `/OGP/ogp_agent.pl`
6. validate the updated agent with `perl -c`
7. restore the backup if validation fails
8. launch `/OGP/ogp_agent.pl`
Default optional update source:
- repo: `http://forge.runlevelsystems.com/dev/GSP.git`
- branch: `Panel-unstable`
- source file: `Agent-Windows/ogp_agent.pl`
- target file: `/OGP/ogp_agent.pl`
Auto-update failure is non-fatal. Missing `git`, clone failure, missing source file, or failed validation should warn and continue with the current installed agent.
The Windows agent file does not use `DBI` at startup. If a Windows node reports `Can't locate DBI.pm` at line 48, it is a strong signal that a Linux agent file was copied onto the Windows node.
## Status Logic
Relevant functions:
@ -61,6 +97,8 @@ The status model should check:
The old `SERVER_STOPPED` file should not be the source of truth.
If the game port is listening but the managed screen session is not found, the agent reports `ONLINE` with a warning. This protects customers from false offline/unknown states when a process survives a screen/session mismatch or an older agent cannot report the session correctly.
## Logging
Relevant function:
@ -91,4 +129,3 @@ The Windows scheduler implementation should remain aligned with the Linux schedu
- Batch wrappers are often needed for Windows executables.
- Process cleanup must avoid killing unrelated processes that happen to share an executable name.
- The agent should continue to use `screen` where it already does so, to stay aligned with Linux behavior.