Wiki/scripts/healthcheck.sh
Corentin JOGUET 668576cdc4 chore: initial commit — formation-hub conception phase
Conception complete (Phase 0) pour formation-hub Acadenice :

- 19 docs Merise Agile + UML + GitOps + plans (tests/deploy/ops/api)
  cf docs/00-readme.md pour l'index complet
- Stack Docker compose (Docmost + Baserow + Postgres + Redis + MinIO local FS)
  compose.yml + compose.staging.yml + compose.prod.yml
- CI/CD GitHub Actions skeleton (ci, deploy-staging, deploy-prod)
- Bridge service skeleton (Hono + TS + Biome + Vitest + zod + pino)
- Templates GitHub : PR + 3 issue types + CODEOWNERS + dependabot.yml
- Scripts ops : healthcheck, backup quotidien, smoke-test post-deploy
- LICENSE AGPL-3.0 + SECURITY.md + CONTRIBUTING.md + CHANGELOG.md
- Diagramme drawIO archi infra (XML importable dans diagrams.net)

Decisions structurelles enregistrees :
- Scope CFA + Agence avec entite PERSONNE pivot multi-roles (ADR-001)
- Stack composite Docmost AGPL + Baserow MIT + bridge custom (ADR-001)
- Path B : UX quasi-unified via Tiptap node-views custom (ADR-002)
- Monorepo trunk-based development (ADR-003)
- Postgres separe Docmost/Baserow (ADR-004)
- Bridge stack Node 22 + Hono (ADR-005)
- Repo neuf prefere a fork Docmost
- Prod-like des le jour 1 (pas MVP)
2026-05-07 12:16:19 +02:00

48 lines
1 KiB
Bash
Executable file

#!/usr/bin/env bash
# scripts/healthcheck.sh — verifie que la stack repond
set -euo pipefail
DOCMOST_URL="${DOCMOST_URL:-http://localhost:3000}"
BASEROW_URL="${BASEROW_URL:-http://localhost:8080}"
BRIDGE_URL="${BRIDGE_URL:-}"
TIMEOUT="${HEALTHCHECK_TIMEOUT:-10}"
red() { printf '\033[31m%s\033[0m\n' "$1"; }
green() { printf '\033[32m%s\033[0m\n' "$1"; }
check() {
local name="$1"
local url="$2"
if curl -sf --max-time "$TIMEOUT" -o /dev/null "$url"; then
green " OK $name : $url"
return 0
else
red " KO $name : $url"
return 1
fi
}
echo "Healthcheck (timeout ${TIMEOUT}s)..."
ok=0
total=0
((++total)) || true
check "Docmost " "$DOCMOST_URL" && ((++ok)) || true
((++total)) || true
check "Baserow " "$BASEROW_URL" && ((++ok)) || true
if [ -n "$BRIDGE_URL" ]; then
((++total)) || true
check "Bridge " "$BRIDGE_URL/api/health" && ((++ok)) || true
fi
echo ""
if [ "$ok" -eq "$total" ]; then
green "Healthcheck : $ok/$total OK"
exit 0
else
red "Healthcheck : $ok/$total OK"
exit 1
fi