From dd27f294d361ad9fbc56cb45ada78d056304a320 Mon Sep 17 00:00:00 2001 From: RallyBlock <50393307+RallyBlock@users.noreply.github.com> Date: Sat, 21 Mar 2026 12:40:15 -0700 Subject: [PATCH] possible feedback for cloneing hang --- README.md | 2 +- bin/run-bl | 89 +++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 82 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index dc9bc43..2a204c1 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The image is available on Docker Hub at [rallyblockk/blockland-pelican](https:// | BL_INST_FORCE | bool (0 or 1) | 0 | Forcefully install the game each time you launch | BL_INST_OVERWRITE | bool (0 or 1) | 0 | Overwrite existing files during installation | BL_UNZIP_ADDONS | bool (0 or 1) | 0 | When enabled, automatically extracts any .zip files in the Add-Ons directory before the server starts. Each zip is unzipped and the archive is removed. Handles single-folder, single-file, and multi-file zip structures so add-ons end up in properly named folders. -| BL_ADDON_REPO | string | "" | Git repository URL to clone into the Add-Ons folder on server start. Only runs on container boot (server reboot). If already cloned, fetches and pulls only when the remote has new commits. +| BL_ADDON_REPO | string | "" | Git repository URL to clone into the Add-Ons folder on server start. Only runs on container boot (server reboot). If already cloned, fetches and pulls only when the remote has new commits. **Private HTTPS repos:** there is no terminal for git to prompt on — embed credentials in the URL, e.g. `https://USER:TOKEN@github.com/org/repo.git` (PAT/deploy token), or use an SSH URL with a deploy key. Logs print a redacted URL and hints if clone/fetch fails. | BL_ADDON_REPO_BRANCH | string | "" | Optional. Branch to clone and track when using BL_ADDON_REPO. Leave empty to use the repository's default branch. | BL_PATCH_ENABLE | bool (0 or 1) | 1 | Patches the game with RedBlocklandLoader and the WineFix DLL to make the console work with Wine 8.0.2 (See Wine section below) | BL_PATCH_EXE_URL | string | See Dockerfile | URL to retrieve the patched Blockland.exe from for RedBlocklandLoader diff --git a/bin/run-bl b/bin/run-bl index 1151fe7..5561a02 100644 --- a/bin/run-bl +++ b/bin/run-bl @@ -73,7 +73,67 @@ fi # Sync Add-On from git repository if BL_ADDON_REPO is set (only on reboot; only pulls when remote has updates) if [ -n "$BL_ADDON_REPO" ]; then - echo "Syncing Add-On from git repository..." + # Log HTTPS userinfo redacted (password/token); SSH URLs shown as-is + bl_redact_git_remote_url() { + case "$1" in + http://*|https://*) + echo "$1" | sed -E 's#(https?://)[^/@]+@#\1***@#' + ;; + *) + echo "$1" + ;; + esac + } + + # Pelican/Wings often use a pipe for the console: stdout is block-buffered, so plain echo can + # appear "stuck" while git writes to stderr. Use stderr for all addon diagnostics. + bl_addon_log() { + printf '%s\n' "$*" >&2 + } + + # Periodic lines while git runs (clone/fetch can look frozen in the panel otherwise) + bl_git_with_heartbeat() { + local label="$1" + shift + ( + while sleep 15; do + printf '[BL_ADDON_REPO] %s — still running (%s). Slow network, huge repo, or waiting on auth/firewall.\n' \ + "$label" "$(date -u +'%Y-%m-%d %H:%M:%S UTC')" >&2 + done + ) & + local _hb=$! + if command -v stdbuf >/dev/null 2>&1; then + stdbuf -oL -eL "$@" + else + "$@" + fi + local _rc=$? + kill "$_hb" 2>/dev/null + wait "$_hb" 2>/dev/null + return "$_rc" + } + + _repo_safe=$(bl_redact_git_remote_url "$BL_ADDON_REPO") + bl_addon_log "Syncing Add-On from git repository..." + bl_addon_log "[BL_ADDON_REPO] Remote (credentials redacted): ${_repo_safe}" + if [ -n "$BL_ADDON_REPO_BRANCH" ]; then + bl_addon_log "[BL_ADDON_REPO] Branch: ${BL_ADDON_REPO_BRANCH}" + else + bl_addon_log "[BL_ADDON_REPO] Branch: (repository default — not set)" + fi + bl_addon_log "[BL_ADDON_REPO] Target folder under Add-Ons: $(basename "$BL_ADDON_REPO" .git)" + bl_addon_log "[BL_ADDON_REPO] If clone/fetch hangs or fails in the panel:" + bl_addon_log " • No interactive login in Docker — private HTTPS repos usually need user + token IN the URL, e.g." + bl_addon_log " https://YOUR_USER:YOUR_TOKEN@github.com/org/repo.git" + bl_addon_log " (GitHub/GitLab: use a personal access token or deploy token, not your web password.)" + bl_addon_log " • Or use SSH (git@host:org/repo.git) with a deploy key available inside the container." + # Avoid indefinite hang waiting for a TTY password prompt (headless) + export GIT_TERMINAL_PROMPT=0 + # Do not invoke a credential helper that might block without a TTY + export GIT_ASKPASS=/bin/false + + # Abort if transfer stalls (bytes/sec below limit for lowSpeedTime seconds) + _git_slow=( -c "http.lowSpeedLimit=500" -c "http.lowSpeedTime=120" ) mkdir -p /home/container/Add-Ons cd /home/container/Add-Ons @@ -81,21 +141,34 @@ if [ -n "$BL_ADDON_REPO" ]; then repo_name=$(basename "$BL_ADDON_REPO" .git) if [ -d "$repo_name/.git" ]; then + bl_addon_log "[BL_ADDON_REPO] Existing clone at ${repo_name}/ — fetching..." cd "$repo_name" - git fetch origin + if ! bl_git_with_heartbeat "git fetch" git "${_git_slow[@]}" fetch --progress origin; then + bl_addon_log "[BL_ADDON_REPO] ERROR: git fetch failed (auth, network, or stall). Remote (redacted): ${_repo_safe}" + exit 1 + fi upstream=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null) behind=$(git rev-list HEAD.."${upstream:-origin/HEAD}" --count 2>/dev/null || echo 0) if [ "${behind:-0}" -gt 0 ]; then - echo "Add-On has updates, pulling..." - git pull --ff-only + bl_addon_log "[BL_ADDON_REPO] Remote is ahead — pulling (--ff-only)..." + if ! bl_git_with_heartbeat "git pull" git "${_git_slow[@]}" pull --ff-only --progress; then + bl_addon_log "[BL_ADDON_REPO] ERROR: git pull failed. Remote (redacted): ${_repo_safe}" + exit 1 + fi else - echo "Add-On is up to date." + bl_addon_log "[BL_ADDON_REPO] Add-On is up to date (no new commits on tracked branch)." fi cd /home/container/Add-Ons else - clone_opts=() - [ -n "$BL_ADDON_REPO_BRANCH" ] && clone_opts=(-b "$BL_ADDON_REPO_BRANCH") - git clone "${clone_opts[@]}" "$BL_ADDON_REPO" + bl_addon_log "[BL_ADDON_REPO] No existing clone — starting git clone (this may take a while)..." + clone_opts=(--progress --verbose) + [ -n "$BL_ADDON_REPO_BRANCH" ] && clone_opts+=(-b "$BL_ADDON_REPO_BRANCH") + if ! bl_git_with_heartbeat "git clone" git "${_git_slow[@]}" clone "${clone_opts[@]}" "$BL_ADDON_REPO"; then + bl_addon_log "[BL_ADDON_REPO] ERROR: git clone failed. Check URL, auth, branch name, and network." + bl_addon_log "[BL_ADDON_REPO] Remote used (redacted): ${_repo_safe}" + exit 1 + fi + bl_addon_log "[BL_ADDON_REPO] Clone finished successfully." fi cd /home/container || exit 1