Standalone-Arkindex-Coolify/scripts/50-verify.sh
nak0x 18064be674 Repo complet : scripts, templates, docs et durcissement secrets
- Ajout scripts/ reproduisant chaque étape (secrets, render config, up CLI,
  init Garage, bootstrap prod, admin, vérif E2E, adoption Coolify, backup)
- Templates envsubst (config.yml, garage.toml, cantaloupe.properties) + .example
- deploy.conf (config non-secrète : domaine, versions, uuids Coolify)
- docs/ : ARCHITECTURE, TROUBLESHOOTING (11 problèmes/fixes), RUNBOOK, SECURITY
- Makefile (raccourcis)
- .gitignore + retrait du suivi de .env/.secrets.env/config.yml/garage.toml
  (fichiers conservés sur disque ; secrets restent dans l'historique -> voir SECURITY.md)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 16:26:29 +02:00

45 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Vérifications end-to-end : HTTPS/API, S3 (hairpin), pipeline IIIF, état conteneurs, RAM.
# Usage: [ADMIN_PASS=... ] scripts/50-verify.sh
source "$(dirname "$0")/lib.sh"
load_secrets
echo "=== 1) HTTPS public + certificat ==="
curl -sS -o /dev/null -w " health -> HTTP %{http_code} (tls_verify=%{ssl_verify_result})\n" \
"https://${DOMAIN}/api/v1/health/"
if [ -n "${ADMIN_PASS:-}" ]; then
echo "=== 2) Login admin ==="
curl -sS -X POST "https://${DOMAIN}/api/v1/user/login/" -H 'Content-Type: application/json' \
-d "{\"email\":\"${ADMIN_EMAIL}\",\"password\":\"${ADMIN_PASS}\"}" \
-o /dev/null -w " login -> HTTP %{http_code}\n"
fi
echo "=== 3) S3 hairpin (backend write/read/delete via https://s3.${DOMAIN}) ==="
dexi ark-backend arkindex shell <<'PY' 2>&1 | tail -2
from arkindex.project.aws import s3
o=s3.Bucket("staging").Object("healthcheck.txt")
o.put(Body=b"ok"); print(" S3 read:", o.get()["Body"].read()); o.delete(); print(" S3 delete: ok")
PY
echo "=== 4) Pipeline IIIF (upload image de test -> Cantaloupe) ==="
TMP=$(mktemp -d)
docker run --rm -v "$TMP":/out alpine sh -c "apk add -q imagemagick imagemagick-jpeg && magick -size 400x300 xc:'#1e78c8' /out/p.jpg" >/dev/null 2>&1
docker run --rm --network ark -v "$TMP/p.jpg":/img.jpg:ro \
-e AWS_ACCESS_KEY_ID="$GK_ID" -e AWS_SECRET_ACCESS_KEY="$GK_SECRET" \
amazon/aws-cli --endpoint-url http://ark-garage:3900 --region local \
s3 cp /img.jpg s3://uploads/_verify/p.jpg >/dev/null 2>&1
curl -sS -o /dev/null -w " IIIF info.json -> HTTP %{http_code}\n" \
"https://uploads.iiif.${DOMAIN}/iiif/2/_verify%2Fp.jpg/info.json"
curl -sS -o /dev/null -w " IIIF render -> HTTP %{http_code}\n" \
"https://uploads.iiif.${DOMAIN}/iiif/2/_verify%2Fp.jpg/full/200,/0/default.jpg"
docker run --rm --network ark -e AWS_ACCESS_KEY_ID="$GK_ID" -e AWS_SECRET_ACCESS_KEY="$GK_SECRET" \
amazon/aws-cli --endpoint-url http://ark-garage:3900 --region local s3 rm s3://uploads/_verify/p.jpg >/dev/null 2>&1
rm -rf "$TMP"
echo "=== 5) Conteneurs ==="
docker ps --filter "name=ark-" --format ' {{.Names}} {{.Status}}' | sort
echo "=== 6) RAM ==="
free -h | awk 'NR==2{printf " used=%s free=%s dispo=%s\n",$3,$4,$7}'