chore: bootstrap Atay Makhzan ops repo
This commit is contained in:
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DOMAIN="${DOMAIN:-ataymakhzan.com}"
|
||||
SSH_PORT="${SSH_PORT:-2222}"
|
||||
OWNER="${OWNER:-ibnezzoubayr}"
|
||||
PROBE_REPO="${PROBE_REPO:-Empire-OS}"
|
||||
LOCAL_URL="${LOCAL_URL:-http://127.0.0.1:3001}"
|
||||
GITEA_CONTAINER="${GITEA_CONTAINER:-gitea}"
|
||||
RUN_DOCKER_CHECKS="${RUN_DOCKER_CHECKS:-1}"
|
||||
|
||||
echo "== Local API version =="
|
||||
curl -fsS "$LOCAL_URL/api/v1/version"
|
||||
echo
|
||||
|
||||
echo "== External API version =="
|
||||
curl -fsS "https://$DOMAIN/api/v1/version"
|
||||
echo
|
||||
|
||||
echo "== External homepage status =="
|
||||
curl -fsS -I -L --max-time 20 "https://$DOMAIN/" | sed -n '1,12p'
|
||||
|
||||
echo "== Git SSH authentication =="
|
||||
SSH_OUT=$(ssh -p "$SSH_PORT" -o BatchMode=yes -o ConnectTimeout=10 -T "git@$DOMAIN" 2>&1 || true)
|
||||
echo "$SSH_OUT"
|
||||
echo "$SSH_OUT" | grep -Eiq 'successfully authenticated|Hi .*!|Welcome' || {
|
||||
echo "Could not confirm successful SSH authentication from output" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "== Git ls-remote probe =="
|
||||
git ls-remote --heads "ssh://git@$DOMAIN:$SSH_PORT/$OWNER/$PROBE_REPO.git" >/dev/null
|
||||
|
||||
echo "== Optional Docker/native checks =="
|
||||
if [ "$RUN_DOCKER_CHECKS" = "1" ] && command -v docker >/dev/null 2>&1; then
|
||||
docker exec -u git "$GITEA_CONTAINER" gitea --version
|
||||
docker exec -u git "$GITEA_CONTAINER" gitea doctor check -c /data/gitea/conf/app.ini -w /data/gitea
|
||||
else
|
||||
echo "Skipping Docker checks. Set RUN_DOCKER_CHECKS=1 on the VPS to enable."
|
||||
fi
|
||||
|
||||
echo "Atay Makhzan verification passed."
|
||||
Reference in New Issue
Block a user