feat: mirror repo on api.savsis.xyz as primary update source, github as fallback

install.sh clones from the mirror first (falls back to github.com if
unreachable); mbs update fetches origin (mirror) first, falls back to
a github remote if that fetch fails. Mirror itself is a bare repo on
финка2, kept in sync from GitHub every 10 min via an authenticated
token (needed because that box's IP gets rate-limited/blocked by
GitHub for anonymous git clones).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Savsis? 2026-09-11 17:02:22 +05:00
parent 36fa7d55b0
commit 2604c2dfe7
2 changed files with 24 additions and 5 deletions

View file

@ -2,6 +2,7 @@
set -e
set -o pipefail
MIRROR_URL="https://api.savsis.xyz/git/mbs-panel.git/"
REPO_URL="https://github.com/devsavsis/mbs-panel.git"
APP_DIR="/opt/mbs-panel"
WEBROOT="/var/www/certbot"
@ -82,7 +83,12 @@ echo "клонируем репозиторий в $APP_DIR..."
if [ -d "$APP_DIR/.git" ]; then
retry git -C "$APP_DIR" pull --quiet
else
retry git clone --quiet "$REPO_URL" "$APP_DIR"
if ! git clone --quiet "$MIRROR_URL" "$APP_DIR" 2>/dev/null; then
echo "зеркало недоступно, клонирую напрямую с GitHub..."
retry git clone --quiet "$REPO_URL" "$APP_DIR"
git -C "$APP_DIR" remote set-url origin "$MIRROR_URL"
fi
git -C "$APP_DIR" remote add github "$REPO_URL" 2>/dev/null || true
fi
cd "$APP_DIR"