fix(boot): split Cloud Run check into direct URL + domain, show Phase 5 warning when domain fails
This commit is contained in:
parent
d9119035fe
commit
b653cc4d58
|
|
@ -2,13 +2,13 @@
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# osvauco-opax-boot.sh — OSVauco OPAX session-starter
|
# osvauco-opax-boot.sh — OSVauco OPAX session-starter
|
||||||
# Bruk: source ~/OSVauco/scripts/osvauco-opax-boot.sh
|
# Bruk: source ~/OSVauco/scripts/osvauco-opax-boot.sh
|
||||||
# NB: Må sources (ikke bash) for PROMPT_COMMAND + opax_logg_slutt.
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
OSVAUCO_DIR="$HOME/OSVauco"
|
OSVAUCO_DIR="$HOME/OSVauco"
|
||||||
ROADMAP="$OSVAUCO_DIR/docs/VAUCO_OS_ROADMAP.md"
|
ROADMAP="$OSVAUCO_DIR/docs/VAUCO_OS_ROADMAP.md"
|
||||||
TODO="$OSVAUCO_DIR/docs/TODO.md"
|
|
||||||
SESSION_LOG="$OSVAUCO_DIR/docs/OSVAUCO_OPAX_SESSION_LOG.md"
|
SESSION_LOG="$OSVAUCO_DIR/docs/OSVAUCO_OPAX_SESSION_LOG.md"
|
||||||
|
DIRECT_URL="https://osvauco-agent-357036551735.us-central1.run.app"
|
||||||
|
DOMAIN_URL="https://opax.vauco.no"
|
||||||
|
|
||||||
GREEN="$(tput setaf 2 || true)"
|
GREEN="$(tput setaf 2 || true)"
|
||||||
RED="$(tput setaf 1 || true)"
|
RED="$(tput setaf 1 || true)"
|
||||||
|
|
@ -33,7 +33,6 @@ else
|
||||||
printf " ${DIM}✦ gcloud auth OK${NC}\n"
|
printf " ${DIM}✦ gcloud auth OK${NC}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ADC sjekk
|
|
||||||
NEED_ADC_LOGIN=0
|
NEED_ADC_LOGIN=0
|
||||||
if ! gcloud auth application-default print-access-token >/dev/null 2>&1; then
|
if ! gcloud auth application-default print-access-token >/dev/null 2>&1; then
|
||||||
NEED_ADC_LOGIN=1
|
NEED_ADC_LOGIN=1
|
||||||
|
|
@ -46,7 +45,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $NEED_ADC_LOGIN -eq 1 ]]; then
|
if [[ $NEED_ADC_LOGIN -eq 1 ]]; then
|
||||||
printf " ${YELLOW}⚠ ADC utløpt eller gammel — fornyer...${NC}\n"
|
printf " ${YELLOW}⚠ ADC utløpt — fornyer...${NC}\n"
|
||||||
gcloud auth application-default login --no-launch-browser \
|
gcloud auth application-default login --no-launch-browser \
|
||||||
--scopes="https://www.googleapis.com/auth/cloud-platform"
|
--scopes="https://www.googleapis.com/auth/cloud-platform"
|
||||||
touch "$ADC_SCOPE_FILE"
|
touch "$ADC_SCOPE_FILE"
|
||||||
|
|
@ -60,26 +59,47 @@ clear
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# BOOT UI
|
# BOOT UI
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
printf "${CYAN}OSVauco · OPAX ❱ %s · %s${NC}\n" "$SESSION_ID" "propane-will-491900-m5"
|
printf "${CYAN}OSVauco · OPAX ❱ %s · propane-will-491900-m5${NC}\n" "$SESSION_ID"
|
||||||
printf "${DIM}────────────────────────────────────────────────────────────${NC}\n"
|
printf "${DIM}────────────────────────────────────────────────────────────${NC}\n"
|
||||||
|
|
||||||
printf "${BOLD}SERVICES${NC}\n"
|
printf "${BOLD}SERVICES${NC}\n"
|
||||||
check_service() {
|
|
||||||
printf " %-12s " "$1"
|
# Cloud Run — sjekk direkte URL (den faktiske tjenesten)
|
||||||
if eval "$2" >/dev/null 2>&1; then printf "${GREEN}✦ OK${NC}\n"; else printf "${RED}✗ FAIL${NC}\n"; fi
|
TOKEN=$(gcloud auth print-identity-token 2>/dev/null || true)
|
||||||
}
|
CR_HTTP=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||||
check_service "Cloud Run" "curl -s -f -H \"Authorization: Bearer $(gcloud auth print-identity-token)\" https://opax.vauco.no/health"
|
-H "Authorization: Bearer $TOKEN" \
|
||||||
check_service "GitHub" "gh auth status"
|
"$DIRECT_URL/health" 2>/dev/null || echo "000")
|
||||||
check_service "Git Remote" "git -C $OSVAUCO_DIR ls-remote origin refs/heads/main"
|
if [[ "$CR_HTTP" == "200" ]]; then
|
||||||
|
printf " %-20s ${GREEN}✦ OK${NC} (HTTP $CR_HTTP)\n" "Cloud Run (direkte)"
|
||||||
|
else
|
||||||
|
printf " %-20s ${RED}✗ FAIL${NC} (HTTP $CR_HTTP)\n" "Cloud Run (direkte)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# opax.vauco.no — domenesjekken — Phase 5
|
||||||
|
DOMAIN_HTTP=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||||
|
-H "Authorization: Bearer $TOKEN" \
|
||||||
|
"$DOMAIN_URL/health" 2>/dev/null || echo "000")
|
||||||
|
if [[ "$DOMAIN_HTTP" == "200" ]]; then
|
||||||
|
printf " %-20s ${GREEN}✦ OK${NC} (HTTP $DOMAIN_HTTP)\n" "opax.vauco.no"
|
||||||
|
else
|
||||||
|
printf " %-20s ${YELLOW}⚠ VENTER${NC} (HTTP $DOMAIN_HTTP) — Phase 5: IAP + domene ikke konfigurert ennå\n" "opax.vauco.no"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# GitHub + Git
|
||||||
|
printf " %-20s " "GitHub"
|
||||||
|
if gh auth status >/dev/null 2>&1; then printf "${GREEN}✦ OK${NC}\n"; else printf "${RED}✗ FAIL${NC}\n"; fi
|
||||||
|
|
||||||
|
printf " %-20s " "Git Remote"
|
||||||
|
if git -C "$OSVAUCO_DIR" ls-remote origin refs/heads/main >/dev/null 2>&1; then printf "${GREEN}✦ OK${NC}\n"; else printf "${RED}✗ FAIL${NC}\n"; fi
|
||||||
|
|
||||||
printf "${DIM}────────────────────────────────────────────────────────────${NC}\n"
|
printf "${DIM}────────────────────────────────────────────────────────────${NC}\n"
|
||||||
|
|
||||||
printf "${BOLD}SYSTEM${NC}\n"
|
printf "${BOLD}SYSTEM${NC}\n"
|
||||||
LOAD=$(cat /proc/loadavg | awk '{print $1}')
|
LOAD=$(awk '{print $1}' /proc/loadavg)
|
||||||
MEM=$(free -h | grep Mem | awk '{printf "%s/%s", $3, $2}')
|
MEM=$(free -h | awk '/Mem:/{printf "%s/%s", $3, $2}')
|
||||||
DISK=$(df -h / | tail -1 | awk '{print $5}')
|
DISK=$(df -h / | awk 'NR==2{print $5}')
|
||||||
printf " %-12s Load: %s · RAM: %s · /: %s\n" "Resources" "$LOAD" "$MEM" "$DISK"
|
printf " %-20s Load: %s · RAM: %s · /: %s\n" "Resources" "$LOAD" "$MEM" "$DISK"
|
||||||
printf " %-12s %s\n" "Uptime" "$(uptime -p | sed 's/up //')"
|
printf " %-20s %s\n" "Uptime" "$(uptime -p | sed 's/up //')"
|
||||||
|
|
||||||
printf "${DIM}────────────────────────────────────────────────────────────${NC}\n"
|
printf "${DIM}────────────────────────────────────────────────────────────${NC}\n"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user