This commit is contained in:
Frank Harris 2026-07-02 18:11:32 -05:00
parent a49371c3dd
commit 251af10faf
1190 changed files with 12636 additions and 12476 deletions

View file

@ -4,7 +4,7 @@ Workspace reference: [`GSP-WORKSPACE.md`](../../../GSP-WORKSPACE.md)
## Role
`Agent_Linux/ogp_agent.pl` is the Linux execution agent for GSP. It is responsible for:
`Agent_Linux/gsp_agent.pl` is the Linux execution agent for GSP. It is responsible for:
- starting and stopping game servers
- managing `screen` sessions
@ -15,7 +15,7 @@ Workspace reference: [`GSP-WORKSPACE.md`](../../../GSP-WORKSPACE.md)
## Important Files
- `Agent_Linux/ogp_agent.pl`
- `Agent_Linux/gsp_agent.pl`
- `Agent_Linux/startups/`
- `Agent_Linux/includes/`
- `Agent_Linux/php-query/`
@ -28,12 +28,12 @@ Workspace reference: [`GSP-WORKSPACE.md`](../../../GSP-WORKSPACE.md)
The Linux agent creates a managed `screen` session per server.
Key flow in `ogp_agent.pl`:
Key flow in `gsp_agent.pl`:
- `universal_start_without_decrypt`
- `create_screen_cmd`
- `create_screen_cmd_loop`
- `replace_OGP_Env_Vars`
- `replace_GSP_Env_Vars`
The agent builds the startup command from:
@ -43,10 +43,10 @@ The agent builds the startup command from:
- control password
- path variables
The session name follows the OGP naming convention, for example:
The session name follows the GSP naming convention, for example:
```text
OGP_HOME_000000123
GSP_HOME_000000123
```
## Status Logic
@ -100,7 +100,7 @@ For legacy `steam_workshop` RPC installs:
## Scheduler
Linux scheduler functions live in `ogp_agent.pl`:
Linux scheduler functions live in `gsp_agent.pl`:
- `scheduler_dispatcher`
- `scheduler_server_action`
@ -138,8 +138,8 @@ Flow:
5. The script clones the configured branch into staging.
6. It copies only the configured Linux agent source folder, usually `Agent_Linux`.
7. It preserves `Cfg/`, `ServerFiles/`, `Schedule/`, logs, screen logs, `steamcmd/`, `startups/`, temporary folders, backups, and PID files.
8. It validates the updated `ogp_agent.pl` with `perl -c`.
9. It restarts `ogp_agent.service` through `systemd` if available, otherwise uses the existing `screen` startup fallback.
8. It validates the updated `gsp_agent.pl` with `perl -c`.
9. It restarts `gsp_agent.service` through `systemd` if available, otherwise uses the existing `screen` startup fallback.
The agent returns `queued` immediately with the log path `gsp_component_update.log`. A queued response means the updater launched; check the log for final success/failure.

View file

