34 lines
932 B
Bash
34 lines
932 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
# shellcheck source=lib.sh
|
|
. "${SCRIPT_DIR}/lib.sh"
|
|
# shellcheck source=preflight.sh
|
|
. "${SCRIPT_DIR}/preflight.sh"
|
|
# shellcheck source=repo-status.sh
|
|
. "${SCRIPT_DIR}/repo-status.sh"
|
|
|
|
qipai_diagnose() {
|
|
qipai_preflight || true
|
|
qipai_repo_status || true
|
|
|
|
qipai_info "disk usage:"
|
|
df -h "$APP_ROOT" 2>/dev/null || df -h /
|
|
|
|
qipai_info "service status summary:"
|
|
for service in nginx mysql emqx gitea; do
|
|
if command -v systemctl >/dev/null 2>&1; then
|
|
systemctl is-active --quiet "$service" 2>/dev/null && qipai_pass "${service}: active" || qipai_warn "${service}: inactive or missing"
|
|
fi
|
|
done
|
|
|
|
qipai_info "public endpoints:"
|
|
qipai_info "app health: ${QIPAI_API_ORIGIN}/app-api/health"
|
|
qipai_info "admin health: ${QIPAI_API_ORIGIN}/admin-api/health"
|
|
}
|
|
|
|
if [ "${1:-}" = "--run" ]; then
|
|
qipai_diagnose
|
|
fi
|