sync @ 88a1d74

This commit is contained in:
2026-10-12 21:10:45 +07:00
parent 64c60f99c2
commit ec9bf8219f
7 changed files with 127 additions and 16 deletions
+29 -9
View File
@@ -8,7 +8,8 @@
#
# Yang diperiksa:
# A. Object storage : endpoint terjangkau, bucket ada, tulis+baca berhasil
# B. Nessie : /api/v2/config, default branch, endpoint Iceberg REST /iceberg/v1/config
# B. Nessie : /api/v2/config, default branch, endpoint Iceberg REST <prefix>/v1/config
# (prefix dari NESSIE_ICEBERG_PREFIX, default /iceberg)
# C. Version store : database `nessie` + tabel Nessie di PostgreSQL (JDBC2)
# D. Kontrak & antarmuka:
# D1 (milik Phase 2) : warehouse & endpoint S3 pada Nessie (compose) → FAIL bila salah
@@ -42,6 +43,7 @@ sicabe_load_env "${SCRIPT_DIR}" "$@"
if [[ -n "${SICABE_BUNDLE_DIR:-}" ]]; then CONFIG_DIR="${SICABE_BUNDLE_DIR}/config"; else CONFIG_DIR="${SCRIPT_DIR}/config"; fi
S3_ENDPOINT="${S3_ENDPOINT:-http://minio:9000}"
S3_SCHEME="${S3_ENDPOINT%%://*}" # http | https — dipakai uji kesehatan host
S3_REGION="${S3_REGION:-us-east-1}"
S3_ACCESS_KEY="${S3_ACCESS_KEY:-${MINIO_ROOT_USER:-minioadmin}}"
S3_SECRET_KEY="${S3_SECRET_KEY:-${MINIO_ROOT_PASSWORD:-}}"
@@ -55,6 +57,8 @@ NESSIE_PORT="${NESSIE_PORT:-12120}"
# 19120). Selebihnya (nama service `nessie:19120` / single-host) → host:port terbit (NESSIE_PORT).
NESSIE_HOST_API="$(sicabe_host_url NESSIE_URL NESSIE_HOST "${NESSIE_PORT:-12120}")"
NESSIE_DB="${NESSIE_DB:-nessie}"
# Prefix REST Iceberg Nessie (mis. `/iceberg`); ubah bila layanan existing memakai prefix lain.
ICEBERG_PREFIX="${NESSIE_ICEBERG_PREFIX:-/iceberg}"
# Mode --deep: ikut menguji KONSUMEN (Trino) — komponennya harus sudah ada (fase 3+).
DEEP=0
@@ -79,6 +83,20 @@ fail() { echo -e " ${FAIL} $1"; FAIL_N=$((FAIL_N + 1)); FAIL_MSGS+=("$1"); }
warn() { echo -e " ${WARN} $1"; WARN_N=$((WARN_N + 1)); }
skip() { echo -e " ${YELLOW}[SKIP]${NC} $1"; SKIP_N=$((SKIP_N + 1)); }
# Kode HTTP untuk <url> (000 = koneksi gagal/timeout). Dipakai agar pesan FAIL
# menampilkan PENYEBAB (404/401/500/000), bukan hanya "tidak merespon".
http_code() { curl -s -o /dev/null -w '%{http_code}' --max-time 10 "$1" 2>/dev/null || echo 000; }
code_hint() {
case "$1" in
000) echo "tidak terjangkau (koneksi/DNS/timeout) — cek port, alamat, jaringan";;
401|403) echo "butuh autentikasi — Nessie existing mungkin memakai bearer token";;
404) echo "path tidak ada — versi Nessie lama / Iceberg REST belum aktif (butuh warehouse+object store) / proxy tak merutekan path ini";;
429) echo "rate-limited oleh proxy/edge";;
500|502|503|504) echo "error di server/proxy — cek konfigurasi Nessie (warehouse/object store) atau proxy";;
*) echo "HTTP $1";;
esac
}
container_running() {
docker ps --format "{{.Names}}" 2>/dev/null | grep -q "^$1$"
}
@@ -107,14 +125,14 @@ check_object_storage() {
# S3_ENDPOINT umumnya hanya terjangkau dari jaringan Docker (mis.
# http://minio:9000) → uji keterjangkauan dilakukan dari container (uji mc).
# Di host kita cek port publik MinIO saja (informatif, bukan gate).
local host_ep="$(sicabe_local_url http MINIO_HOST "${MINIO_PORT:-12900}")"
local host_ep="$(sicabe_local_url "${S3_SCHEME:-http}" MINIO_HOST "${MINIO_PORT:-12900}")"
local host_code
host_code=$(curl -sk -o /dev/null -w "%{http_code}" --max-time 8 \
"${host_ep}/minio/health/live" 2>/dev/null || true)
if [[ "${host_code}" == "200" ]]; then
pass "Storage terjangkau dari host: ${host_ep}"
else
warn "Storage tidak terjangkau dari host (${host_ep}) — normal bila memakai S3 eksternal"
warn "Storage tidak terjangkau dari host (${host_ep}) — normal bila memakai S3 eksternal [HTTP ${host_code:-000} — $(code_hint "${host_code:-000}")]"
fi
if ! docker image inspect "${MC_IMAGE}" >/dev/null 2>&1; then
@@ -163,10 +181,11 @@ fi')
check_nessie() {
echo -e "${BOLD}B. Nessie — ${NESSIE_URL} (API host: ${NESSIE_HOST_API})${NC}"
local cfg
local cfg code
cfg=$(curl -sf --max-time 10 "${NESSIE_HOST_API}/api/v2/config" 2>/dev/null || echo "")
if [[ -z "${cfg}" ]]; then
fail "Nessie REST /api/v2/config tidak merespon di ${NESSIE_HOST_API}"
code="$(http_code "${NESSIE_HOST_API}/api/v2/config")"
fail "Nessie REST /api/v2/config tidak merespon di ${NESSIE_HOST_API} [HTTP ${code} — $(code_hint "${code}")]"
return 1
fi
pass "Nessie REST v2 aktif"
@@ -177,11 +196,12 @@ print(' defaultBranch =', d.get('defaultBranch'))
print(' specVersion =', d.get('specVersion'))" 2>/dev/null || true
local iceberg_cfg
iceberg_cfg=$(curl -sf --max-time 10 "${NESSIE_HOST_API}/iceberg/v1/config" 2>/dev/null || echo "")
iceberg_cfg=$(curl -sf --max-time 10 "${NESSIE_HOST_API}${ICEBERG_PREFIX}/v1/config" 2>/dev/null || echo "")
if [[ -n "${iceberg_cfg}" ]]; then
pass "Endpoint Iceberg REST (/iceberg) aktif (dipakai Sling & StarRocks)"
pass "Endpoint Iceberg REST (${ICEBERG_PREFIX}) aktif (dipakai Sling & StarRocks)"
else
fail "Endpoint Iceberg REST ${NESSIE_HOST_API}/iceberg tidak merespon"
code="$(http_code "${NESSIE_HOST_API}${ICEBERG_PREFIX}/v1/config")"
fail "Endpoint Iceberg REST ${NESSIE_HOST_API}${ICEBERG_PREFIX} tidak merespon [HTTP ${code} — $(code_hint "${code}")]"
fi
local branch
@@ -189,7 +209,7 @@ print(' specVersion =', d.get('specVersion'))" 2>/dev/null || true
if [[ "${branch}" == "200" ]]; then
pass "Branch 'main' tersedia"
else
warn "Branch 'main' tidak merespon 200 (HTTP ${branch}) — katalog mungkin masih kosong"
warn "Branch 'main' tidak merespon 200 [HTTP ${branch} — $(code_hint "${branch}")] — katalog mungkin masih kosong"
fi
}