diff --git a/Agent-Windows/OGP64/OGP/Cfg/Config.pm b/Agent-Windows/OGP64/OGP/Cfg/Config.pm new file mode 100644 index 00000000..214c6603 --- /dev/null +++ b/Agent-Windows/OGP64/OGP/Cfg/Config.pm @@ -0,0 +1,13 @@ +%Cfg::Config = ( + logfile => '/OGP/ogp_agent.log', + listen_port => '12679', + listen_ip => '0.0.0.0', + version => 'v1.4', + key => 'CHANGE_ME_PANEL_AGENT_KEY', + steam_license => 'Accept', + sudo_password => '', + web_admin_api_key => '', + web_api_url => '', + steam_dl_limit => '0', +); + diff --git a/Agent-Windows/OGP64/OGP/Cfg/Config.pm.default b/Agent-Windows/OGP64/OGP/Cfg/Config.pm.default new file mode 100644 index 00000000..214c6603 --- /dev/null +++ b/Agent-Windows/OGP64/OGP/Cfg/Config.pm.default @@ -0,0 +1,13 @@ +%Cfg::Config = ( + logfile => '/OGP/ogp_agent.log', + listen_port => '12679', + listen_ip => '0.0.0.0', + version => 'v1.4', + key => 'CHANGE_ME_PANEL_AGENT_KEY', + steam_license => 'Accept', + sudo_password => '', + web_admin_api_key => '', + web_api_url => '', + steam_dl_limit => '0', +); + diff --git a/Agent-Windows/OGP64/OGP/Cfg/Preferences.pm b/Agent-Windows/OGP64/OGP/Cfg/Preferences.pm new file mode 100644 index 00000000..63b8c169 --- /dev/null +++ b/Agent-Windows/OGP64/OGP/Cfg/Preferences.pm @@ -0,0 +1,9 @@ +%Cfg::Preferences = ( + screen_log_local => '1', + delete_logs_after => '30', + ogp_manages_ftp => '1', + ftp_method => 'PureFTPd', + ogp_autorestart_server => '1', + protocol_shutdown_waittime => '10', +); + diff --git a/Agent-Windows/OGP64/OGP/Cfg/Preferences.pm.default b/Agent-Windows/OGP64/OGP/Cfg/Preferences.pm.default new file mode 100644 index 00000000..63b8c169 --- /dev/null +++ b/Agent-Windows/OGP64/OGP/Cfg/Preferences.pm.default @@ -0,0 +1,9 @@ +%Cfg::Preferences = ( + screen_log_local => '1', + delete_logs_after => '30', + ogp_manages_ftp => '1', + ftp_method => 'PureFTPd', + ogp_autorestart_server => '1', + protocol_shutdown_waittime => '10', +); + diff --git a/Agent-Windows/OGP64/OGP/Cfg/bash_prefs.cfg b/Agent-Windows/OGP64/OGP/Cfg/bash_prefs.cfg new file mode 100644 index 00000000..912c6b39 --- /dev/null +++ b/Agent-Windows/OGP64/OGP/Cfg/bash_prefs.cfg @@ -0,0 +1,9 @@ +agent_auto_update=0 +agent_update_repo_url=http://forge.runlevelsystems.com/dev/GSP.git +agent_update_branch=Panel-unstable +agent_update_raw_url=http://forge.runlevelsystems.com/dev/GSP/raw/branch/Panel-unstable/Agent-Windows/OGP64/OGP/ogp_agent.pl +run_pureftpd=0 +ftp_port=21 +ftp_ip=0.0.0.0 +ftp_pasv_range= + diff --git a/Agent-Windows/OGP64/OGP/Cfg/bash_prefs.cfg.default b/Agent-Windows/OGP64/OGP/Cfg/bash_prefs.cfg.default new file mode 100644 index 00000000..912c6b39 --- /dev/null +++ b/Agent-Windows/OGP64/OGP/Cfg/bash_prefs.cfg.default @@ -0,0 +1,9 @@ +agent_auto_update=0 +agent_update_repo_url=http://forge.runlevelsystems.com/dev/GSP.git +agent_update_branch=Panel-unstable +agent_update_raw_url=http://forge.runlevelsystems.com/dev/GSP/raw/branch/Panel-unstable/Agent-Windows/OGP64/OGP/ogp_agent.pl +run_pureftpd=0 +ftp_port=21 +ftp_ip=0.0.0.0 +ftp_pasv_range= + diff --git a/Agent-Windows/OGP64/OGP/Install/agent_start_cygwin.sh b/Agent-Windows/OGP64/OGP/Install/agent_start_cygwin.sh index 2fc2060e..2ac6f9d9 100644 --- a/Agent-Windows/OGP64/OGP/Install/agent_start_cygwin.sh +++ b/Agent-Windows/OGP64/OGP/Install/agent_start_cygwin.sh @@ -7,6 +7,8 @@ PIDFILE="${1:-/OGP/ogp_agent_run.pid}" PREFS_FILE="$AGENT_DIR/Cfg/bash_prefs.cfg" REPO_URL_DEFAULT="http://forge.runlevelsystems.com/dev/GSP.git" REPO_BRANCH_DEFAULT="Panel-unstable" +RAW_AGENT_URL_DEFAULT="http://forge.runlevelsystems.com/dev/GSP/raw/branch/Panel-unstable/Agent-Windows/OGP64/OGP/ogp_agent.pl" +REPO_AGENT_PATH="Agent-Windows/OGP64/OGP/ogp_agent.pl" warn() { printf 'WARNING: %s\n' "$*" >&2 @@ -26,10 +28,45 @@ normalize_text_files() { done } +normalize_bash_preferences() { + [ -f "$PREFS_FILE" ] || return 0 + sed -i 's/\r$//' "$PREFS_FILE" 2>/dev/null || warn "Could not normalize CRLF in $PREFS_FILE" + sed -i -E 's/^[[:space:]]+([A-Za-z_][A-Za-z0-9_]*=)/\1/' "$PREFS_FILE" 2>/dev/null || warn "Could not normalize assignments in $PREFS_FILE" +} + +install_default_config_if_missing() { + local target="$1" + local template="$2" + if [ -f "$target" ]; then + return 0 + fi + if [ ! -f "$template" ]; then + warn "Missing template $template; cannot create $target" + return 0 + fi + mkdir -p "$(dirname "$target")" 2>/dev/null || { + warn "Cannot create config directory for $target" + return 0 + } + cp "$template" "$target" 2>/dev/null || { + warn "Cannot create default config $target from $template" + return 0 + } + sed -i 's/\r$//' "$target" 2>/dev/null || true +} + +ensure_default_configs() { + install_default_config_if_missing "$AGENT_DIR/Cfg/Config.pm" "$AGENT_DIR/Cfg/Config.pm.default" + install_default_config_if_missing "$AGENT_DIR/Cfg/Preferences.pm" "$AGENT_DIR/Cfg/Preferences.pm.default" + install_default_config_if_missing "$AGENT_DIR/Cfg/bash_prefs.cfg" "$AGENT_DIR/Cfg/bash_prefs.cfg.default" + normalize_bash_preferences +} + load_agent_preferences() { agent_auto_update=0 agent_update_repo_url="$REPO_URL_DEFAULT" agent_update_branch="$REPO_BRANCH_DEFAULT" + agent_update_raw_url="$RAW_AGENT_URL_DEFAULT" if [ -f "$PREFS_FILE" ]; then # shellcheck disable=SC1090 @@ -39,6 +76,64 @@ load_agent_preferences() { agent_auto_update="${agent_auto_update:-0}" agent_update_repo_url="${agent_update_repo_url:-$REPO_URL_DEFAULT}" agent_update_branch="${agent_update_branch:-$REPO_BRANCH_DEFAULT}" + agent_update_raw_url="${agent_update_raw_url:-$RAW_AGENT_URL_DEFAULT}" +} + +validate_agent_file() { + local candidate="$1" + [ -s "$candidate" ] || { + warn "Candidate agent file is empty: $candidate" + return 1 + } + if head -5 "$candidate" | grep -Eiq '(/dev/null || true + perl -c "$candidate" >/tmp/gsp-agent-perl-check.log 2>&1 || { + warn "Candidate agent failed perl validation:" + cat /tmp/gsp-agent-perl-check.log >&2 2>/dev/null || true + return 1 + } + return 0 +} + +download_agent_with_curl() { + local target="$1" + if ! command -v curl >/dev/null 2>&1; then + return 1 + fi + echo "Downloading Windows agent from $agent_update_raw_url..." + curl -fsSL "$agent_update_raw_url" -o "$target" +} + +download_agent_with_git() { + local target="$1" + if ! command -v git >/dev/null 2>&1; then + return 1 + fi + + local repo_dir source_file + repo_dir="$(dirname "$target")/repo" + echo "Checking for Windows agent update from $agent_update_repo_url ($agent_update_branch)..." + if ! git clone --depth 1 --branch "$agent_update_branch" "$agent_update_repo_url" "$repo_dir"; then + return 1 + fi + + source_file="$repo_dir/$REPO_AGENT_PATH" + if [ ! -f "$source_file" ]; then + warn "Updated Windows agent source was not found at $REPO_AGENT_PATH" + return 1 + fi + cp "$source_file" "$target" } auto_update_windows_agent() { @@ -47,32 +142,32 @@ auto_update_windows_agent() { return 0 } - if ! command -v git >/dev/null 2>&1; then - warn "git is not installed; skipping agent auto-update and using the current agent." - return 0 - fi - - local tmp_dir repo_dir source_file target_file backup_file + local tmp_dir candidate_file target_file backup_file tmp_dir="$(mktemp -d /tmp/gsp-agent-update.XXXXXX 2>/dev/null)" || { warn "Could not create temporary update directory; skipping auto-update." return 0 } - repo_dir="$tmp_dir/repo" + candidate_file="$tmp_dir/ogp_agent.pl" target_file="$AGENT_DIR/ogp_agent.pl" backup_file="$AGENT_DIR/ogp_agent.pl.bak.$(date +%Y%m%d%H%M%S)" - echo "Checking for Windows agent update from $agent_update_repo_url ($agent_update_branch)..." - if ! git clone --depth 1 --branch "$agent_update_branch" "$agent_update_repo_url" "$repo_dir"; then - warn "Agent auto-update clone failed; using the current agent." + if ! download_agent_with_curl "$candidate_file"; then + warn "curl download failed or curl is unavailable; trying git fallback." + if ! download_agent_with_git "$candidate_file"; then + warn "Agent auto-update download failed; using the current agent." + rm -rf "$tmp_dir" + return 0 + fi + fi + + if ! validate_agent_file "$candidate_file"; then + warn "Downloaded Windows agent was rejected; using the current agent." rm -rf "$tmp_dir" return 0 fi - source_file="$repo_dir/Agent-Windows/ogp_agent.pl" - if [ ! -f "$source_file" ]; then - warn "Updated Windows agent source was not found at Agent-Windows/ogp_agent.pl; using the current agent." - rm -rf "$tmp_dir" - return 0 + if ! validate_agent_file "$target_file"; then + warn "Current Windows agent does not validate. Auto-update can still replace it if backup succeeds." fi cp "$target_file" "$backup_file" 2>/dev/null || { @@ -81,18 +176,16 @@ auto_update_windows_agent() { return 0 } - if ! cp "$source_file" "$target_file"; then + if ! cp "$candidate_file" "$target_file"; then warn "Could not copy updated Windows agent; restoring backup." cp "$backup_file" "$target_file" 2>/dev/null rm -rf "$tmp_dir" return 0 fi - sed -i 's/\r$//' "$target_file" 2>/dev/null || true - if ! perl -c "$target_file"; then - warn "Updated Windows agent failed perl syntax validation; restoring backup." + if ! validate_agent_file "$target_file"; then + warn "Updated Windows agent failed validation after install; restoring backup." cp "$backup_file" "$target_file" 2>/dev/null - perl -c "$target_file" || true rm -rf "$tmp_dir" return 0 fi @@ -106,11 +199,12 @@ cd "$AGENT_DIR" || fail "Could not enter $AGENT_DIR. Is the Windows agent instal normalize_text_files "$AGENT_DIR" normalize_text_files "/Install" +ensure_default_configs load_agent_preferences auto_update_windows_agent echo "Validating $AGENT_DIR/ogp_agent.pl..." -perl -c "$AGENT_DIR/ogp_agent.pl" || fail "Perl syntax/dependency validation failed. Install missing Cygwin Perl packages or restore a valid Windows agent file." +validate_agent_file "$AGENT_DIR/ogp_agent.pl" || fail "Perl syntax/dependency validation failed. Install missing Cygwin Perl packages or restore a valid Windows agent file." echo "Launching GSP Windows Agent..." exec perl "$AGENT_DIR/ogp_agent.pl" -pidfile "$PIDFILE" diff --git a/Agent-Windows/OGP64/OGP/README.md b/Agent-Windows/OGP64/OGP/README.md index 3897fe64..7c83fdb1 100644 --- a/Agent-Windows/OGP64/OGP/README.md +++ b/Agent-Windows/OGP64/OGP/README.md @@ -21,6 +21,21 @@ Cygwin-based agent that lets the GameServer Panel manage Windows Server 2019/202 4. Edit `C:\\OGP\\Cfg\\Config.pm` so it matches the server entry you created in the GameServer Panel. 5. Start the “OGP agent start on boot” scheduled task (or reboot). +## Startup and auto-update + +Use `C:\\OGP64\\agent_start.bat` or `C:\\OGP\\Install\\agent_start.bat` to start the agent manually. The launcher detects the bundled Cygwin `bash.exe` first, then falls back to `C:\\cygwin64\\bin\\bash.exe` and `C:\\cygwin\\bin\\bash.exe`. + +`C:\\OGP\\Cfg\\bash_prefs.cfg` controls optional restart-time agent updates: + +```bash +agent_auto_update=0 +agent_update_repo_url=http://forge.runlevelsystems.com/dev/GSP.git +agent_update_branch=Panel-unstable +agent_update_raw_url=http://forge.runlevelsystems.com/dev/GSP/raw/branch/Panel-unstable/Agent-Windows/OGP64/OGP/ogp_agent.pl +``` + +When `agent_auto_update=1`, the launcher downloads to a temporary file, rejects HTML/404/empty/non-Perl content, validates with `perl -c`, backs up the current `ogp_agent.pl`, and rolls back if validation fails. + ## Related repositories - [GSP](https://github.com/GameServerPanel/GSP) – PHP panel that issues commands to the agents. diff --git a/Agent-Windows/OGP64/OGP/documentation/agent-guide.md b/Agent-Windows/OGP64/OGP/documentation/agent-guide.md index 3c3eac66..d7db71fd 100644 --- a/Agent-Windows/OGP64/OGP/documentation/agent-guide.md +++ b/Agent-Windows/OGP64/OGP/documentation/agent-guide.md @@ -31,12 +31,28 @@ The Windows agent bundles Cygwin, Perl, GNU Screen, and helper scripts so the Ga ## Updating the agent +Manual update: + 1. Stop the scheduled task or kill any running `ogp_agent.pl` processes. 2. Pull the latest files (`git pull` inside `C:\\gsp-agent` or download the release ZIP again). 3. Copy updated files into `C:\\OGP`. 4. Re-run `rebase_post_ins.bat` if new Cygwin DLLs were added. 5. Start the agent task again. +Restart-time auto-update: + +1. Edit `/OGP/Cfg/bash_prefs.cfg`. +2. Set `agent_auto_update=1`. +3. Keep the default Forgejo values unless you are testing another branch: + ```bash + agent_update_repo_url=http://forge.runlevelsystems.com/dev/GSP.git + agent_update_branch=Panel-unstable + agent_update_raw_url=http://forge.runlevelsystems.com/dev/GSP/raw/branch/Panel-unstable/Agent-Windows/OGP64/OGP/ogp_agent.pl + ``` +4. Restart the agent with `C:\\OGP64\\agent_start.bat` or `C:\\OGP\\Install\\agent_start.bat`. + +The updater downloads to a temporary file, rejects empty files, HTML error pages, `Not found` responses, and files without the expected Perl agent markers, then runs `perl -c` before replacing `/OGP/ogp_agent.pl`. Failed auto-update attempts are non-fatal and continue with the last known good agent. + ## Logging & troubleshooting - Main log: `C:\\OGP\\ogp_agent.log` @@ -44,6 +60,9 @@ The Windows agent bundles Cygwin, Perl, GNU Screen, and helper scripts so the Ga - Customer servers run inside GNU Screen sessions—attach via `C:\\OGP\\bin\\screen -r ogp_agent` - Firewall: open TCP 12679 (or your configured port) and any game-specific ports before provisioning. - Authentication errors almost always mean the `key` in `Cfg/Config.pm` does not match the value stored in the panel → Administration → Servers. +- `/OGP/Cfg/bash_prefs.cfg` must use LF line endings and no leading whitespace before assignments. The launcher normalizes this automatically before sourcing the file. +- `./ogp_agent.pl: line 1: Not: command not found` means the agent file was replaced with text/HTTP error content. Restore a backup or enable auto-update after confirming the Forgejo raw URL above is reachable. +- `The user name could not be found. NET HELPMSG 2221.` came from the legacy root launcher that queried `cyg_server`. Use the maintained launchers above; they do not require that user for manual foreground startup. ## Usage tips diff --git a/Agent-Windows/OGP64/agent_start.bat b/Agent-Windows/OGP64/agent_start.bat index 17af8858..cc6dd3f1 100644 --- a/Agent-Windows/OGP64/agent_start.bat +++ b/Agent-Windows/OGP64/agent_start.bat @@ -1,41 +1,20 @@ -@echo off -@title OGP Agent -FOR /f "tokens=2,3,4 delims=[.]" %%a IN ('ver') DO SET WVer=%%a -FOR /f "tokens=2,3 delims= " %%a IN ('echo %WVer%') DO SET Ver=%%a -whoami /groups | find "S-1-16-12288" >nul 2>&1 -if NOT %errorLevel% == 0 if %VER% GEQ 6 ( - echo Failure: Current permissions inadequate. - echo[ - echo Run this script by using "Run as administrator" in the context menu. - pause >nul - exit -) -set WD=%~dp0 -pushd %WD% -set path=%WD%bin;%WD%usr\sbin;%path% -set CYGWIN=server ntsec -set SHELL=/bin/bash -set runAgentNormally=no - -REM Stop any running agent -if exist %WD%var\run\pure-ftpd.pid set /p PID1=<%WD%var\run\pure-ftpd.pid -if exist %WD%OGP\ogp_agent.pid set /p PID2=<%WD%OGP\ogp_agent.pid -if exist %WD%OGP\ogp_agent_run.pid set /p PID3=<%WD%OGP\ogp_agent_run.pid -IF NOT [%PID1%] == [] kill -15 %PID1% -IF NOT [%PID2%] == [] kill -15 %PID2% -IF NOT [%PID3%] == [] kill -15 %PID3% - -REM Check for cyg_server user and if it exists and the user running this script matches, run it the normal way, else prompt for elevation -if "%username%" == "" set runAgentNormally=yes -if "%username%" == "cyg_server" set runAgentNormally=yes - -net user cyg_server -if %ERRORLEVEL% EQU 0 ( - if %runAgentNormally% == yes ( - bash ogp_agent -pidfile /OGP/ogp_agent_run.pid - ) else ( - cygstart cmd /c "runas /profile /user:cyg_server \"%WD%\bin\bash.exe %WD%\bin\ogp_agent -pidfile /OGP/ogp_agent_run.pid\"" - ) -) else ( - bash ogp_agent -pidfile /OGP/ogp_agent_run.pid -) +@echo off +setlocal EnableExtensions +title GSP Windows Agent + +set "ROOT=%~dp0" +set "INNER_START=%ROOT%OGP\Install\agent_start.bat" + +if not exist "%INNER_START%" ( + echo Failure: maintained agent launcher was not found. + echo. + echo Expected: + echo %INNER_START% + echo. + echo This checkout should contain OGP\Install\agent_start.bat. + pause + exit /b 1 +) + +call "%INNER_START%" +exit /b %ERRORLEVEL% diff --git a/README.md b/README.md index 45030931..fabe7f74 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The Panel is the control layer. It loads modules from `Panel/modules/`, stores p ### Windows Agent -`Agent-Windows/ogp_agent.pl` mirrors the Linux agent as closely as possible for Windows/Cygwin environments. +`Agent-Windows/OGP64/OGP/ogp_agent.pl` mirrors the Linux agent as closely as possible for Windows/Cygwin environments. ### Website diff --git a/docs/agents/WINDOWS_AGENT.md b/docs/agents/WINDOWS_AGENT.md index 9ec9b35a..0989ee13 100644 --- a/docs/agents/WINDOWS_AGENT.md +++ b/docs/agents/WINDOWS_AGENT.md @@ -7,6 +7,10 @@ ## 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/php-query/` - `Agent-Windows/ArmaBE/` - `Agent-Windows/Cfg/` @@ -61,24 +65,31 @@ 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 the Windows agent file 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` +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` +6. optionally update only the Windows agent file from Forgejo when `agent_auto_update=1` +7. backup the current `/OGP/ogp_agent.pl` +8. validate downloaded and installed agent files with content checks plus `perl -c` +9. restore the backup if validation fails +10. launch `/OGP/ogp_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` -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. +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. 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. +Required Cygwin Perl packages include `perl`, `perl_vendor`, `perl-HTTP-Daemon`, `perl-Path-Class`, `perl-XML-Parser`, `perl-XML-Simple`, `perl-Archive-Zip`, and `perl-Archive-Extract`. A clean non-Cygwin Linux workstation may fail `perl -c` on these dependencies even though the bundled Windows Cygwin tree contains them. + +Default tracked config files contain placeholders only. Production installs must replace `CHANGE_ME_PANEL_AGENT_KEY`, `web_api_url`, and related values with the values configured in the Panel remote-server record. + ## Status Logic Relevant functions: diff --git a/docs/architecture/REPOSITORY_OVERVIEW.md b/docs/architecture/REPOSITORY_OVERVIEW.md index 94e9c345..5c3d17b6 100644 --- a/docs/architecture/REPOSITORY_OVERVIEW.md +++ b/docs/architecture/REPOSITORY_OVERVIEW.md @@ -55,7 +55,7 @@ The agents are the execution layer. They: Important agent files: - `Agent_Linux/ogp_agent.pl` -- `Agent-Windows/ogp_agent.pl` +- `Agent-Windows/OGP64/OGP/ogp_agent.pl` - `Agent_Linux/startups/` - `Agent-Windows/ServerFiles/` - `Agent_Linux/php-query/` @@ -156,4 +156,3 @@ For future investigations, start with: 3. `docs/modules/GAMEMANAGER.md` 4. `docs/features/STATUS_SYSTEM.md` 5. `docs/features/XML_SYSTEM.md` - diff --git a/docs/development/CODEX_GUIDE.md b/docs/development/CODEX_GUIDE.md index 5fb9ceda..3454a7f4 100644 --- a/docs/development/CODEX_GUIDE.md +++ b/docs/development/CODEX_GUIDE.md @@ -43,7 +43,7 @@ This file is the first stop for future Codex sessions working in this repository - `Panel/modules/config_games/server_config_parser.php` - `Panel/includes/lib_remote.php` - `Agent_Linux/ogp_agent.pl` -- `Agent-Windows/ogp_agent.pl` +- `Agent-Windows/OGP64/OGP/ogp_agent.pl` ### Status Logic @@ -51,7 +51,7 @@ This file is the first stop for future Codex sessions working in this repository - `Panel/modules/gamemanager/home_handling_functions.php` - `Panel/modules/gamemanager/server_monitor.php` - `Agent_Linux/ogp_agent.pl` -- `Agent-Windows/ogp_agent.pl` +- `Agent-Windows/OGP64/OGP/ogp_agent.pl` ### Scheduler Logic @@ -59,7 +59,7 @@ This file is the first stop for future Codex sessions working in this repository - `Panel/modules/cron/cron.php` - `Panel/modules/cron/shared_cron_functions.php` - `Agent_Linux/ogp_agent.pl` -- `Agent-Windows/ogp_agent.pl` +- `Agent-Windows/OGP64/OGP/ogp_agent.pl` ### Workshop / Server Content Logic @@ -82,7 +82,7 @@ This file is the first stop for future Codex sessions working in this repository - `Panel/includes/lib_remote.php` - `Agent_Linux/ogp_agent.pl` -- `Agent-Windows/ogp_agent.pl` +- `Agent-Windows/OGP64/OGP/ogp_agent.pl` ### Decisions And Historical Reports @@ -135,7 +135,7 @@ This file is the first stop for future Codex sessions working in this repository 2. Check `Panel/modules/update/update.php`. 3. Check `Panel/modules/administration/panel_update.php`. 4. Check `Panel/includes/lib_remote.php` for the `component_update` wrapper. -5. Check both `Agent_Linux/ogp_agent.pl` and `Agent-Windows/ogp_agent.pl` for the `component_update` RPC. +5. Check both `Agent_Linux/ogp_agent.pl` and `Agent-Windows/OGP64/OGP/ogp_agent.pl` for the `component_update` RPC. 6. Remember that local Panel/Website updates and remote agent updates both clone a configured Git branch into staging and copy only configured component folders. 7. Never let updater logic delete server homes, game install folders, user data, agent `Cfg/`, logs, uploads, backups, or runtime PID files. diff --git a/docs/features/COMPANION_PROGRAMS.md b/docs/features/COMPANION_PROGRAMS.md index 1a7f527c..2eb7a8c4 100644 --- a/docs/features/COMPANION_PROGRAMS.md +++ b/docs/features/COMPANION_PROGRAMS.md @@ -8,7 +8,7 @@ Important references: - `docs/decisions/0003-companion-programs.md` - `Agent_Linux/ogp_agent.pl` -- `Agent-Windows/ogp_agent.pl` +- `Agent-Windows/OGP64/OGP/ogp_agent.pl` - `Panel/modules/config_games/schema_server_config.xml` ## What The System Needs To Do @@ -36,4 +36,3 @@ The system should be XML/admin-defined and agent-managed. ## Recommendation Keep the design centralized and game-aware. Do not rely on one-off helper files as the source of truth. - diff --git a/docs/features/INSTALLERS.md b/docs/features/INSTALLERS.md index a5c4a7f7..d0dcd9dc 100644 --- a/docs/features/INSTALLERS.md +++ b/docs/features/INSTALLERS.md @@ -11,7 +11,7 @@ Important references: - `Panel/modules/addonsmanager/module.php` - `Panel/modules/steam_workshop/module.php` - `Agent_Linux/ogp_agent.pl` -- `Agent-Windows/ogp_agent.pl` +- `Agent-Windows/OGP64/OGP/ogp_agent.pl` ## Installer Types Seen In The Codebase @@ -24,4 +24,3 @@ Important references: ## Recommended Model Installer strategy should come from game capability metadata. The agent should execute trusted strategies, not arbitrary customer commands. - diff --git a/docs/features/LOGGING_SYSTEM.md b/docs/features/LOGGING_SYSTEM.md index d33ae591..ad6f43b2 100644 --- a/docs/features/LOGGING_SYSTEM.md +++ b/docs/features/LOGGING_SYSTEM.md @@ -16,7 +16,7 @@ Important references: - `Panel/modules/gamemanager/view_server_log.php` - `Panel/modules/gamemanager/get_server_log.php` - `Agent_Linux/ogp_agent.pl` -- `Agent-Windows/ogp_agent.pl` +- `Agent-Windows/OGP64/OGP/ogp_agent.pl` ## What Works diff --git a/docs/features/SCHEDULER_ACTIONS.md b/docs/features/SCHEDULER_ACTIONS.md index 37400c8e..8e9aba42 100644 --- a/docs/features/SCHEDULER_ACTIONS.md +++ b/docs/features/SCHEDULER_ACTIONS.md @@ -10,7 +10,7 @@ Primary files: - `Panel/modules/cron/user_cron.php` - `Panel/modules/cron/shared_cron_functions.php` - `Agent_Linux/ogp_agent.pl` -- `Agent-Windows/ogp_agent.pl` +- `Agent-Windows/OGP64/OGP/ogp_agent.pl` ## Current Model @@ -103,5 +103,5 @@ Current observable logs: ## Search Coverage Used For This Document - `sed -n '1,260p' Panel/modules/cron/shared_cron_functions.php` -- `rg -n "scheduler_" Agent_Linux/ogp_agent.pl Agent-Windows/ogp_agent.pl` +- `rg -n "scheduler_" Agent_Linux/ogp_agent.pl Agent-Windows/OGP64/OGP/ogp_agent.pl` - `rg -n "gamemanager/(start|stop|restart)|server_content/run_scheduled_action" Panel/modules/cron` diff --git a/docs/features/SCHEDULER_SYSTEM.md b/docs/features/SCHEDULER_SYSTEM.md index c48de46f..f6165c92 100644 --- a/docs/features/SCHEDULER_SYSTEM.md +++ b/docs/features/SCHEDULER_SYSTEM.md @@ -10,7 +10,7 @@ Important references: - `Panel/modules/cron/cron.php` - `Panel/modules/cron/shared_cron_functions.php` - `Agent_Linux/ogp_agent.pl` -- `Agent-Windows/ogp_agent.pl` +- `Agent-Windows/OGP64/OGP/ogp_agent.pl` ## Current Strengths diff --git a/docs/features/STATUS_SYSTEM.md b/docs/features/STATUS_SYSTEM.md index 07304aff..cd072911 100644 --- a/docs/features/STATUS_SYSTEM.md +++ b/docs/features/STATUS_SYSTEM.md @@ -76,6 +76,7 @@ The Panel fallback does not replace a full agent-owned status model. It exists s - Marker files can become stale after crashes or power loss. - A game can be online even if query metadata is temporarily unavailable. - Some games need long startup windows, so timeouts must be configurable per game. +- `Agent status RPC unavailable` usually means the Panel could not complete the `server_status` call. On Windows/Cygwin nodes, first verify `/OGP/ogp_agent.pl` is valid Perl, `/OGP/Cfg/bash_prefs.cfg` has LF line endings and no leading spaces before assignments, and the agent starts cleanly from `Agent-Windows/OGP64/agent_start.bat` or `/OGP/Install/agent_start.bat`. ## Planned Improvement Shape diff --git a/docs/modules/GAMEMANAGER.md b/docs/modules/GAMEMANAGER.md index 64529b5e..aa5cf93f 100644 --- a/docs/modules/GAMEMANAGER.md +++ b/docs/modules/GAMEMANAGER.md @@ -93,6 +93,8 @@ Current display mapping: Query metadata remains optional. A running process/session or listening game port must not be shown as red/offline only because query details are unavailable. +If the monitor says `Agent status RPC unavailable`, treat it as an agent reachability/startup problem before changing query logic. For Windows/Cygwin nodes, validate `/OGP/ogp_agent.pl` with `perl -c`, check `/OGP/Cfg/bash_prefs.cfg` for CRLF or leading whitespace before assignments, and start the agent through the maintained launcher in `Agent-Windows/OGP64/agent_start.bat` or `/OGP/Install/agent_start.bat`. + ## Log Viewer Relevant files: diff --git a/docs/modules/SCHEDULER.md b/docs/modules/SCHEDULER.md index 8a65230b..bc6975c7 100644 --- a/docs/modules/SCHEDULER.md +++ b/docs/modules/SCHEDULER.md @@ -10,7 +10,7 @@ Important files: - `Panel/modules/cron/cron.php` - `Panel/modules/cron/shared_cron_functions.php` - `Agent_Linux/ogp_agent.pl` -- `Agent-Windows/ogp_agent.pl` +- `Agent-Windows/OGP64/OGP/ogp_agent.pl` ## How It Works Today @@ -92,7 +92,7 @@ If scheduler behavior needs deeper investigation, start with: - `Panel/modules/cron/cron.php` - `Panel/modules/cron/shared_cron_functions.php` - `Agent_Linux/ogp_agent.pl` scheduler subroutines -- `Agent-Windows/ogp_agent.pl` scheduler subroutines +- `Agent-Windows/OGP64/OGP/ogp_agent.pl` scheduler subroutines ## Current Panel Update Finding diff --git a/docs/modules/UPDATE.md b/docs/modules/UPDATE.md index 560012e7..29685e46 100644 --- a/docs/modules/UPDATE.md +++ b/docs/modules/UPDATE.md @@ -59,6 +59,7 @@ Important implementation note: - These helpers must not be nested inside another function. A previous bad edit placed `gsp_update_settings()` inside `gsp_get_git_commit()`, which caused a fatal error when the update page called the helper before `gsp_get_git_commit()` had ever executed. - If the update page throws `Call to undefined function gsp_update_settings()`, first verify the deployed `Panel/modules/administration/panel_update.php` matches the repository version and that this helper exists near the top of the file before `gsp_panel_update_section()` is called. - `gsp_do_configured_git_update()` must also remain top-level. A bad edit placed it inside `gsp_do_update()`, so `/home.php?m=update` called an undefined function until a legacy GitHub update path happened to execute first. +- `gsp_checkout_update_source()` must remain top-level. If it is nested inside `gsp_apply_update_from_zip()` or another helper, configured Git updates can fatal with `Call to undefined function gsp_checkout_update_source()`. ## Update Flow @@ -130,6 +131,7 @@ The old repeated SSL vhost disable buttons are not part of the primary update pa - The update page fatal `Call to undefined function gsp_update_settings()` means the deployed `Panel/modules/administration/panel_update.php` is missing the top-level helper or is not the current repository copy. - The update page fatal `Call to undefined function gsp_do_configured_git_update()` means the configured Git update helper is missing or nested inside another helper in the deployed `panel_update.php`. +- The update page fatal `Call to undefined function gsp_checkout_update_source()` means the configured Git checkout helper is missing or nested inside another helper in the deployed `panel_update.php`. - `Panel/modules/update/update.php` only loads `Panel/modules/administration/panel_update.php` and calls `gsp_panel_update_section()`. - The configured update action uses `git clone --depth 1 --branch `. - Clone failures are logged to `logs/update_trace.log` with the configured repository source and branch.