- 4-container stack: ClickHouse, platform (Rocky 9), bot-detector, dashboard - Platform builds sentinel on Rocky (CGO+libpcap native), correlator static - mod-reqin-log compiled with apxs on Rocky (matching RPM build target) - ClickHouse init script patches credentials for test env (sed-based) - 8-phase test runner: schema, traffic gen, pipeline, dashboard API, bot-detector, sentinel - All 13 checks pass, 3 non-blocking warnings (empty dicts, log paths) SQL schema fixes discovered during integration: - 02_dictionaries: IPv6CIDR → String (not a valid ClickHouse type) - 03_anubis_tables: dict_anubis_ua missing has_ip/rule_id/category attrs - 03_anubis_tables: dict_anubis_country FLAT() → COMPLEX_KEY_HASHED() (String key) - 09_audit_table: CODEC before DEFAULT → DEFAULT before CODEC Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
31 lines
925 B
Bash
Executable File
31 lines
925 B
Bash
Executable File
#!/bin/bash
|
|
# =============================================================================
|
|
# clickhouse-init.sh — Pre-process shared SQL files for integration testing
|
|
#
|
|
# Copies SQL from /initdb-src/ to /tmp, patches credentials, then executes.
|
|
# =============================================================================
|
|
set -e
|
|
|
|
SRC_DIR="/initdb-src"
|
|
TMP_DIR="/tmp/initdb-patched"
|
|
mkdir -p "$TMP_DIR"
|
|
|
|
for f in "$SRC_DIR"/*.sql; do
|
|
[ -f "$f" ] || continue
|
|
base=$(basename "$f")
|
|
echo "[init] Patching $base"
|
|
sed \
|
|
-e "s/USER 'admin'/USER 'default'/g" \
|
|
-e "s/PASSWORD 'CHANGE_ME'/PASSWORD ''/g" \
|
|
-e "s/PASSWORD 'ChangeMe'/PASSWORD ''/g" \
|
|
"$f" > "$TMP_DIR/$base"
|
|
done
|
|
|
|
for f in "$TMP_DIR"/*.sql; do
|
|
[ -f "$f" ] || continue
|
|
echo "[init] Executing $(basename "$f")"
|
|
clickhouse-client --multiquery < "$f"
|
|
done
|
|
|
|
echo "[init] All SQL files executed successfully"
|