mirror of
https://github.com/dartdavros/chatballs.git
synced 2026-10-05 09:14:58 +03:00
41 lines
1.5 KiB
Bash
41 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
# status.sh — observability: версия, состояние сервисов, profiles, последняя
|
|
# ошибка (SPEC-HUB-0019 §29). Installation-status (NEW/READY/…) — этап 2.
|
|
|
|
cmd_status() {
|
|
local inst rel applied target
|
|
inst="$(instance_dir)"
|
|
rel="$(release_dir)"
|
|
target="$(env_get "$(release_env_file)" CUSTOCRM_VERSION)"
|
|
applied="$(env_get "$(_state_file)" applied_version)"
|
|
|
|
if [[ "$CUSTOCRM_JSON" == "1" ]]; then
|
|
printf '{"status":"info","instance":%s,"release_dir":%s,"target_version":%s,"applied_version":%s}\n' \
|
|
"$(json_escape "$inst")" "$(json_escape "$rel")" \
|
|
"$(json_escape "${target:-unknown}")" "$(json_escape "${applied:-none}")"
|
|
return 0
|
|
fi
|
|
|
|
printf 'CustoCRM status\n'
|
|
printf ' instance dir: %s\n' "$inst"
|
|
printf ' release dir: %s\n' "$rel"
|
|
printf ' target version: %s\n' "${target:-unknown}"
|
|
printf ' applied version: %s\n' "${applied:-none}"
|
|
printf ' profiles: %s\n' "$(env_get "$(instance_env_file)" COMPOSE_PROFILES || echo none)"
|
|
|
|
if [[ -f "$(_state_file)" ]]; then
|
|
printf ' last applied at: %s\n' "$(env_get "$(_state_file)" applied_at)"
|
|
else
|
|
printf ' last applied at: (none)\n'
|
|
fi
|
|
|
|
if docker info >/dev/null 2>&1; then
|
|
printf '\nServices:\n'
|
|
run_compose ps 2>/dev/null || log_warn "compose ps failed (not deployed yet?)"
|
|
else
|
|
printf '\nServices: (docker daemon not reachable)\n'
|
|
fi
|
|
}
|
|
|
|
_state_file() { printf '%s/applied_release' "$(state_dir)"; }
|