Builds the customer-facing distribution: a curated distribution/ directory containing only what an end customer needs (production docker-compose.yml with no build: sections, install.sh/update.sh/uninstall.sh/healthcheck.sh/ backup.sh/restore.sh, a customer-facing CHANGELOG.md, and README/LICENSE/ NOTICE/THIRD_PARTY_LICENSES) — pushed as the initial content of the new public alleyviper/argus repo. install.sh: detects OS, validates Docker/Compose, fetches all deployment files, generates a secure DB password, creates the required Docker network, pulls images, starts the stack, waits for health, and rotates the default admin/admin credentials via the auth API — printing the generated password once at the end. update.sh/healthcheck.sh/backup.sh/restore.sh/uninstall.sh formalize what was previously ad-hoc README snippets into real, safe-by-default scripts (uninstall.sh keeps data unless --remove-data is explicitly passed and confirmed; restore.sh requires typed confirmation and documents that it targets a fresh install, not a live merge). Added a sync-distribution job to release.yml: after a successful release, mirrors distribution/ into the public repo and creates a matching (customer-facing, commit-log-free) release marker there. Needs a one-time setup step — a fine-grained PAT scoped to alleyviper/argus added as the ARGUS_PUBLIC_REPO_TOKEN secret — the job cleanly no-ops until that's added. Not yet done: GHCR package visibility (argus-secure-api/-ui/-nginx) is still private, which blocks a genuine end-to-end curl-install test from a clean, unauthenticated environment — deferred at the user's request until they flip it manually (GitHub does not expose this via API).
72 lines
2.4 KiB
Bash
Executable File
72 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# ARGUS health check — reports the status of every component.
|
|
#
|
|
# cd ~/argus && ./healthcheck.sh
|
|
#
|
|
set -euo pipefail
|
|
|
|
INSTALL_DIR="${ARGUS_INSTALL_DIR:-$HOME/argus}"
|
|
|
|
bold() { printf '\033[1m%s\033[0m\n' "$1"; }
|
|
ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; }
|
|
bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; }
|
|
fail() { printf ' \033[31m✗\033[0m %s\n' "$1" >&2; exit 1; }
|
|
|
|
[ -f "$INSTALL_DIR/docker-compose.yml" ] || fail "No ARGUS installation found at $INSTALL_DIR (set ARGUS_INSTALL_DIR if you installed elsewhere)."
|
|
cd "$INSTALL_DIR"
|
|
|
|
bold "ARGUS Health Check"
|
|
echo
|
|
|
|
EXIT_CODE=0
|
|
|
|
bold "Containers"
|
|
for svc in db valkey docker-socket-proxy api ui nginx; do
|
|
STATE="$(docker compose ps --format json "$svc" 2>/dev/null | grep -oP '"State"\s*:\s*"\K[^"]+' || echo "")"
|
|
HEALTH="$(docker compose ps --format json "$svc" 2>/dev/null | grep -oP '"Health"\s*:\s*"\K[^"]+' || echo "")"
|
|
if [ "$STATE" = "running" ] && { [ -z "$HEALTH" ] || [ "$HEALTH" = "healthy" ]; }; then
|
|
ok "$svc — running${HEALTH:+ ($HEALTH)}"
|
|
elif [ -z "$STATE" ]; then
|
|
bad "$svc — not found"
|
|
EXIT_CODE=1
|
|
else
|
|
bad "$svc — $STATE${HEALTH:+ ($HEALTH)}"
|
|
EXIT_CODE=1
|
|
fi
|
|
done
|
|
echo
|
|
|
|
bold "API"
|
|
API_HOST_PORT="$(grep -oP '^API_HOST_PORT=\K.*' .env 2>/dev/null || true)"
|
|
API_HOST_PORT="${API_HOST_PORT:-9080}"
|
|
HEALTH_JSON="$(curl -fsS "http://127.0.0.1:${API_HOST_PORT}/health" 2>/dev/null || true)"
|
|
if [ -n "$HEALTH_JSON" ]; then
|
|
VERSION="$(printf '%s' "$HEALTH_JSON" | grep -oP '"version"\s*:\s*"\K[^"]+' || echo "?")"
|
|
DB_STATUS="$(printf '%s' "$HEALTH_JSON" | grep -oP '"database"\s*:\s*"\K[^"]+' || echo "?")"
|
|
CACHE_STATUS="$(printf '%s' "$HEALTH_JSON" | grep -oP '"cache"\s*:\s*"\K[^"]+' || echo "?")"
|
|
ok "API reachable — version ${VERSION}, database: ${DB_STATUS}, cache: ${CACHE_STATUS}"
|
|
else
|
|
bad "API not reachable on http://127.0.0.1:${API_HOST_PORT}/health"
|
|
EXIT_CODE=1
|
|
fi
|
|
echo
|
|
|
|
UI_PORT="$(grep -oP '^UI_PORT=\K.*' .env 2>/dev/null || true)"
|
|
UI_PORT="${UI_PORT:-81}"
|
|
bold "Admin panel"
|
|
if curl -fsSk -o /dev/null "https://127.0.0.1:${UI_PORT}" 2>/dev/null; then
|
|
ok "Reachable at https://localhost:${UI_PORT}"
|
|
else
|
|
bad "Not reachable at https://localhost:${UI_PORT}"
|
|
EXIT_CODE=1
|
|
fi
|
|
|
|
echo
|
|
if [ "$EXIT_CODE" = 0 ]; then
|
|
bold "All checks passed."
|
|
else
|
|
bold "One or more checks failed — see above. 'docker compose logs <service>' for details."
|
|
fi
|
|
exit "$EXIT_CODE"
|