@ -4,17 +4,17 @@ Workspace reference: [`GSP-WORKSPACE.md`](../../../GSP-WORKSPACE.md)
## Role
`Agent-Windows/OGP64/OGP/ogp_agent.pl` is the Windows/Cygwin execution agent currently tracked in this repository. It mirrors the Linux agent as closely as practical, while using Windows-compatible paths, processes, and wrappers.
`Agent-Windows/GSP64/GSP/gsp_agent.pl` is the Windows/Cygwin execution agent currently tracked in this repository. It mirrors the Linux agent as closely as practical, while using Windows-compatible paths, processes, and wrappers.
## Important Files
- `Agent-Windows/OGP64/OGP/ogp_agent.pl`
- `Agent-Windows/OGP64/OGP/Cfg/Config.pm`
- `Agent-Windows/OGP64/OGP/Cfg/Preferences.pm`
- `Agent-Windows/OGP64/OGP/Cfg/bash_prefs.cfg`
- `Agent-Windows/OGP64/OGP/Cfg/*.default`
- `Agent-Windows/OGP64/agent_start.bat`
- `Agent-Windows/OGP64/agent_stop.bat`
- `Agent-Windows/GSP64/GSP/gsp_agent.pl`
- `Agent-Windows/GSP64/GSP/Cfg/Config.pm`
- `Agent-Windows/GSP64/GSP/Cfg/Preferences.pm`
- `Agent-Windows/GSP64/GSP/Cfg/bash_prefs.cfg`
- `Agent-Windows/GSP64/GSP/Cfg/*.default`
- `Agent-Windows/GSP64/agent_start.bat`
- `Agent-Windows/GSP64/agent_stop.bat`
- `Agent-Windows/php-query/`
- `Agent-Windows/ArmaBE/`
- `Agent-Windows/Cfg/`
@ -40,32 +40,32 @@ Relevant functions:
- `universal_start_without_decrypt`
- `create_screen_cmd`
- `create_screen_cmd_loop`
- `replace_OGP_Env_Vars`
- `replace_GSP_Env_Vars`
The Windows agent also uses `screen` sessions for managed server execution. Depending on the game and binary type, it may wrap commands in `cmd /Q /C start` or run a batch file wrapper.
The session naming scheme also follows the OGP convention:
The session naming scheme also follows the GSP convention:
```text
OGP_HOME_000000123
GSP_HOME_000000123
```
### Windows Startup Launcher
Relevant files:
- `Agent-Windows/OGP64/agent_start.bat`
- `Agent-Windows/OGP64/agent_stop.bat`
- `/OGP/Cfg/bash_prefs.cfg` on an installed node
- `Agent-Windows/GSP64/agent_start.bat`
- `Agent-Windows/GSP64/agent_stop.bat`
- `/GSP/Cfg/bash_prefs.cfg` on an installed node
The batch launcher must not assume that `bash` is in the Windows `PATH`. It explicitly checks:
- `%~dp0bin\bash.exe`
- `C:\OGP64\bin\bash.exe`
- `C:\GSP64\bin\bash.exe`
- `C:\cygwin64\bin\bash.exe`
- `C:\cygwin\bin\bash.exe`
The supported manual launcher is `C:\OGP64\agent_start.bat`. The Cygwin root is the folder containing that BAT file, so the path checks stay simple and deterministic.
The supported manual launcher is `C:\GSP64\agent_start.bat`. The Cygwin root is the folder containing that BAT file, so the path checks stay simple and deterministic.
Manual launches pause on fatal errors so the error remains visible.
@ -73,26 +73,26 @@ The launcher prints the detected Cygwin root and agent user before validation, t
The BAT launcher performs the shell work directly:
1. enter `/OGP`
2. normalize CRLF to LF for `.pl`, `.pm`, `.sh`, and `.cfg` files under `/OGP`
1. enter `/GSP`
2. normalize CRLF to LF for `.pl`, `.pm`, `.sh`, and `.cfg` files under `/GSP`
3. create missing `Cfg/Config.pm`, `Cfg/Preferences.pm`, and `Cfg/bash_prefs.cfg` from tracked `.default` files
4. strip CRLF and leading whitespace before assignments in `/OGP/Cfg/bash_prefs.cfg`
5. source `/OGP/Cfg/bash_prefs.cfg`
4. strip CRLF and leading whitespace before assignments in `/GSP/Cfg/bash_prefs.cfg`
5. source `/GSP/Cfg/bash_prefs.cfg`
6. verify the Windows account `gameserver` exists
7. run `perl -c ./ogp_agent.pl` before launch
8. launch `/OGP/ogp_agent.pl`
7. run `perl -c ./gsp_agent.pl` before launch
8. launch `/GSP/gsp_agent.pl`
Default optional update source:
- repo: `http://forge.runlevelsystems.com/dev/GSP.git`
- branch: `Panel-unstable`
- source file: `Agent-Windows/OGP64/OGP/ogp_agent.pl` in the current repo layout
- raw URL: `http://forge.runlevelsystems.com/dev/GSP/raw/branch/Panel-unstable/Agent-Windows/OGP64/OGP/ogp_agent.pl`
- target file: `/OGP/ogp_agent.pl`
- source file: `Agent-Windows/GSP64/GSP/gsp_agent.pl` in the current repo layout
- raw URL: `http://forge.runlevelsystems.com/dev/GSP/raw/branch/Panel-unstable/Agent-Windows/GSP64/GSP/gsp_agent.pl`
- target file: `/GSP/gsp_agent.pl`
Auto-update failure is non-fatal. Missing `curl`/`git`, download failure, clone failure, missing source file, HTTP error-page downloads, empty files, or failed validation should warn and continue with the current installed agent.
Restart-time auto-update is allowlisted. It may replace only `/OGP/ogp_agent.pl`. It must never overwrite `Cfg/Config.pm`, `Cfg/Preferences.pm`, `Cfg/bash_prefs.cfg`, service settings, passwords, generated installer config, server homes, logs, or user-created files. Broader agent updates belong to the admin-only Panel `component_update` flow, which also preserves `Cfg/`.
Restart-time auto-update is allowlisted. It may replace only `/GSP/gsp_agent.pl`. It must never overwrite `Cfg/Config.pm`, `Cfg/Preferences.pm`, `Cfg/bash_prefs.cfg`, service settings, passwords, generated installer config, server homes, logs, or user-created files. Broader agent updates belong to the admin-only Panel `component_update` flow, which also preserves `Cfg/`.
### Startup Log And Troubleshooting
@ -100,7 +100,7 @@ The launcher does not create a separate startup wrapper window. If startup fails
Manual troubleshooting flow:
1. Launch `C:\OGP64\agent_start.bat` directly from the Windows console or Explorer.
1. Launch `C:\GSP64\agent_start.bat` directly from the Windows console or Explorer.
2. Read the path summary printed at the top of the window.
3. Inspect the same window for the real Perl/config error.
4. Check the current Cygwin output if you need more context.
@ -109,7 +109,7 @@ Manual troubleshooting flow:
Restart-time auto-update must not touch production config files. Only the following file is allowed to be replaced automatically:
- `/OGP/ogp_agent.pl`
- `/GSP/gsp_agent.pl`
It must never overwrite:
@ -153,6 +153,19 @@ 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.
## Server Content Runtime
The Windows agent mirrors the Linux server-owned content runtime:
- `_gsp_content/hooks/`
- `_gsp_content/generated/`
- `_gsp_content/runtime/`
- `_gsp_content/runtime/server_content.pids`
Stop and restart clean this PID registry before main server escalation. Watchdog PIDs are stopped before app PIDs. Main game server PIDs remain in `runtime_status/pid-<home_id>.kv` and must not be written to `server_content.pids`.
Legacy `_alsoRun.bat` is compatibility-only. When `_alsoRun.pid` exists, the Windows agent imports those PIDs into the server-content cleanup path so helper processes do not survive Panel Stop or Restart.
## Logging
Relevant function:
@ -201,12 +214,12 @@ The Windows agent exposes the same admin-only `component_update` XML-RPC method
Flow:
1. Panel sends an encrypted payload containing repo URL, branch, Windows agent source folder, optional Git path, optional backup path, and optional admin post-update command.
2. Agent validates the request and writes `gsp_component_update_<timestamp>.sh` under the current agent run directory, usually `/OGP`.
2. Agent validates the request and writes `gsp_component_update_<timestamp>.sh` under the current agent run directory, usually `/GSP`.
3. The updater runs detached in `screen`.
4. The updater clones the configured branch into staging.
5. It copies only the configured Windows agent source folder, usually `Agent-Windows`.
6. It preserves `Cfg/`, `ServerFiles/`, `Schedule/`, logs, screen logs, `steamcmd/`, `startups/`, temporary folders, backups, and PID files.
7. It validates `ogp_agent.pl` with `perl -c`.
7. It validates `gsp_agent.pl` with `perl -c`.
8. It restarts the agent using the existing Cygwin/screen fallback.
The immediate response is `queued` with the agent-side log path `gsp_component_update.log`.