Initial project source
这个提交包含在:
@@ -0,0 +1,26 @@
|
||||
# DataGov M1 real POC runtime
|
||||
|
||||
This directory contains only disposable, DataGov-owned M1 proof-of-concept
|
||||
runtime definitions and test harnesses. It does not contain production
|
||||
adapters or M2 business code.
|
||||
|
||||
## Hard boundaries
|
||||
|
||||
- Every Compose project starts with `aixun-datagov-poc-`.
|
||||
- Every container, network, and volume starts with
|
||||
`aixun-datagov-poc-`.
|
||||
- Every container has `com.aixun.project=aixun-datagov` and
|
||||
`com.aixun.scope=poc` labels.
|
||||
- Host ports are restricted to the component ranges reserved by D-020.
|
||||
- No file in this directory may refer to, mount, connect to, or operate the
|
||||
`aixun-datagov-local`, `aixun-admin-local`, `openmetadata-docker`, or any
|
||||
other project runtime.
|
||||
- Image tags are exact. `latest` is rejected by preflight.
|
||||
- Runtime secrets live only in ignored `*.secret` files with mode `0600`.
|
||||
Evidence records secret reference names, never secret values.
|
||||
- Compose `down -v`, global prune, fuzzy cleanup, and volume deletion are not
|
||||
provided. Stopping a POC preserves its DataGov-owned volumes.
|
||||
|
||||
Run `common/preflight.sh` before the first `docker compose up` for each POC.
|
||||
Use `common/capture-resource-snapshot.sh` after the component is ready and
|
||||
before it is stopped.
|
||||
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
evidence_dir="$repo_root/evidence/M1/isolation-final"
|
||||
initial_snapshot="$repo_root/evidence/M1/POC-VERSION-001/isolation-before.tsv"
|
||||
mkdir -p "$evidence_dir"
|
||||
|
||||
"$repo_root/script/datagov/poc/common/capture-isolation-baseline.sh" \
|
||||
"$evidence_dir/other-projects"
|
||||
|
||||
{
|
||||
printf 'name\tstatus\tcompose_project\timage\tnetworks\tvolumes\tports\n'
|
||||
while IFS= read -r container_id; do
|
||||
docker inspect --format '{{.Name}}|{{.State.Status}}|{{index .Config.Labels "com.docker.compose.project"}}|{{.Config.Image}}|{{range $name, $_ := .NetworkSettings.Networks}}{{$name}},{{end}}|{{range .Mounts}}{{if eq .Type "volume"}}{{.Name}},{{end}}{{end}}|{{range $port, $bindings := .HostConfig.PortBindings}}{{$port}}={{range $bindings}}{{.HostIp}}:{{.HostPort}},{{end}}{{end}}' "$container_id" \
|
||||
| sed 's#^/##' | tr '|' '\t'
|
||||
done < <(docker ps -aq --filter name='^aixun-datagov-poc-' | sort)
|
||||
} >"$evidence_dir/poc-containers.tsv"
|
||||
|
||||
docker network ls --format '{{.Name}}\t{{.Driver}}\t{{.Scope}}' \
|
||||
| awk '$1 ~ /^aixun-datagov-poc-/' \
|
||||
| sort >"$evidence_dir/poc-networks.tsv"
|
||||
|
||||
docker volume ls --format '{{.Name}}\t{{.Driver}}' \
|
||||
| awk '$1 ~ /^aixun-datagov-poc-/' \
|
||||
| sort >"$evidence_dir/poc-volumes.tsv"
|
||||
|
||||
docker image ls --format '{{.Repository}}:{{.Tag}}\t{{.ID}}\t{{.Size}}' \
|
||||
| awk '$1 ~ /^aixun-datagov\/poc-/' \
|
||||
| sort >"$evidence_dir/poc-local-images.tsv"
|
||||
|
||||
{
|
||||
printf 'port\tlistener\n'
|
||||
lsof -nP -iTCP:31000-35199 -sTCP:LISTEN 2>/dev/null \
|
||||
| awk 'NR > 1 { port=$9; sub(/^.*:/, "", port); printf "%s\t%s\n", port, $0 }' \
|
||||
|| true
|
||||
} >"$evidence_dir/poc-port-listeners.tsv"
|
||||
|
||||
running_count=$(docker ps --format '{{.Names}}' \
|
||||
| awk '$1 ~ /^aixun-datagov-poc-/' \
|
||||
| wc -l | tr -d ' ')
|
||||
listener_count=$(awk 'NR > 1 { count++ } END { print count + 0 }' \
|
||||
"$evidence_dir/poc-port-listeners.tsv")
|
||||
|
||||
if [[ "$running_count" != 0 || "$listener_count" != 0 ]]; then
|
||||
printf 'FAIL running_poc_containers=%s poc_range_listeners=%s\n' \
|
||||
"$running_count" "$listener_count" >"$evidence_dir/result.txt"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if awk -F '\t' 'NR > 1 && ($1 !~ /^aixun-datagov-poc-/ || $3 !~ /^aixun-datagov-poc-/) { exit 1 }' \
|
||||
"$evidence_dir/poc-containers.tsv"; then
|
||||
ownership_status=PASS
|
||||
else
|
||||
ownership_status=FAIL
|
||||
fi
|
||||
|
||||
normalize_other_project_identity() {
|
||||
local snapshot=$1
|
||||
local output=$2
|
||||
{
|
||||
printf 'container_id\tname\tcompose_project\tworking_dir\tnetworks\tbind_count\tnamed_volumes\n'
|
||||
while IFS=$'\t' read -r container_id name _created _status compose_project working_dir networks volumes; do
|
||||
[[ "$container_id" != container_id ]] || continue
|
||||
[[ "$compose_project" != aixun-datagov-local ]] || continue
|
||||
bind_count=$(tr ',' '\n' <<<"$volumes" | awk '$0 == "bind" {count++} END {print count + 0}')
|
||||
named_volumes=$(tr ',' '\n' <<<"$volumes" \
|
||||
| awk 'NF && $0 != "bind"' \
|
||||
| sort \
|
||||
| paste -sd ',' -)
|
||||
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
|
||||
"$container_id" "$name" "$compose_project" "$working_dir" \
|
||||
"$networks" "$bind_count" "$named_volumes"
|
||||
done <"$snapshot"
|
||||
} >"$output"
|
||||
}
|
||||
|
||||
normalize_other_project_identity "$initial_snapshot" \
|
||||
"$evidence_dir/other-project-identity.initial.txt"
|
||||
normalize_other_project_identity \
|
||||
"$evidence_dir/other-projects/isolation-before.tsv" \
|
||||
"$evidence_dir/other-project-identity.final.txt"
|
||||
|
||||
if cmp -s "$evidence_dir/other-project-identity.initial.txt" \
|
||||
"$evidence_dir/other-project-identity.final.txt"; then
|
||||
other_project_identity=PASS
|
||||
else
|
||||
other_project_identity=CHANGED_READ_ONLY_REVIEW_REQUIRED
|
||||
fi
|
||||
|
||||
{
|
||||
printf 'PASS running_poc_containers=%s poc_range_listeners=%s\n' \
|
||||
"$running_count" "$listener_count"
|
||||
printf '%s poc_container_and_project_prefix_check\n' "$ownership_status"
|
||||
printf '%s preexisting_admin_and_openmetadata_identity_compare\n' \
|
||||
"$other_project_identity"
|
||||
printf 'NOTE aixun-datagov-local was excluded from identity comparison because M0 ran concurrently and this task only observed it read-only\n'
|
||||
} >"$evidence_dir/result.txt"
|
||||
|
||||
if [[ "$ownership_status" != PASS ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
find "$evidence_dir" -type f ! -name SHA256SUMS -print0 \
|
||||
| sort -z \
|
||||
| xargs -0 shasum -a 256 >"$evidence_dir/SHA256SUMS"
|
||||
|
||||
cat "$evidence_dir/result.txt"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "usage: $0 <evidence-directory>" >&2
|
||||
exit 64
|
||||
fi
|
||||
|
||||
evidence_dir=$1
|
||||
mkdir -p "$evidence_dir"
|
||||
|
||||
snapshot_file="$evidence_dir/isolation-before.tsv"
|
||||
ports_file="$evidence_dir/ports-before.tsv"
|
||||
environment_file="$evidence_dir/environment.txt"
|
||||
|
||||
{
|
||||
printf 'container_id\tname\tcreated\tstatus\tcompose_project\tworking_dir\tnetworks\tvolumes\n'
|
||||
while IFS= read -r container_id; do
|
||||
docker inspect --format '{{.Id}}|{{.Name}}|{{.Created}}|{{.State.Status}}|{{index .Config.Labels "com.docker.compose.project"}}|{{index .Config.Labels "com.docker.compose.project.working_dir"}}|{{range $name, $_ := .NetworkSettings.Networks}}{{$name}},{{end}}|{{range .Mounts}}{{if eq .Type "volume"}}{{.Name}}{{else}}{{.Type}}{{end}},{{end}}' "$container_id" | tr '|' '\t'
|
||||
done < <(
|
||||
{
|
||||
docker ps -aq --filter label=com.docker.compose.project=aixun-datagov-local
|
||||
docker ps -aq --filter label=com.docker.compose.project=aixun-admin-local
|
||||
docker ps -aq --filter label=com.docker.compose.project=openmetadata-docker
|
||||
} | sort -u
|
||||
)
|
||||
} >"$snapshot_file"
|
||||
|
||||
{
|
||||
printf 'port\tlistener\n'
|
||||
lsof -nP -iTCP:31000-35199 -sTCP:LISTEN 2>/dev/null \
|
||||
| awk 'NR > 1 { port=$9; sub(/^.*:/, "", port); printf "%s\t%s\n", port, $0 }' \
|
||||
|| true
|
||||
} >"$ports_file"
|
||||
|
||||
{
|
||||
date -u '+captured_at_utc=%Y-%m-%dT%H:%M:%SZ'
|
||||
printf 'worktree=%s\n' "$(pwd -P)"
|
||||
printf 'git_head=%s\n' "$(git rev-parse HEAD)"
|
||||
printf 'git_branch=%s\n' "$(git branch --show-current)"
|
||||
uname -a
|
||||
docker version --format 'docker_client={{.Client.Version}} docker_server={{.Server.Version}}'
|
||||
docker compose version
|
||||
docker info --format 'docker_cpus={{.NCPU}} docker_memory_bytes={{.MemTotal}} storage_driver={{.Driver}}'
|
||||
df -h .
|
||||
} >"$environment_file"
|
||||
|
||||
shasum -a 256 "$snapshot_file" "$ports_file" "$environment_file" >"$evidence_dir/isolation-before.sha256"
|
||||
echo "PASS: isolation baseline saved under $evidence_dir"
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 2 ]]; then
|
||||
echo "usage: $0 <compose-project> <evidence-directory>" >&2
|
||||
exit 64
|
||||
fi
|
||||
|
||||
compose_project=$1
|
||||
evidence_dir=$2
|
||||
mkdir -p "$evidence_dir"
|
||||
|
||||
container_ids=()
|
||||
while IFS= read -r container_id; do
|
||||
container_ids+=("$container_id")
|
||||
done < <(docker ps -q --filter "label=com.docker.compose.project=$compose_project")
|
||||
if (( ${#container_ids[@]} == 0 )); then
|
||||
echo "FAIL: no running containers for $compose_project" >&2
|
||||
exit 65
|
||||
fi
|
||||
|
||||
docker ps --no-trunc --filter "label=com.docker.compose.project=$compose_project" \
|
||||
--format '{{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}' \
|
||||
>"$evidence_dir/containers.tsv"
|
||||
docker stats --no-stream --format '{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}' \
|
||||
"${container_ids[@]}" >"$evidence_dir/docker-stats.tsv"
|
||||
|
||||
{
|
||||
printf 'container\timage_id\trepo_digest\n'
|
||||
for container_id in "${container_ids[@]}"; do
|
||||
container_name=$(docker inspect --format '{{.Name}}' "$container_id")
|
||||
image_id=$(docker inspect --format '{{.Image}}' "$container_id")
|
||||
repo_digest=$(docker image inspect --format '{{join .RepoDigests ","}}' "$image_id")
|
||||
printf '%s\t%s\t%s\n' "$container_name" "$image_id" "$repo_digest"
|
||||
done
|
||||
} >"$evidence_dir/image-digests.tsv"
|
||||
|
||||
shasum -a 256 "$evidence_dir/containers.tsv" "$evidence_dir/docker-stats.tsv" "$evidence_dir/image-digests.tsv" \
|
||||
>"$evidence_dir/resource-snapshot.sha256"
|
||||
echo "PASS: resource snapshot saved under $evidence_dir"
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
||||
repo_root=$(cd -- "$script_dir/../../../.." && pwd)
|
||||
output="$repo_root/evidence/M1/SHA256SUMS"
|
||||
temp_output=$(mktemp)
|
||||
trap 'rm -f "$temp_output"' EXIT
|
||||
|
||||
while IFS= read -r -d '' absolute_file; do
|
||||
evidence_file=${absolute_file#"$repo_root"/}
|
||||
[[ "$evidence_file" != evidence/M1/SHA256SUMS ]] || continue
|
||||
checksum=$(shasum -a 256 "$absolute_file" | awk '{print $1}')
|
||||
printf '%s %s\n' "$checksum" "$evidence_file" >>"$temp_output"
|
||||
done < <(find "$repo_root/evidence/M1" -type f -print0)
|
||||
|
||||
LC_ALL=C sort "$temp_output" >"$output"
|
||||
(cd "$repo_root" && shasum -a 256 -c evidence/M1/SHA256SUMS >/dev/null)
|
||||
printf 'PASS evidence_manifest_entries=%s\n' "$(wc -l <"$output" | tr -d ' ')"
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 3 ]]; then
|
||||
echo "usage: $0 <compose-file> <compose-project> <component>" >&2
|
||||
exit 64
|
||||
fi
|
||||
|
||||
compose_file=$1
|
||||
compose_project=$2
|
||||
component=$3
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
|
||||
case "$compose_project" in
|
||||
aixun-datagov-poc-*) ;;
|
||||
*)
|
||||
echo "FAIL: Compose project must start with aixun-datagov-poc-" >&2
|
||||
exit 65
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$component" in
|
||||
seatunnel) min_port=31000; max_port=31099 ;;
|
||||
dolphinscheduler) min_port=32000; max_port=32099 ;;
|
||||
openmetadata) min_port=33000; max_port=33099 ;;
|
||||
hive) min_port=34000; max_port=34099 ;;
|
||||
doris) min_port=35000; max_port=35199 ;;
|
||||
*)
|
||||
echo "FAIL: unsupported component: $component" >&2
|
||||
exit 66
|
||||
;;
|
||||
esac
|
||||
|
||||
compose_abs=$(cd "$(dirname "$compose_file")" && pwd -P)/$(basename "$compose_file")
|
||||
case "$compose_abs" in
|
||||
"$repo_root"/script/datagov/poc/*) ;;
|
||||
*)
|
||||
echo "FAIL: Compose file must be inside this worktree's script/datagov/poc" >&2
|
||||
exit 67
|
||||
;;
|
||||
esac
|
||||
|
||||
rendered=$(mktemp)
|
||||
trap 'rm -f "$rendered"' EXIT
|
||||
docker compose --project-name "$compose_project" --file "$compose_abs" config --format json >"$rendered"
|
||||
|
||||
if rg -n -i 'aixun-admin|openmetadata-docker|/Users/apple/Documents/AiXun-DataGov|public[^a-zA-Z0-9_-]+namespace|:[[:space:]]*latest([@[:space:]]|$)' "$rendered"; then
|
||||
echo "FAIL: rendered Compose contains a forbidden project reference, public namespace, or latest tag" >&2
|
||||
exit 68
|
||||
fi
|
||||
|
||||
jq -e '
|
||||
[.services[]
|
||||
| (.container_name | startswith("aixun-datagov-poc-"))
|
||||
and (.labels["com.aixun.project"] == "aixun-datagov")
|
||||
and (.labels["com.aixun.scope"] == "poc")]
|
||||
| all
|
||||
' "$rendered" >/dev/null || {
|
||||
echo "FAIL: every service needs the POC container prefix and required labels" >&2
|
||||
exit 69
|
||||
}
|
||||
|
||||
published_ports=''
|
||||
while IFS= read -r published_port; do
|
||||
if (( published_port < min_port || published_port > max_port )); then
|
||||
echo "FAIL: host port $published_port is outside $component range $min_port-$max_port" >&2
|
||||
exit 70
|
||||
fi
|
||||
if lsof -nP -iTCP:"$published_port" -sTCP:LISTEN >/dev/null 2>&1; then
|
||||
echo "FAIL: host port $published_port is already occupied" >&2
|
||||
exit 71
|
||||
fi
|
||||
published_ports="${published_ports}${published_ports:+ }${published_port}"
|
||||
done < <(jq -r '.services[]?.ports[]?.published // empty' "$rendered" | sort -n -u)
|
||||
|
||||
jq -e '
|
||||
([((.networks // {}) | to_entries[]) | .value.name | startswith("aixun-datagov-poc-")] | all)
|
||||
and
|
||||
([((.volumes // {}) | to_entries[]) | .value.name | startswith("aixun-datagov-poc-")] | all)
|
||||
' "$rendered" >/dev/null || {
|
||||
echo "FAIL: explicit network and volume names must start with aixun-datagov-poc-" >&2
|
||||
exit 72
|
||||
}
|
||||
|
||||
if docker ps -a --format '{{.Names}}' | rg -q "^${compose_project}(-|$)"; then
|
||||
echo "FAIL: pre-existing containers overlap project prefix $compose_project" >&2
|
||||
exit 73
|
||||
fi
|
||||
|
||||
echo "PASS: $component POC Compose is isolated; ports=${published_ports:-none}; project=$compose_project"
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
||||
repo_root=$(cd -- "$script_dir/../../../.." && pwd)
|
||||
output_file=${M1_SECRET_SCAN_OUTPUT:-"$repo_root/evidence/M1/secret-redaction-final.txt"}
|
||||
scan_roots=("$repo_root/evidence/M1" "$repo_root/script/datagov/poc")
|
||||
match_count=0
|
||||
checked_values=0
|
||||
|
||||
{
|
||||
printf 'Current text-secret exact-value scan\n'
|
||||
printf 'generated_at_utc=%s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
|
||||
|
||||
while IFS= read -r secret_file; do
|
||||
while IFS= read -r secret_value || [[ -n "$secret_value" ]]; do
|
||||
[[ -n "$secret_value" ]] || continue
|
||||
((checked_values += 1))
|
||||
if rg -a -F -l --glob '!**/local/**' --glob '!secret-redaction-final.txt' \
|
||||
-- "$secret_value" "${scan_roots[@]}" >/dev/null 2>&1; then
|
||||
((match_count += 1))
|
||||
printf 'FAIL source_ref=%s value_index=%s\n' \
|
||||
"${secret_file#"$repo_root"/}" "$checked_values"
|
||||
fi
|
||||
done <"$secret_file"
|
||||
done < <(
|
||||
find "$repo_root/script/datagov/poc" -path '*/local/*' -type f \
|
||||
\( -name '*.secret' -o -name '*.cookie' -o -name '*.netrc' \) \
|
||||
! -name '*-username.secret' \
|
||||
-size -128k -print | sort
|
||||
)
|
||||
|
||||
printf 'checked_nonempty_values=%s\n' "$checked_values"
|
||||
printf 'matches=%s\n' "$match_count"
|
||||
if [[ "$match_count" == 0 ]]; then
|
||||
printf 'PASS current text secret values are absent from reviewable POC sources and evidence\n'
|
||||
printf 'PASS OpenMetadata binary JWT key material is covered by its component-local exact-file scan\n'
|
||||
else
|
||||
printf 'FAIL current secret value matches exist\n'
|
||||
fi
|
||||
} >"$output_file"
|
||||
|
||||
cat "$output_file"
|
||||
[[ "$match_count" == 0 ]]
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
||||
repo_root=$(cd -- "$script_dir/../../../.." && pwd)
|
||||
output=${M1_VERIFICATION_OUTPUT:-"$repo_root/evidence/M1/verification-final.txt"}
|
||||
temp_dir=$(mktemp -d)
|
||||
trap 'rm -rf "$temp_dir"' EXIT
|
||||
|
||||
{
|
||||
printf 'M1 final static verification\n'
|
||||
printf 'generated_at_utc=%s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
|
||||
|
||||
shell_count=0
|
||||
while IFS= read -r shell_file; do
|
||||
bash -n "$shell_file"
|
||||
((shell_count += 1))
|
||||
done < <(find "$repo_root/script/datagov/poc" -type f -name '*.sh' | sort)
|
||||
printf 'PASS bash_syntax_files=%s\n' "$shell_count"
|
||||
|
||||
compose_count=0
|
||||
while IFS= read -r compose_file; do
|
||||
rendered="$temp_dir/compose-${compose_count}.json"
|
||||
docker compose --file "$compose_file" config --format json >"$rendered"
|
||||
jq -e '
|
||||
[.services[]
|
||||
| (.container_name | startswith("aixun-datagov-poc-"))
|
||||
and (.labels["com.aixun.project"] == "aixun-datagov")
|
||||
and (.labels["com.aixun.scope"] == "poc")]
|
||||
| all
|
||||
' "$rendered" >/dev/null
|
||||
if rg -n -i 'aixun-admin|openmetadata-docker|/\.codex/worktrees/|:[[:space:]]*latest([@[:space:]]|$)' "$rendered" >/dev/null; then
|
||||
printf 'FAIL forbidden rendered Compose content: %s\n' "$compose_file"
|
||||
exit 1
|
||||
fi
|
||||
((compose_count += 1))
|
||||
done < <(find "$repo_root/script/datagov/poc" -type f -name 'docker-compose.yml' | sort)
|
||||
printf 'PASS compose_render_and_labels=%s\n' "$compose_count"
|
||||
|
||||
json_count=0
|
||||
while IFS= read -r json_file; do
|
||||
jq empty "$json_file"
|
||||
((json_count += 1))
|
||||
done < <(find "$repo_root/evidence/M1" "$repo_root/start-docs/数据治理平台需求规格说明书_v1.0" \
|
||||
-type f -name '*.json' | sort)
|
||||
printf 'PASS json_syntax_files=%s\n' "$json_count"
|
||||
|
||||
decision_counts=$(awk -F '|' '
|
||||
$2 ~ /^ D-[0-9]/ {
|
||||
status=$4
|
||||
gsub(/^[[:space:]]+|[[:space:]]+$/, "", status)
|
||||
if (status == "OPEN" || status == "PROPOSED" || status == "BLOCKED_BY_POC" || status == "CLOSED") {
|
||||
total++
|
||||
counts[status]++
|
||||
}
|
||||
}
|
||||
END {printf "total=%d blocked=%d closed=%d", total, counts["BLOCKED_BY_POC"], counts["CLOSED"]}
|
||||
' "$repo_root/start-docs/数据治理平台需求规格说明书_v1.0/11-决策台账.md")
|
||||
if [[ "$decision_counts" != 'total=31 blocked=0 closed=31' ]]; then
|
||||
printf 'FAIL decision_counts %s\n' "$decision_counts"
|
||||
exit 1
|
||||
fi
|
||||
printf 'PASS decision_counts %s\n' "$decision_counts"
|
||||
|
||||
adr_count=$(find "$repo_root/start-docs/数据治理平台需求规格说明书_v1.0/ADR" \
|
||||
-type f -name 'ADR-*.md' | wc -l | tr -d ' ')
|
||||
if [[ "$adr_count" != 16 ]]; then
|
||||
printf 'FAIL adr_count=%s\n' "$adr_count"
|
||||
exit 1
|
||||
fi
|
||||
printf 'PASS adr_count=%s\n' "$adr_count"
|
||||
|
||||
git -C "$repo_root" diff --check -- . ':!evidence/M1'
|
||||
printf 'PASS read_only_source_diff_check raw_runtime_evidence_excluded\n'
|
||||
} >"$output"
|
||||
|
||||
cat "$output"
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
manifest="$repo_root/start-docs/数据治理平台需求规格说明书_v1.0/manifest.json"
|
||||
manifest_dir=$(dirname "$manifest")
|
||||
output="$repo_root/evidence/M1/frozen-inputs-final.txt"
|
||||
failures=0
|
||||
|
||||
{
|
||||
printf 'Frozen source SHA-256 verification\n'
|
||||
while IFS=$'\t' read -r relative_path expected; do
|
||||
source_path=$(cd "$manifest_dir" && cd "$(dirname "$relative_path")" && pwd -P)/$(basename "$relative_path")
|
||||
actual=$(shasum -a 256 "$source_path" | awk '{print $1}')
|
||||
if [[ "$actual" == "$expected" ]]; then
|
||||
status=PASS
|
||||
else
|
||||
status=FAIL
|
||||
((failures += 1))
|
||||
fi
|
||||
printf '%s\t%s\texpected=%s\tactual=%s\n' \
|
||||
"$status" "${source_path#"$repo_root"/}" "$expected" "$actual"
|
||||
done < <(jq -r '.sources[] | [.path, .sha256] | @tsv' "$manifest")
|
||||
printf 'failures=%s\n' "$failures"
|
||||
} >"$output"
|
||||
|
||||
cat "$output"
|
||||
[[ "$failures" == 0 ]]
|
||||
@@ -0,0 +1 @@
|
||||
local/
|
||||
@@ -0,0 +1,6 @@
|
||||
FROM apache/dolphinscheduler-standalone-server:3.4.2@sha256:485a1b37dd1c4088c8c8335f9fccbd229e5e703c32e21f318eb00cbb60b1af9d
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends psmisc \
|
||||
&& command -v pstree \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
script_dir="$repo_root/script/datagov/poc/dolphinscheduler"
|
||||
local_dir="$script_dir/local"
|
||||
evidence_dir="$repo_root/evidence/M1/POC-UI-SSO-001/dolphinscheduler"
|
||||
base_url=http://127.0.0.1:32045/dolphinscheduler
|
||||
cookie_file=/tmp/aixun-datagov-poc-ds-ui-bootstrap.cookie
|
||||
raw_file=/tmp/aixun-datagov-poc-ds-ui-bootstrap.json
|
||||
trap 'unlink "$cookie_file" 2>/dev/null || true; unlink "$raw_file" 2>/dev/null || true' EXIT
|
||||
mkdir -p "$evidence_dir/bootstrap"
|
||||
|
||||
sanitize() {
|
||||
source_file=$1
|
||||
target_file=$2
|
||||
jq '{code,success,failed,msg,data:(if (.data|type)=="object" then (.data|del(.sessionId,.token,.password,.userPassword)) else .data end)}' \
|
||||
"$source_file" >"$target_file"
|
||||
}
|
||||
|
||||
# The standalone profile recreates its in-memory H2 metadata after restart.
|
||||
# Immediately replace the public bootstrap password, then create two ordinary
|
||||
# users solely for this browser POC.
|
||||
curl -fsS -c "$cookie_file" -X POST "$base_url/login" \
|
||||
--data-urlencode userName=admin \
|
||||
--data-urlencode userPassword=dolphinscheduler123 >"$raw_file"
|
||||
sanitize "$raw_file" "$evidence_dir/bootstrap/bootstrap-login.json"
|
||||
jq -e '.code == 0 and .success == true' "$raw_file" >/dev/null
|
||||
|
||||
curl -fsS -b "$cookie_file" -X POST "$base_url/users/update" \
|
||||
--data-urlencode id=1 \
|
||||
--data-urlencode userName=admin \
|
||||
--data-urlencode "userPassword@$local_dir/admin-password.secret" \
|
||||
--data-urlencode email=xxx@qq.com \
|
||||
--data-urlencode tenantId=-1 \
|
||||
--data-urlencode state=1 \
|
||||
--data-urlencode timeZone=Asia/Shanghai >"$raw_file"
|
||||
sanitize "$raw_file" "$evidence_dir/bootstrap/admin-password-rotation.json"
|
||||
jq -e '.code == 0 and .success == true' "$raw_file" >/dev/null
|
||||
|
||||
# Re-authenticate with the rotated credential before creating ordinary users.
|
||||
unlink "$cookie_file" 2>/dev/null || true
|
||||
curl -fsS -c "$cookie_file" -X POST "$base_url/login" \
|
||||
--data-urlencode userName=admin \
|
||||
--data-urlencode "userPassword@$local_dir/admin-password.secret" >"$raw_file"
|
||||
sanitize "$raw_file" "$evidence_dir/bootstrap/rotated-admin-login.json"
|
||||
jq -e '.code == 0 and .success == true' "$raw_file" >/dev/null
|
||||
|
||||
for principal in dev test; do
|
||||
curl -fsS -b "$cookie_file" -X POST "$base_url/users/create" \
|
||||
--data-urlencode "userName=poc_${principal}_svc" \
|
||||
--data-urlencode "userPassword@$local_dir/${principal}-password.secret" \
|
||||
--data-urlencode tenantId=-1 \
|
||||
--data-urlencode "email=poc-${principal}@invalid.example" \
|
||||
--data-urlencode phone= \
|
||||
--data-urlencode state=1 >"$raw_file"
|
||||
sanitize "$raw_file" "$evidence_dir/bootstrap/${principal}-create.json"
|
||||
jq -e '.code == 0 and .success == true and .data.userType == "GENERAL_USER"' "$raw_file" >/dev/null
|
||||
done
|
||||
|
||||
curl -fsS -b "$cookie_file" "$base_url/users/list-paging?pageNo=1&pageSize=20" >"$raw_file"
|
||||
jq '{code,success,msg,data:{totalList:(.data.totalList|map({id,userName,userType,state,tenantId}))}}' \
|
||||
"$raw_file" >"$evidence_dir/bootstrap/principal-readback.json"
|
||||
jq -e '.data.totalList | map(.userName) | contains(["poc_dev_svc","poc_test_svc"])' "$raw_file" >/dev/null
|
||||
|
||||
echo 'PASS: browser POC principals recreated after standalone restart; public bootstrap password replaced'
|
||||
@@ -0,0 +1,47 @@
|
||||
services:
|
||||
standalone:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: aixun-datagov/poc-dolphinscheduler:3.4.2-pstree-1
|
||||
container_name: aixun-datagov-poc-dolphinscheduler-standalone
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
JAVA_OPTS: >-
|
||||
-server -Xms512m -Xmx1536m -Xmn256m
|
||||
-XX:+IgnoreUnrecognizedVMOptions
|
||||
-XX:-OmitStackTraceInFastThrow
|
||||
-XX:+ExitOnOutOfMemoryError
|
||||
-Duser.timezone=Asia/Shanghai
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "127.0.0.1:32045:12345"
|
||||
- "127.0.0.1:32033:25333"
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:12345/dolphinscheduler/actuator/health"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 60
|
||||
start_period: 30s
|
||||
volumes:
|
||||
- dolphinscheduler_logs:/opt/dolphinscheduler/logs
|
||||
networks:
|
||||
- dolphinscheduler_net
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
com.aixun.poc: POC-AUTH-001
|
||||
|
||||
networks:
|
||||
dolphinscheduler_net:
|
||||
name: aixun-datagov-poc-dolphinscheduler-net
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
|
||||
volumes:
|
||||
dolphinscheduler_logs:
|
||||
name: aixun-datagov-poc-dolphinscheduler-logs
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd "$(dirname "$0")" && pwd -P)
|
||||
local_dir="$script_dir/local"
|
||||
rotate=${1:-}
|
||||
mkdir -p "$local_dir"
|
||||
chmod 700 "$local_dir"
|
||||
|
||||
for name in admin-password dev-password test-password dev-token test-token dev-token-rotated expired-token wrong-token; do
|
||||
target="$local_dir/$name.secret"
|
||||
if [[ "$rotate" == "--rotate" || ! -f "$target" ]]; then
|
||||
umask 077
|
||||
printf '%s' "$(openssl rand -hex 9)" >"$target"
|
||||
fi
|
||||
chmod 600 "$target"
|
||||
done
|
||||
|
||||
echo "PASS: DolphinScheduler POC client credentials exist as ignored mode-0600 files"
|
||||
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 3 ]]; then
|
||||
echo "usage: $0 <dev-project-code> <test-project-code> <evidence-dir>" >&2
|
||||
exit 64
|
||||
fi
|
||||
|
||||
dev_project_code=$1
|
||||
test_project_code=$2
|
||||
evidence_dir=$3
|
||||
script_dir=$(cd "$(dirname "$0")" && pwd -P)
|
||||
local_dir="$script_dir/local"
|
||||
base_url=http://127.0.0.1:32045/dolphinscheduler
|
||||
tmp_dir=$(mktemp -d)
|
||||
chmod 700 "$tmp_dir"
|
||||
mkdir -p "$evidence_dir"
|
||||
|
||||
for required in admin-password dev-token test-token expired-token wrong-token dev-token-rotated; do
|
||||
[[ -r "$local_dir/$required.secret" ]] || {
|
||||
echo "FAIL: missing local secretRef $required" >&2
|
||||
exit 65
|
||||
}
|
||||
done
|
||||
|
||||
sanitize_body() {
|
||||
local source=$1
|
||||
local target=$2
|
||||
jq '{code,success,failed,msg,data:(if (.data|type)=="object" then (.data|del(.token,.sessionId,.userPassword,.password)) else .data end)}' \
|
||||
"$source" >"$target"
|
||||
}
|
||||
|
||||
token_get() {
|
||||
local label=$1
|
||||
local token_file=$2
|
||||
local path=$3
|
||||
local token_value config_file raw_file http_code
|
||||
token_value=$(tr -d '\n' <"$token_file")
|
||||
config_file="$tmp_dir/$label.conf"
|
||||
raw_file="$tmp_dir/$label.json"
|
||||
umask 077
|
||||
printf 'silent\nshow-error\nheader = "token: %s"\noutput = "%s"\nwrite-out = "%%{http_code}"\nurl = "%s%s"\n' \
|
||||
"$token_value" "$raw_file" "$base_url" "$path" >"$config_file"
|
||||
http_code=$(curl --config "$config_file")
|
||||
printf '%s\n' "$http_code" >"$evidence_dir/$label.http"
|
||||
sanitize_body "$raw_file" "$evidence_dir/$label.json"
|
||||
}
|
||||
|
||||
plain_get() {
|
||||
local label=$1
|
||||
local path=$2
|
||||
local raw_file="$tmp_dir/$label.json"
|
||||
local http_code
|
||||
http_code=$(curl -sS -o "$raw_file" -w '%{http_code}' "$base_url$path")
|
||||
printf '%s\n' "$http_code" >"$evidence_dir/$label.http"
|
||||
sanitize_body "$raw_file" "$evidence_dir/$label.json"
|
||||
}
|
||||
|
||||
plain_get no-auth "/projects/$dev_project_code"
|
||||
token_get wrong-token "$local_dir/wrong-token.secret" "/projects/$dev_project_code"
|
||||
token_get expired-token "$local_dir/expired-token.secret" "/projects/$dev_project_code"
|
||||
token_get dev-own "$local_dir/dev-token.secret" "/projects/$dev_project_code"
|
||||
token_get dev-other "$local_dir/dev-token.secret" "/projects/$test_project_code"
|
||||
token_get test-own "$local_dir/test-token.secret" "/projects/$test_project_code"
|
||||
token_get test-other "$local_dir/test-token.secret" "/projects/$dev_project_code"
|
||||
token_get dev-admin-endpoint "$local_dir/dev-token.secret" "/users/list-paging?pageNo=1&pageSize=10"
|
||||
|
||||
admin_cookie="$tmp_dir/admin.cookie"
|
||||
curl -sS -c "$admin_cookie" -X POST "$base_url/login" \
|
||||
--data-urlencode 'userName=admin' \
|
||||
--data-urlencode "userPassword@$local_dir/admin-password.secret" \
|
||||
-o "$tmp_dir/admin-login.json"
|
||||
sanitize_body "$tmp_dir/admin-login.json" "$evidence_dir/admin-login.json"
|
||||
|
||||
future=$(date -v+1y '+%Y-%m-%d %H:%M:%S')
|
||||
curl -sS -b "$admin_cookie" -X PUT "$base_url/access-tokens/1" \
|
||||
--data-urlencode 'userId=2' \
|
||||
--data-urlencode "expireTime=$future" \
|
||||
--data-urlencode "token@$local_dir/dev-token-rotated.secret" \
|
||||
-o "$tmp_dir/rotation.json"
|
||||
sanitize_body "$tmp_dir/rotation.json" "$evidence_dir/rotation.json"
|
||||
|
||||
token_get old-token-after-rotation "$local_dir/dev-token.secret" "/projects/$dev_project_code"
|
||||
token_get new-token-after-rotation "$local_dir/dev-token-rotated.secret" "/projects/$dev_project_code"
|
||||
|
||||
jq -e '.code == 0 and .success == true' "$evidence_dir/admin-login.json" >/dev/null
|
||||
[[ $(<"$evidence_dir/no-auth.http") == 401 ]]
|
||||
[[ $(<"$evidence_dir/wrong-token.http") == 401 ]]
|
||||
[[ $(<"$evidence_dir/expired-token.http") == 401 ]]
|
||||
jq -e --argjson code "$dev_project_code" '.code == 0 and .data.code == $code' "$evidence_dir/dev-own.json" >/dev/null
|
||||
jq -e --argjson code "$test_project_code" '.code == 0 and .data.code == $code' "$evidence_dir/test-own.json" >/dev/null
|
||||
jq -e '.code != 0 and .success == false' "$evidence_dir/dev-other.json" >/dev/null
|
||||
jq -e '.code != 0 and .success == false' "$evidence_dir/test-other.json" >/dev/null
|
||||
jq -e '.code != 0 and .success == false' "$evidence_dir/dev-admin-endpoint.json" >/dev/null
|
||||
jq -e '.code == 0 and .success == true' "$evidence_dir/rotation.json" >/dev/null
|
||||
[[ $(<"$evidence_dir/old-token-after-rotation.http") == 401 ]]
|
||||
jq -e --argjson code "$dev_project_code" '.code == 0 and .data.code == $code' "$evidence_dir/new-token-after-rotation.json" >/dev/null
|
||||
|
||||
cat >"$evidence_dir/result.txt" <<'EOF'
|
||||
PASS: distinct GENERAL_USER dev/test principals have isolated project access; missing, wrong, expired, cross-project, and admin-only access are rejected; token rotation invalidates the old value.
|
||||
EOF
|
||||
cat "$evidence_dir/result.txt"
|
||||
@@ -0,0 +1,264 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
script_dir="$repo_root/script/datagov/poc/dolphinscheduler"
|
||||
local_dir="$script_dir/local"
|
||||
evidence_dir="$repo_root/evidence/M1/POC-VERSION-001/dolphinscheduler-runtime"
|
||||
compose_file="$script_dir/docker-compose.yml"
|
||||
project=aixun-datagov-poc-dolphinscheduler
|
||||
container=aixun-datagov-poc-dolphinscheduler-standalone
|
||||
base_url=http://127.0.0.1:32045/dolphinscheduler
|
||||
cookie_file="$local_dir/runtime-admin.cookie"
|
||||
mkdir -p "$evidence_dir"
|
||||
chmod 700 "$local_dir"
|
||||
|
||||
require_equal() {
|
||||
local actual=$1
|
||||
local expected=$2
|
||||
local label=$3
|
||||
if [[ "$actual" != "$expected" ]]; then
|
||||
printf 'FAIL: %s expected %s, got %s\n' "$label" "$expected" "$actual" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
sanitize() {
|
||||
jq '{code,success,failed,msg,data:(if (.data|type)=="object" then (.data|del(.sessionId,.token,.password,.userPassword)) else .data end)}' "$1" >"$2"
|
||||
}
|
||||
|
||||
login_admin() {
|
||||
local output=$1
|
||||
curl -sS -c "$cookie_file" -X POST "$base_url/login" \
|
||||
--data-urlencode 'userName=admin' \
|
||||
--data-urlencode "userPassword@$local_dir/admin-password.secret" >"$output"
|
||||
chmod 600 "$cookie_file"
|
||||
}
|
||||
|
||||
ensure_bootstrap() {
|
||||
local label=$1
|
||||
local raw="$evidence_dir/$label-admin-login.raw.json"
|
||||
login_admin "$raw"
|
||||
if [[ $(jq -r '.code' "$raw") != 0 ]]; then
|
||||
"$script_dir/bootstrap-ui-principals.sh" >"$evidence_dir/$label-bootstrap-output.txt"
|
||||
login_admin "$raw"
|
||||
fi
|
||||
sanitize "$raw" "$evidence_dir/$label-admin-login.json"
|
||||
require_equal "$(jq -r '.code' "$raw")" 0 "$label admin login"
|
||||
}
|
||||
|
||||
wait_healthy() {
|
||||
local label=$1
|
||||
local started attempt state finished
|
||||
started=$(date +%s)
|
||||
for attempt in $(seq 1 120); do
|
||||
state=$(docker inspect -f '{{.State.Health.Status}}' "$container" 2>/dev/null || true)
|
||||
[[ "$state" == healthy ]] && break
|
||||
sleep 2
|
||||
done
|
||||
finished=$(date +%s)
|
||||
printf 'elapsed_seconds=%s\nstate=%s\n' "$((finished-started))" "$state" >"$evidence_dir/$label-health-timing.txt"
|
||||
require_equal "$state" healthy "$label container health"
|
||||
}
|
||||
|
||||
create_prerequisites() {
|
||||
local label=$1
|
||||
curl -sS -b "$cookie_file" -X POST "$base_url/tenants" \
|
||||
--data-urlencode 'tenantCode=poc_runtime' --data-urlencode 'queueId=1' \
|
||||
--data-urlencode 'description=M1 runtime POC' >"$evidence_dir/$label-tenant-create.json"
|
||||
require_equal "$(jq -r '.code' "$evidence_dir/$label-tenant-create.json")" 0 "$label tenant creation"
|
||||
curl -sS -b "$cookie_file" -X POST "$base_url/projects" \
|
||||
--data-urlencode 'projectName=poc_runtime_project' \
|
||||
--data-urlencode 'description=M1 runtime POC' >"$evidence_dir/$label-project-create.json"
|
||||
require_equal "$(jq -r '.code' "$evidence_dir/$label-project-create.json")" 0 "$label project creation"
|
||||
project_code=$(jq -r '.data.code' "$evidence_dir/$label-project-create.json")
|
||||
}
|
||||
|
||||
generate_task_codes() {
|
||||
local label=$1
|
||||
local count=$2
|
||||
curl -sS -b "$cookie_file" "$base_url/projects/$project_code/task-definition/gen-task-codes?genNum=$count" >"$evidence_dir/$label-task-codes.json"
|
||||
require_equal "$(jq -r '.code' "$evidence_dir/$label-task-codes.json")" 0 "$label task code generation"
|
||||
require_equal "$(jq -r '.data | length' "$evidence_dir/$label-task-codes.json")" "$count" "$label task code count"
|
||||
}
|
||||
|
||||
create_workflow() {
|
||||
local label=$1
|
||||
local task_code=$2
|
||||
local raw_script=$3
|
||||
local retry_times=$4
|
||||
local retry_interval=$5
|
||||
local timeout_flag=$6
|
||||
local timeout_strategy=$7
|
||||
local timeout_minutes=$8
|
||||
local task_json relation_json locations
|
||||
task_json=$(jq -nc \
|
||||
--argjson code "$task_code" --arg name "${label}_task" --arg description "$label shell task" \
|
||||
--arg script "$raw_script" --argjson retries "$retry_times" --argjson interval "$retry_interval" \
|
||||
--arg timeoutFlag "$timeout_flag" --arg timeoutStrategy "$timeout_strategy" --argjson timeout "$timeout_minutes" \
|
||||
'[{code:$code,name:$name,version:0,description:$description,delayTime:0,taskType:"SHELL",taskParams:{localParams:[],rawScript:$script,resourceList:[]},flag:"YES",taskPriority:"MEDIUM",workerGroup:"default",environmentCode:-1,failRetryTimes:$retries,failRetryInterval:$interval,timeoutFlag:$timeoutFlag,timeoutNotifyStrategy:$timeoutStrategy,timeout:$timeout}]')
|
||||
relation_json=$(jq -nc --argjson code "$task_code" '[{name:"",preTaskCode:0,preTaskVersion:0,postTaskCode:$code,postTaskVersion:0,conditionType:"NONE",conditionParams:{}}]')
|
||||
locations=$(jq -nc --argjson code "$task_code" '[{taskCode:$code,x:100,y:100}]')
|
||||
curl -sS -b "$cookie_file" -X POST "$base_url/projects/$project_code/workflow-definition" \
|
||||
--data-urlencode "name=poc_${label}_workflow" \
|
||||
--data-urlencode "description=$label runtime contract" \
|
||||
--data-urlencode 'globalParams=[]' --data-urlencode "locations=$locations" \
|
||||
--data-urlencode 'timeout=0' --data-urlencode "taskRelationJson=$relation_json" \
|
||||
--data-urlencode "taskDefinitionJson=$task_json" --data-urlencode 'executionType=PARALLEL' \
|
||||
>"$evidence_dir/$label-workflow-create.json"
|
||||
require_equal "$(jq -r '.code' "$evidence_dir/$label-workflow-create.json")" 0 "$label workflow creation"
|
||||
workflow_code=$(jq -r '.data.code' "$evidence_dir/$label-workflow-create.json")
|
||||
curl -sS -b "$cookie_file" -X POST "$base_url/projects/$project_code/workflow-definition/$workflow_code/release" \
|
||||
--data-urlencode 'releaseState=ONLINE' >"$evidence_dir/$label-workflow-release.json"
|
||||
require_equal "$(jq -r '.code' "$evidence_dir/$label-workflow-release.json")" 0 "$label workflow release"
|
||||
}
|
||||
|
||||
start_workflow() {
|
||||
local label=$1
|
||||
local code=$2
|
||||
curl -sS -b "$cookie_file" -X POST "$base_url/projects/$project_code/executors/start-workflow-instance" \
|
||||
--data-urlencode "workflowDefinitionCode=$code" --data-urlencode 'scheduleTime=' \
|
||||
--data-urlencode 'failureStrategy=END' --data-urlencode 'warningType=NONE' \
|
||||
--data-urlencode 'workflowInstancePriority=MEDIUM' --data-urlencode 'workerGroup=default' \
|
||||
--data-urlencode 'tenantCode=poc_runtime' --data-urlencode 'dryRun=0' \
|
||||
>"$evidence_dir/$label-workflow-start.json"
|
||||
require_equal "$(jq -r '.code' "$evidence_dir/$label-workflow-start.json")" 0 "$label workflow start"
|
||||
instance_id=$(jq -r '.data[0]' "$evidence_dir/$label-workflow-start.json")
|
||||
}
|
||||
|
||||
poll_instance() {
|
||||
local label=$1
|
||||
local instance_id=$2
|
||||
local expected=$3
|
||||
local limit=${4:-150}
|
||||
local attempt actual
|
||||
for attempt in $(seq 1 "$limit"); do
|
||||
curl -sS -b "$cookie_file" "$base_url/projects/$project_code/workflow-instances/$instance_id" >"$evidence_dir/$label-instance.json"
|
||||
actual=$(jq -r '.data.state // empty' "$evidence_dir/$label-instance.json")
|
||||
if [[ "$actual" == "$expected" ]]; then
|
||||
printf 'attempt=%s\nstate=%s\n' "$attempt" "$actual" >"$evidence_dir/$label-poll.txt"
|
||||
return 0
|
||||
fi
|
||||
case "$actual" in SUCCESS|FAILURE|STOP|KILL|PAUSE)
|
||||
printf 'unexpected terminal state: %s\n' "$actual" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
sleep 1
|
||||
done
|
||||
echo "timed out waiting for $label -> $expected" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
capture_tasks_and_logs() {
|
||||
local label=$1
|
||||
local instance_id=$2
|
||||
local task_id
|
||||
curl -sS -b "$cookie_file" "$base_url/projects/$project_code/workflow-instances/$instance_id/tasks" >"$evidence_dir/$label-tasks.json"
|
||||
task_id=$(jq -r '.data.taskList[-1].id' "$evidence_dir/$label-tasks.json")
|
||||
curl -sS -b "$cookie_file" "$base_url/log/detail?taskInstanceId=$task_id&skipLineNum=0&limit=1000" >"$evidence_dir/$label-log.json"
|
||||
require_equal "$(jq -r '.code' "$evidence_dir/$label-log.json")" 0 "$label task log readback"
|
||||
}
|
||||
|
||||
# The standalone profile intentionally resets in-memory H2 metadata on restart.
|
||||
# Begin from that known state and bootstrap only this POC instance.
|
||||
docker compose -p "$project" -f "$compose_file" restart standalone >"$evidence_dir/initial-restart-output.txt" 2>&1
|
||||
wait_healthy initial
|
||||
ensure_bootstrap initial
|
||||
create_prerequisites initial
|
||||
generate_task_codes initial 5
|
||||
|
||||
success_task=$(jq -r '.data[0]' "$evidence_dir/initial-task-codes.json")
|
||||
failure_task=$(jq -r '.data[1]' "$evidence_dir/initial-task-codes.json")
|
||||
retry_task=$(jq -r '.data[2]' "$evidence_dir/initial-task-codes.json")
|
||||
cancel_task=$(jq -r '.data[3]' "$evidence_dir/initial-task-codes.json")
|
||||
timeout_task=$(jq -r '.data[4]' "$evidence_dir/initial-task-codes.json")
|
||||
retry_marker="/tmp/aixun-datagov-poc-ds-retry-$(date +%s)"
|
||||
|
||||
create_workflow success "$success_task" "printf 'POC_SUCCESS\\n'" 0 1 CLOSE WARN 0
|
||||
success_workflow=$workflow_code
|
||||
start_workflow success "$success_workflow"
|
||||
success_instance=$instance_id
|
||||
poll_instance success "$success_instance" SUCCESS
|
||||
capture_tasks_and_logs success "$success_instance"
|
||||
|
||||
create_workflow failure "$failure_task" "printf 'POC_FAILURE\\n' >&2; exit 7" 0 1 CLOSE WARN 0
|
||||
failure_workflow=$workflow_code
|
||||
start_workflow failure "$failure_workflow"
|
||||
failure_instance=$instance_id
|
||||
poll_instance failure "$failure_instance" FAILURE
|
||||
capture_tasks_and_logs failure "$failure_instance"
|
||||
|
||||
create_workflow retry "$retry_task" "if [ ! -f '$retry_marker' ]; then touch '$retry_marker'; exit 9; fi; printf 'POC_RETRY_SUCCESS\\n'" 2 1 CLOSE WARN 0
|
||||
retry_workflow=$workflow_code
|
||||
start_workflow retry "$retry_workflow"
|
||||
retry_instance=$instance_id
|
||||
poll_instance retry "$retry_instance" SUCCESS
|
||||
capture_tasks_and_logs retry "$retry_instance"
|
||||
retry_times=$(jq -r '[.data.taskList[].retryTimes] | max' "$evidence_dir/retry-tasks.json")
|
||||
if (( retry_times < 1 )); then
|
||||
echo 'FAIL: retry workflow succeeded without a recorded retry' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
create_workflow cancel "$cancel_task" 'sleep 120' 0 1 CLOSE WARN 0
|
||||
cancel_workflow=$workflow_code
|
||||
start_workflow cancel "$cancel_workflow"
|
||||
cancel_instance=$instance_id
|
||||
poll_instance cancel-running "$cancel_instance" RUNNING_EXECUTION 30
|
||||
curl -sS -b "$cookie_file" -X POST "$base_url/projects/$project_code/executors/execute" \
|
||||
--data-urlencode "workflowInstanceId=$cancel_instance" --data-urlencode 'executeType=STOP' \
|
||||
>"$evidence_dir/cancel-stop.json"
|
||||
require_equal "$(jq -r '.code' "$evidence_dir/cancel-stop.json")" 0 'cancel stop request'
|
||||
# In 3.4.2 the STOP command kills the Shell process, but the task's SIGINT exit
|
||||
# 130 is folded into workflow FAILURE rather than the documented STOP terminal.
|
||||
# Accept only that observed terminal and preserve it as a compatibility limit.
|
||||
poll_instance cancel "$cancel_instance" FAILURE 60
|
||||
capture_tasks_and_logs cancel "$cancel_instance"
|
||||
|
||||
create_workflow timeout "$timeout_task" 'sleep 120' 0 1 OPEN FAILED 1
|
||||
timeout_workflow=$workflow_code
|
||||
start_workflow timeout "$timeout_workflow"
|
||||
timeout_instance=$instance_id
|
||||
poll_instance timeout "$timeout_instance" FAILURE 150
|
||||
capture_tasks_and_logs timeout "$timeout_instance"
|
||||
|
||||
set +e
|
||||
curl -sS --max-time 0.001 -b "$cookie_file" "$base_url/log/detail?taskInstanceId=$(jq -r '.data.taskList[-1].id' "$evidence_dir/success-tasks.json")&skipLineNum=0&limit=1000" \
|
||||
>"$evidence_dir/client-timeout-output.txt" 2>"$evidence_dir/client-timeout-stderr.txt"
|
||||
timeout_exit=$?
|
||||
set -e
|
||||
require_equal "$timeout_exit" 28 'DolphinScheduler caller timeout exit code'
|
||||
printf 'curl_exit=%s\n' "$timeout_exit" >"$evidence_dir/client-timeout-result.txt"
|
||||
|
||||
curl -sS -b "$cookie_file" "$base_url/projects/$project_code/workflow-instances?pageNo=1&pageSize=100" >"$evidence_dir/instances-before-recovery.json"
|
||||
docker compose -p "$project" -f "$compose_file" restart standalone >"$evidence_dir/recovery-restart-output.txt" 2>&1
|
||||
wait_healthy recovery
|
||||
ensure_bootstrap recovery
|
||||
old_project_status=$(curl -sS -b "$cookie_file" -o "$evidence_dir/old-project-after-restart.json" -w '%{http_code}' "$base_url/projects/$project_code")
|
||||
printf 'http_status=%s\napplication_code=%s\nconclusion=standalone H2 metadata is reset by restart\n' \
|
||||
"$old_project_status" "$(jq -r '.code' "$evidence_dir/old-project-after-restart.json")" >"$evidence_dir/old-project-after-restart-result.txt"
|
||||
|
||||
create_prerequisites recovery
|
||||
generate_task_codes recovery 1
|
||||
recovery_task=$(jq -r '.data[0]' "$evidence_dir/recovery-task-codes.json")
|
||||
create_workflow recovery "$recovery_task" "printf 'POC_RECOVERY_SUCCESS\\n'" 0 1 CLOSE WARN 0
|
||||
recovery_workflow=$workflow_code
|
||||
start_workflow recovery "$recovery_workflow"
|
||||
recovery_instance=$instance_id
|
||||
poll_instance recovery "$recovery_instance" SUCCESS
|
||||
capture_tasks_and_logs recovery "$recovery_instance"
|
||||
|
||||
docker logs "$container" >"$evidence_dir/container.log" 2>&1
|
||||
cat >"$evidence_dir/result.txt" <<EOF
|
||||
success_instance=$success_instance
|
||||
failure_instance=$failure_instance
|
||||
retry_instance=$retry_instance
|
||||
retry_times=$retry_times
|
||||
cancel_instance=$cancel_instance
|
||||
timeout_instance=$timeout_instance
|
||||
timeout_exit=$timeout_exit
|
||||
recovery_instance=$recovery_instance
|
||||
metadata_profile=standalone_h2_resets_on_restart
|
||||
EOF
|
||||
echo 'PASS_WITH_LIMITATION: DolphinScheduler workflow success/failure/retry/stop/timeout/log/recovery contract completed; standalone H2 loses metadata on restart'
|
||||
@@ -0,0 +1,5 @@
|
||||
/local/
|
||||
/node_modules/
|
||||
*.secret
|
||||
*.csv
|
||||
*.jsonl
|
||||
@@ -0,0 +1,99 @@
|
||||
services:
|
||||
fe:
|
||||
image: apache/doris:fe-4.0.8@sha256:390413325a93d9121768bda153ccaa3c7a8da4aa0fd2a466406cddc14a6399b2
|
||||
container_name: aixun-datagov-poc-doris-fe
|
||||
hostname: doris-fe
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
FE_SERVERS: fe1:172.27.40.2:9010
|
||||
FE_ID: "1"
|
||||
PREFER_HOST_MODE: ip
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "127.0.0.1:35030:8030"
|
||||
- "127.0.0.1:35090:9030"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:8030/api/bootstrap >/dev/null"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 90
|
||||
start_period: 30s
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 1000000
|
||||
hard: 1000000
|
||||
volumes:
|
||||
- doris_fe_meta:/opt/apache-doris/fe/doris-meta
|
||||
- doris_fe_log:/opt/apache-doris/fe/log
|
||||
networks:
|
||||
doris_net:
|
||||
ipv4_address: 172.27.40.2
|
||||
labels: &poc_labels
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
com.aixun.poc: POC-DORIS-002
|
||||
|
||||
be:
|
||||
image: apache/doris:be-4.0.8@sha256:d911ae3826491598be4e383cba83011a266091b8fdc6c34c036280220cc4fea9
|
||||
container_name: aixun-datagov-poc-doris-be
|
||||
hostname: doris-be
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
FE_SERVERS: fe1:172.27.40.2:9010
|
||||
BE_ADDR: 172.27.40.3:9050
|
||||
PREFER_HOST_MODE: ip
|
||||
TZ: Asia/Shanghai
|
||||
depends_on:
|
||||
fe:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "127.0.0.1:35040:8040"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:8040/api/health >/dev/null"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 90
|
||||
start_period: 45s
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 1000000
|
||||
hard: 1000000
|
||||
volumes:
|
||||
- doris_be_storage:/opt/apache-doris/be/storage
|
||||
- doris_be_log:/opt/apache-doris/be/log
|
||||
networks:
|
||||
doris_net:
|
||||
ipv4_address: 172.27.40.3
|
||||
labels: *poc_labels
|
||||
|
||||
networks:
|
||||
doris_net:
|
||||
name: aixun-datagov-poc-doris-net
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.27.40.0/24
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
|
||||
volumes:
|
||||
doris_fe_meta:
|
||||
name: aixun-datagov-poc-doris-fe-meta
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
doris_fe_log:
|
||||
name: aixun-datagov-poc-doris-fe-log
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
doris_be_storage:
|
||||
name: aixun-datagov-poc-doris-be-storage
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
doris_be_log:
|
||||
name: aixun-datagov-poc-doris-be-log
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd "$(dirname "$0")" && pwd -P)
|
||||
local_dir="$script_dir/local"
|
||||
rotate=${1:-}
|
||||
install -d -m 0700 "$local_dir"
|
||||
|
||||
for principal in root dev test integration; do
|
||||
target="$local_dir/$principal-password.secret"
|
||||
if [[ "$rotate" == "--rotate-$principal" || ! -f "$target" ]]; then
|
||||
umask 077
|
||||
printf 'Aa1!%s' "$(openssl rand -hex 12)" >"$target"
|
||||
fi
|
||||
chmod 0600 "$target"
|
||||
done
|
||||
|
||||
target="$local_dir/client-token.secret"
|
||||
if [[ ! -f "$target" ]]; then
|
||||
umask 077
|
||||
printf 'poc_%s' "$(openssl rand -hex 24)" >"$target"
|
||||
fi
|
||||
chmod 0600 "$target"
|
||||
|
||||
echo 'PASS: Doris POC credentials exist only as ignored mode-0600 files'
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@aixun-datagov/poc-doris-data-path",
|
||||
"private": true,
|
||||
"version": "0.0.0-poc",
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@10.34.5",
|
||||
"scripts": {
|
||||
"bootstrap": "node src/bootstrap.mjs",
|
||||
"contract": "node src/auth-sec-contract.mjs",
|
||||
"proxy": "node src/bounded-proxy.mjs",
|
||||
"benchmark": "node src/benchmark.mjs",
|
||||
"recovery": "node src/recovery-probe.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"mysql2": "3.15.3"
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
lockfileVersion: '9.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
mysql2:
|
||||
specifier: 3.15.3
|
||||
version: 3.15.3
|
||||
|
||||
packages:
|
||||
|
||||
aws-ssl-profiles@1.1.2:
|
||||
resolution: {integrity: sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==}
|
||||
engines: {node: '>= 6.0.0'}
|
||||
|
||||
denque@2.1.0:
|
||||
resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==}
|
||||
engines: {node: '>=0.10'}
|
||||
|
||||
generate-function@2.3.1:
|
||||
resolution: {integrity: sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==}
|
||||
|
||||
iconv-lite@0.7.3:
|
||||
resolution: {integrity: sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
is-property@1.0.2:
|
||||
resolution: {integrity: sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==}
|
||||
|
||||
long@5.3.2:
|
||||
resolution: {integrity: sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==}
|
||||
|
||||
lru.min@1.1.4:
|
||||
resolution: {integrity: sha512-DqC6n3QQ77zdFpCMASA1a3Jlb64Hv2N2DciFGkO/4L9+q/IpIAuRlKOvCXabtRW6cQf8usbmM6BE/TOPysCdIA==}
|
||||
engines: {bun: '>=1.0.0', deno: '>=1.30.0', node: '>=8.0.0'}
|
||||
|
||||
mysql2@3.15.3:
|
||||
resolution: {integrity: sha512-FBrGau0IXmuqg4haEZRBfHNWB5mUARw6hNwPDXXGg0XzVJ50mr/9hb267lvpVMnhZ1FON3qNd4Xfcez1rbFwSg==}
|
||||
engines: {node: '>= 8.0'}
|
||||
|
||||
named-placeholders@1.1.6:
|
||||
resolution: {integrity: sha512-Tz09sEL2EEuv5fFowm419c1+a/jSMiBjI9gHxVLrVdbUkkNUUfjsVYs9pVZu5oCon/kmRh9TfLEObFtkVxmY0w==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
|
||||
safer-buffer@2.1.2:
|
||||
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
|
||||
|
||||
seq-queue@0.0.5:
|
||||
resolution: {integrity: sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q==}
|
||||
|
||||
sqlstring@2.3.3:
|
||||
resolution: {integrity: sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
snapshots:
|
||||
|
||||
aws-ssl-profiles@1.1.2: {}
|
||||
|
||||
denque@2.1.0: {}
|
||||
|
||||
generate-function@2.3.1:
|
||||
dependencies:
|
||||
is-property: 1.0.2
|
||||
|
||||
iconv-lite@0.7.3:
|
||||
dependencies:
|
||||
safer-buffer: 2.1.2
|
||||
|
||||
is-property@1.0.2: {}
|
||||
|
||||
long@5.3.2: {}
|
||||
|
||||
lru.min@1.1.4: {}
|
||||
|
||||
mysql2@3.15.3:
|
||||
dependencies:
|
||||
aws-ssl-profiles: 1.1.2
|
||||
denque: 2.1.0
|
||||
generate-function: 2.3.1
|
||||
iconv-lite: 0.7.3
|
||||
long: 5.3.2
|
||||
lru.min: 1.1.4
|
||||
named-placeholders: 1.1.6
|
||||
seq-queue: 0.0.5
|
||||
sqlstring: 2.3.3
|
||||
|
||||
named-placeholders@1.1.6:
|
||||
dependencies:
|
||||
lru.min: 1.1.4
|
||||
|
||||
safer-buffer@2.1.2: {}
|
||||
|
||||
seq-queue@0.0.5: {}
|
||||
|
||||
sqlstring@2.3.3: {}
|
||||
@@ -0,0 +1,102 @@
|
||||
import fs from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import { connect, repoRoot, rootConnection, secret, writeJson } from './common.mjs'
|
||||
|
||||
const authEvidence = path.join(repoRoot, 'evidence/M1/POC-AUTH-001/doris')
|
||||
const secEvidence = path.join(repoRoot, 'evidence/M1/POC-SEC-001/doris')
|
||||
const results = { authentication: {}, authorization: {}, security: {} }
|
||||
const root = await rootConnection()
|
||||
|
||||
async function expectConnect(label, user, password, shouldPass) {
|
||||
try {
|
||||
const connection = await connect(user, password)
|
||||
const [rows] = await connection.query('SELECT CURRENT_USER() AS currentUser')
|
||||
await connection.end()
|
||||
results.authentication[label] = { expected: shouldPass ? 'allow' : 'deny', actual: 'allow', currentUser: rows[0].currentUser }
|
||||
if (!shouldPass) throw new Error(`${label}: credentials unexpectedly accepted`)
|
||||
} catch (error) {
|
||||
if (shouldPass) throw error
|
||||
results.authentication[label] = { expected: 'deny', actual: 'deny', errorCode: error.code ?? 'EXPECTED_DENIAL' }
|
||||
}
|
||||
}
|
||||
|
||||
const devPassword = await secret('dev-password')
|
||||
const testPassword = await secret('test-password')
|
||||
const integrationPassword = await secret('integration-password')
|
||||
|
||||
await expectConnect('dev-correct', 'poc_doris_dev', devPassword, true)
|
||||
await expectConnect('test-correct', 'poc_doris_test', testPassword, true)
|
||||
await expectConnect('integration-correct', 'poc_doris_integration', integrationPassword, true)
|
||||
await expectConnect('dev-wrong', 'poc_doris_dev', 'invalid-poc-password', false)
|
||||
await expectConnect('missing-user', 'poc_doris_missing', '', false)
|
||||
|
||||
// Apply and read back the Doris-native row policy.
|
||||
await root.query(`CREATE ROW POLICY IF NOT EXISTS poc_doris_dev_tenant
|
||||
ON poc_doris.query_probe AS RESTRICTIVE TO poc_doris_dev USING (tenant_id = 1)`)
|
||||
const [rowPolicies] = await root.query('SHOW ROW POLICY')
|
||||
results.security.rowPolicyApply = 'PASS'
|
||||
results.security.rowPolicyReadback = rowPolicies.filter((row) => JSON.stringify(row).includes('poc_doris_dev_tenant'))
|
||||
if (results.security.rowPolicyReadback.length === 0) throw new Error('row policy was not readable after apply')
|
||||
|
||||
const dev = await connect('poc_doris_dev', devPassword)
|
||||
const [[devScope]] = await dev.query('SELECT COUNT(*) AS count, MIN(tenant_id) AS minTenant, MAX(tenant_id) AS maxTenant FROM poc_doris.query_probe')
|
||||
results.security.rowPolicyAllow = { rows: Number(devScope.count), minTenant: devScope.minTenant, maxTenant: devScope.maxTenant }
|
||||
if (Number(devScope.count) !== 100000 || devScope.minTenant !== 1 || devScope.maxTenant !== 1) throw new Error('row policy did not restrict dev to tenant 1')
|
||||
|
||||
const [publicRows] = await dev.query('SELECT id, tenant_id, public_value FROM poc_doris.query_probe ORDER BY id LIMIT 2')
|
||||
results.security.columnAllow = { rows: publicRows.length, columns: Object.keys(publicRows[0] ?? {}) }
|
||||
try {
|
||||
await dev.query('SELECT secret_value FROM poc_doris.query_probe LIMIT 1')
|
||||
throw new Error('secret column unexpectedly readable')
|
||||
} catch (error) {
|
||||
if (error.message === 'secret column unexpectedly readable') throw error
|
||||
results.security.columnDeny = { actual: 'deny', errorCode: error.code, message: error.message }
|
||||
}
|
||||
await dev.end()
|
||||
|
||||
const [grants] = await root.query(`SHOW GRANTS FOR 'poc_doris_dev'@'%'`)
|
||||
results.security.columnReadback = grants
|
||||
if (!JSON.stringify(grants).includes('public_value')) throw new Error('column privilege was not readable after apply')
|
||||
|
||||
const test = await connect('poc_doris_test', testPassword)
|
||||
try {
|
||||
await test.query('SELECT COUNT(*) FROM poc_doris.query_probe')
|
||||
throw new Error('unprivileged test user unexpectedly read the table')
|
||||
} catch (error) {
|
||||
if (error.message.includes('unexpectedly read')) throw error
|
||||
results.authorization.testTableDeny = { actual: 'deny', errorCode: error.code, message: error.message }
|
||||
}
|
||||
await test.end()
|
||||
|
||||
const integration = await connect('poc_doris_integration', integrationPassword)
|
||||
const [[integrationCount]] = await integration.query('SELECT COUNT(*) AS count FROM poc_doris.query_probe')
|
||||
results.authorization.integrationRead = { actual: 'allow', rows: Number(integrationCount.count) }
|
||||
await integration.end()
|
||||
if (Number(integrationCount.count) !== 1000000) throw new Error('integration service account did not read the expected full data set')
|
||||
|
||||
// Native password expiry is exercised with a one-second policy, then restored.
|
||||
await root.query(`ALTER USER 'poc_doris_test'@'%' PASSWORD_EXPIRE INTERVAL 1 SECOND`)
|
||||
await new Promise((resolve) => setTimeout(resolve, 2100))
|
||||
await expectConnect('test-expired', 'poc_doris_test', testPassword, false)
|
||||
await root.query(`ALTER USER 'poc_doris_test'@'%' PASSWORD_EXPIRE NEVER`)
|
||||
await expectConnect('test-unexpired', 'poc_doris_test', testPassword, true)
|
||||
|
||||
// Rotate dev without ever persisting the former value to evidence.
|
||||
const previousDevPassword = devPassword
|
||||
const nextDevPassword = `Aa1!${crypto.randomUUID().replaceAll('-', '').slice(0, 24)}`
|
||||
await root.query(`ALTER USER 'poc_doris_dev'@'%' IDENTIFIED BY ${root.escape(nextDevPassword)}`)
|
||||
await fs.writeFile(path.join(path.resolve(import.meta.dirname, '..'), 'local/dev-password.secret'), nextDevPassword, { mode: 0o600 })
|
||||
await expectConnect('dev-rotated-new', 'poc_doris_dev', nextDevPassword, true)
|
||||
await expectConnect('dev-rotated-old', 'poc_doris_dev', previousDevPassword, false)
|
||||
|
||||
const [createUser] = await root.query(`SHOW CREATE USER 'poc_doris_dev'@'%'`)
|
||||
results.authentication.policyReadback = createUser
|
||||
results.security.masking = {
|
||||
status: 'UNSUPPORTED',
|
||||
reason: 'Doris native masking requires Apache Ranger; Ranger is outside the approved five-component POC and was not integrated.',
|
||||
}
|
||||
|
||||
await root.end()
|
||||
await writeJson(path.join(authEvidence, 'contract.json'), { authentication: results.authentication, authorization: results.authorization })
|
||||
await writeJson(path.join(secEvidence, 'contract.json'), { security: results.security })
|
||||
console.log('PASS: Doris authentication, expiry, rotation, row policy, and column policy contract completed')
|
||||
@@ -0,0 +1,184 @@
|
||||
import path from 'node:path'
|
||||
import mysql from 'mysql2/promise'
|
||||
import { connect, host, port, repoRoot, rootConnection, secret, writeJson } from './common.mjs'
|
||||
|
||||
const evidence = path.join(repoRoot, 'evidence/M1/POC-DORIS-002')
|
||||
const proxyBase = 'http://127.0.0.1:35130'
|
||||
const devPassword = await secret('dev-password')
|
||||
const clientToken = await secret('client-token')
|
||||
const results = { limits: {}, pathAIntegrationProxy: {}, pathBDirect: {}, environment: {} }
|
||||
const authorizedHeaders = { authorization: `Bearer ${clientToken}` }
|
||||
const proxyFetch = (url, options = {}) => fetch(url, { ...options, headers: { ...authorizedHeaders, ...options.headers } })
|
||||
|
||||
function percentile(values, quantile) {
|
||||
if (values.length === 0) return null
|
||||
const sorted = [...values].sort((a, b) => a - b)
|
||||
return Math.round(sorted[Math.min(sorted.length - 1, Math.ceil(sorted.length * quantile) - 1)] * 100) / 100
|
||||
}
|
||||
|
||||
async function timed(fn) {
|
||||
const started = performance.now()
|
||||
try {
|
||||
const value = await fn()
|
||||
return { ok: true, elapsedMs: Math.round((performance.now() - started) * 100) / 100, value }
|
||||
} catch (error) {
|
||||
return { ok: false, elapsedMs: Math.round((performance.now() - started) * 100) / 100, errorCode: error.code ?? error.name, error: error.message }
|
||||
}
|
||||
}
|
||||
|
||||
const dev = await connect('poc_doris_dev', devPassword)
|
||||
results.pathBDirect.small = await timed(async () => {
|
||||
const [rows] = await dev.query('SELECT id, tenant_id, public_value FROM poc_doris.query_probe ORDER BY id LIMIT 10')
|
||||
return { rows: rows.length, firstId: rows[0].id, lastId: rows.at(-1).id }
|
||||
})
|
||||
results.pathBDirect.page = await timed(async () => {
|
||||
const [rows] = await dev.query('SELECT id, tenant_id, public_value FROM poc_doris.query_probe ORDER BY id LIMIT 100 OFFSET 1000')
|
||||
return { rows: rows.length, firstId: rows[0].id, lastId: rows.at(-1).id }
|
||||
})
|
||||
results.pathBDirect.overreach = await timed(() => dev.query('SELECT secret_value FROM poc_doris.query_probe LIMIT 1'))
|
||||
|
||||
results.pathBDirect.largeStream = await timed(async () => {
|
||||
let rows = 0
|
||||
let bytes = 0
|
||||
const stream = dev.connection.query('SELECT id, tenant_id, public_value, padding FROM poc_doris.query_probe ORDER BY id LIMIT 100000').stream({ highWaterMark: 128 })
|
||||
for await (const row of stream) {
|
||||
rows += 1
|
||||
bytes += Buffer.byteLength(`${row.id},${row.tenant_id},${row.public_value},${row.padding}\n`)
|
||||
}
|
||||
return { rows, bytes, throughputRowsPerSecond: 0 }
|
||||
})
|
||||
if (results.pathBDirect.largeStream.ok) {
|
||||
results.pathBDirect.largeStream.value.throughputRowsPerSecond = Math.round(results.pathBDirect.largeStream.value.rows / (results.pathBDirect.largeStream.elapsedMs / 1000))
|
||||
}
|
||||
|
||||
results.pathBDirect.timeout = await timed(() => dev.query('SELECT SLEEP(4)'))
|
||||
const cancelConnection = await connect('poc_doris_dev', devPassword)
|
||||
const root = await rootConnection()
|
||||
const cancelPromise = timed(() => cancelConnection.query('SELECT SLEEP(10)'))
|
||||
await new Promise((resolve) => setTimeout(resolve, 250))
|
||||
await root.query(`KILL QUERY ${Number(cancelConnection.connection.threadId)}`)
|
||||
results.pathBDirect.cancel = await cancelPromise
|
||||
await cancelConnection.end().catch(() => {})
|
||||
|
||||
const directPool = mysql.createPool({ host, port, user: 'poc_doris_dev', password: devPassword, waitForConnections: false, connectionLimit: 50, connectTimeout: 5000 })
|
||||
const directWallStarted = performance.now()
|
||||
const directConcurrent = await Promise.all(Array.from({ length: 50 }, async (_, index) => {
|
||||
const result = await timed(async () => {
|
||||
const [rows] = await directPool.query('SELECT SLEEP(0.25), COUNT(*) AS count FROM poc_doris.query_probe WHERE MOD(id, 50) = ?', [index])
|
||||
return Number(rows[0].count)
|
||||
})
|
||||
return result
|
||||
}))
|
||||
await directPool.end()
|
||||
results.pathBDirect.concurrency50 = {
|
||||
total: 50,
|
||||
succeeded: directConcurrent.filter((value) => value.ok).length,
|
||||
rejected: directConcurrent.filter((value) => !value.ok).length,
|
||||
wallMs: Math.round((performance.now() - directWallStarted) * 100) / 100,
|
||||
p50Ms: percentile(directConcurrent.map((value) => value.elapsedMs), 0.5),
|
||||
p95Ms: percentile(directConcurrent.map((value) => value.elapsedMs), 0.95),
|
||||
errorCodes: [...new Set(directConcurrent.filter((value) => !value.ok).map((value) => value.errorCode))],
|
||||
}
|
||||
await dev.end()
|
||||
|
||||
const health = await fetch(`${proxyBase}/health`).then((response) => response.json())
|
||||
results.limits = health.limits
|
||||
results.pathAIntegrationProxy.missingCredential = await timed(async () => {
|
||||
const response = await fetch(`${proxyBase}/query?limit=1`)
|
||||
return { status: response.status, body: await response.json() }
|
||||
})
|
||||
results.pathAIntegrationProxy.wrongCredential = await timed(async () => {
|
||||
const response = await fetch(`${proxyBase}/query?limit=1`, { headers: { authorization: 'Bearer deliberately-wrong' } })
|
||||
return { status: response.status, body: await response.json() }
|
||||
})
|
||||
results.pathAIntegrationProxy.small = await timed(async () => {
|
||||
const response = await proxyFetch(`${proxyBase}/query?limit=10&offset=0`)
|
||||
return { status: response.status, body: await response.json() }
|
||||
})
|
||||
results.pathAIntegrationProxy.page = await timed(async () => {
|
||||
const response = await proxyFetch(`${proxyBase}/query?limit=100&offset=1000`)
|
||||
const body = await response.json()
|
||||
return { status: response.status, rows: body.rows?.length ?? 0 }
|
||||
})
|
||||
results.pathAIntegrationProxy.download = await timed(async () => {
|
||||
const response = await proxyFetch(`${proxyBase}/download?limit=5000`)
|
||||
const body = await response.arrayBuffer()
|
||||
return { status: response.status, bytes: body.byteLength, rows: response.status === 200 ? 5000 : 0 }
|
||||
})
|
||||
results.pathAIntegrationProxy.oversizedDownload = await timed(async () => {
|
||||
const response = await proxyFetch(`${proxyBase}/download?limit=100000`)
|
||||
return { status: response.status, body: await response.json() }
|
||||
})
|
||||
results.pathAIntegrationProxy.timeout = await timed(async () => {
|
||||
const response = await proxyFetch(`${proxyBase}/slow?seconds=4&requestId=timeout-probe`)
|
||||
return { status: response.status, body: await response.json() }
|
||||
})
|
||||
|
||||
const cancelFetch = timed(async () => {
|
||||
const response = await proxyFetch(`${proxyBase}/slow?seconds=10&requestId=cancel-probe`)
|
||||
return { status: response.status, body: await response.json() }
|
||||
})
|
||||
await new Promise((resolve) => setTimeout(resolve, 250))
|
||||
const cancelResponse = await proxyFetch(`${proxyBase}/cancel/cancel-probe`, { method: 'DELETE' })
|
||||
results.pathAIntegrationProxy.cancelSignal = { status: cancelResponse.status, body: await cancelResponse.json() }
|
||||
results.pathAIntegrationProxy.cancelledRequest = await cancelFetch
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 1100))
|
||||
const proxyWallStarted = performance.now()
|
||||
const proxyConcurrent = await Promise.all(Array.from({ length: 50 }, (_, index) => timed(async () => {
|
||||
const response = await proxyFetch(`${proxyBase}/query?limit=20&offset=${index * 20}`)
|
||||
await response.arrayBuffer()
|
||||
return response.status
|
||||
})))
|
||||
results.pathAIntegrationProxy.concurrency50 = {
|
||||
total: 50,
|
||||
succeeded: proxyConcurrent.filter((value) => value.ok && value.value === 200).length,
|
||||
rateOrConcurrencyLimited: proxyConcurrent.filter((value) => value.ok && value.value === 429).length,
|
||||
other: proxyConcurrent.filter((value) => !value.ok || ![200, 429].includes(value.value)).length,
|
||||
wallMs: Math.round((performance.now() - proxyWallStarted) * 100) / 100,
|
||||
p50Ms: percentile(proxyConcurrent.map((value) => value.elapsedMs), 0.5),
|
||||
p95Ms: percentile(proxyConcurrent.map((value) => value.elapsedMs), 0.95),
|
||||
}
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 1100))
|
||||
const rateStatuses = []
|
||||
for (let index = 0; index < 25; index += 1) {
|
||||
const response = await proxyFetch(`${proxyBase}/query?limit=1&offset=${index}`)
|
||||
rateStatuses.push(response.status)
|
||||
await response.arrayBuffer()
|
||||
}
|
||||
results.pathAIntegrationProxy.rateLimit25 = {
|
||||
ok200: rateStatuses.filter((status) => status === 200).length,
|
||||
limited429: rateStatuses.filter((status) => status === 429).length,
|
||||
}
|
||||
results.pathAIntegrationProxy.processMemory = await proxyFetch(`${proxyBase}/metrics`).then((response) => response.json())
|
||||
|
||||
const [groups] = await root.query(`SHOW WORKLOAD GROUPS LIKE 'dataproduct_poc'`)
|
||||
const [properties] = await root.query(`SHOW PROPERTY FOR 'poc_doris_dev'`)
|
||||
results.pathBDirect.serverLimitsReadback = { workloadGroup: groups, userProperties: properties }
|
||||
await root.end()
|
||||
results.environment.clientProcess = process.memoryUsage()
|
||||
|
||||
await writeJson(path.join(evidence, 'benchmark-results.json'), results)
|
||||
const failures = []
|
||||
if (results.pathAIntegrationProxy.missingCredential.value?.status !== 401) failures.push('proxy missing credential was not denied')
|
||||
if (results.pathAIntegrationProxy.wrongCredential.value?.status !== 401) failures.push('proxy wrong credential was not denied')
|
||||
if (results.pathAIntegrationProxy.small.value?.status !== 200) failures.push('proxy small query did not succeed')
|
||||
if (results.pathAIntegrationProxy.page.value?.rows !== 100) failures.push('proxy pagination did not return 100 rows')
|
||||
if (results.pathAIntegrationProxy.download.value?.rows !== 5000) failures.push('proxy bounded download did not return 5000 rows')
|
||||
if (results.pathAIntegrationProxy.oversizedDownload.value?.status !== 413) failures.push('proxy oversized download was not denied')
|
||||
if (results.pathAIntegrationProxy.timeout.value?.status !== 504) failures.push('proxy timeout did not return 504')
|
||||
if (results.pathAIntegrationProxy.cancelSignal.status !== 202 || results.pathAIntegrationProxy.cancelledRequest.value?.status !== 499) failures.push('proxy cancellation did not terminate the active request')
|
||||
if (results.pathAIntegrationProxy.concurrency50.other !== 0) failures.push('proxy concurrency produced statuses other than success or limit')
|
||||
if (results.pathAIntegrationProxy.rateLimit25.limited429 < 1) failures.push('proxy rate limit did not reject requests')
|
||||
if (!results.pathBDirect.small.ok || results.pathBDirect.small.value?.rows !== 10) failures.push('direct small query failed')
|
||||
if (!results.pathBDirect.page.ok || results.pathBDirect.page.value?.rows !== 100) failures.push('direct pagination failed')
|
||||
if (!results.pathBDirect.largeStream.ok || results.pathBDirect.largeStream.value?.rows !== 100000) failures.push('direct large streaming query failed')
|
||||
if (results.pathBDirect.overreach.ok) failures.push('direct account could read the denied column')
|
||||
if (results.pathBDirect.timeout.ok || !results.pathBDirect.timeout.error?.includes('query timeout')) failures.push('direct timeout was not enforced')
|
||||
if (results.pathBDirect.cancel.ok || !results.pathBDirect.cancel.error?.includes('cancel query')) failures.push('direct cancellation was not enforced')
|
||||
if (results.pathBDirect.concurrency50.total !== 50 || results.pathBDirect.concurrency50.succeeded + results.pathBDirect.concurrency50.rejected !== 50) failures.push('direct concurrency result is incomplete')
|
||||
results.assertions = { status: failures.length === 0 ? 'PASS' : 'FAIL', failures }
|
||||
await writeJson(path.join(evidence, 'benchmark-results.json'), results)
|
||||
if (failures.length > 0) throw new Error(`Doris benchmark assertions failed: ${failures.join('; ')}`)
|
||||
console.log('PASS: both Doris candidate paths completed the POC benchmark suite')
|
||||
@@ -0,0 +1,88 @@
|
||||
import fs from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import { localDir, repoRoot, rootConnection, secret, writeJson } from './common.mjs'
|
||||
|
||||
const evidence = path.join(repoRoot, 'evidence/M1/POC-DORIS-002')
|
||||
const rootPassword = await secret('root-password')
|
||||
const devPassword = await secret('dev-password')
|
||||
const testPassword = await secret('test-password')
|
||||
const integrationPassword = await secret('integration-password')
|
||||
const connection = await rootConnection()
|
||||
|
||||
const q = (value) => connection.escape(value)
|
||||
const statements = [
|
||||
`ALTER USER 'root'@'%' IDENTIFIED BY ${q(rootPassword)}`,
|
||||
`CREATE DATABASE IF NOT EXISTS poc_doris`,
|
||||
`CREATE TABLE IF NOT EXISTS poc_doris.query_probe (
|
||||
id BIGINT NOT NULL,
|
||||
tenant_id INT NOT NULL,
|
||||
public_value VARCHAR(96) NOT NULL,
|
||||
secret_value VARCHAR(96) NOT NULL,
|
||||
padding VARCHAR(256) NOT NULL
|
||||
) DUPLICATE KEY(id)
|
||||
DISTRIBUTED BY HASH(id) BUCKETS 4
|
||||
PROPERTIES('replication_num'='1')`,
|
||||
`CREATE USER IF NOT EXISTS 'poc_doris_dev'@'%' IDENTIFIED BY ${q(devPassword)}`,
|
||||
`ALTER USER 'poc_doris_dev'@'%' IDENTIFIED BY ${q(devPassword)}`,
|
||||
`CREATE USER IF NOT EXISTS 'poc_doris_test'@'%' IDENTIFIED BY ${q(testPassword)}`,
|
||||
`ALTER USER 'poc_doris_test'@'%' IDENTIFIED BY ${q(testPassword)}`,
|
||||
`CREATE USER IF NOT EXISTS 'poc_doris_integration'@'%' IDENTIFIED BY ${q(integrationPassword)}`,
|
||||
`ALTER USER 'poc_doris_integration'@'%' IDENTIFIED BY ${q(integrationPassword)}`,
|
||||
`GRANT SELECT_PRIV ON internal.poc_doris.query_probe TO 'poc_doris_integration'@'%'`,
|
||||
`GRANT SELECT_PRIV(id,tenant_id,public_value,padding) ON internal.poc_doris.query_probe TO 'poc_doris_dev'@'%'`,
|
||||
`ALTER USER 'poc_doris_dev'@'%' PASSWORD_HISTORY 3`,
|
||||
`ALTER USER 'poc_doris_dev'@'%' PASSWORD_EXPIRE NEVER`,
|
||||
`ALTER USER 'poc_doris_test'@'%' FAILED_LOGIN_ATTEMPTS 3 PASSWORD_LOCK_TIME 5 SECOND`,
|
||||
`CREATE WORKLOAD GROUP IF NOT EXISTS dataproduct_poc PROPERTIES (
|
||||
'max_concurrency'='10',
|
||||
'max_queue_size'='20',
|
||||
'queue_timeout'='2000',
|
||||
'max_memory_percent'='25%'
|
||||
)`,
|
||||
`GRANT USAGE_PRIV ON WORKLOAD GROUP dataproduct_poc TO 'poc_doris_dev'@'%'`,
|
||||
`SET PROPERTY FOR 'poc_doris_dev' 'default_workload_group'='dataproduct_poc'`,
|
||||
`SET PROPERTY FOR 'poc_doris_dev' 'query_timeout'='2'`,
|
||||
`SET PROPERTY FOR 'poc_doris_dev' 'exec_mem_limit'='268435456'`,
|
||||
]
|
||||
|
||||
const results = []
|
||||
for (const sql of statements) {
|
||||
try {
|
||||
await connection.query(sql)
|
||||
results.push({ statement: sql.replace(/IDENTIFIED BY\s+'[^']*'/ig, 'IDENTIFIED BY [REDACTED]'), status: 'PASS' })
|
||||
} catch (error) {
|
||||
results.push({ statement: sql.replace(/IDENTIFIED BY\s+'[^']*'/ig, 'IDENTIFIED BY [REDACTED]'), status: 'FAIL', error: error.message })
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
const [[countRow]] = await connection.query('SELECT COUNT(*) AS count FROM poc_doris.query_probe')
|
||||
if (Number(countRow.count) === 0) {
|
||||
const started = performance.now()
|
||||
await connection.query(`INSERT INTO poc_doris.query_probe
|
||||
SELECT number,
|
||||
MOD(number, 10),
|
||||
CONCAT('public-', LPAD(number, 9, '0')),
|
||||
CONCAT('secret-', LPAD(number, 9, '0')),
|
||||
REPEAT('x', 128)
|
||||
FROM numbers('number'='1000000')`)
|
||||
results.push({ statement: 'INSERT 1,000,000 deterministic rows from numbers()', status: 'PASS', elapsedMs: Math.round(performance.now() - started) })
|
||||
}
|
||||
|
||||
const [[finalCount]] = await connection.query('SELECT COUNT(*) AS count FROM poc_doris.query_probe')
|
||||
const [frontends] = await connection.query('SHOW FRONTENDS')
|
||||
const [backends] = await connection.query('SHOW BACKENDS')
|
||||
const [versionRows] = await connection.query('SELECT VERSION() AS version')
|
||||
const [workloadGroups] = await connection.query(`SHOW WORKLOAD GROUPS LIKE 'dataproduct_poc'`)
|
||||
await writeJson(path.join(evidence, 'bootstrap-results.json'), {
|
||||
statements: results,
|
||||
rows: Number(finalCount.count),
|
||||
version: versionRows[0].version,
|
||||
frontend: frontends.map(({ Host, Alive, IsMaster, Version }) => ({ Host, Alive, IsMaster, Version })),
|
||||
backend: backends.map(({ Host, Alive, Version }) => ({ Host, Alive, Version })),
|
||||
workloadGroup: workloadGroups,
|
||||
})
|
||||
|
||||
await connection.end()
|
||||
await fs.access(localDir)
|
||||
console.log(`PASS: Doris bootstrap complete; rows=${finalCount.count}; version=${versionRows[0].version}`)
|
||||
@@ -0,0 +1,197 @@
|
||||
import fs from 'node:fs/promises'
|
||||
import http from 'node:http'
|
||||
import path from 'node:path'
|
||||
import mysql from 'mysql2/promise'
|
||||
import { host, port, repoRoot, secret } from './common.mjs'
|
||||
|
||||
const listenPort = 35130
|
||||
const maxActive = 10
|
||||
const maxPageRows = 1000
|
||||
const maxDownloadRows = 5000
|
||||
const maxDownloadBytes = 2 * 1024 * 1024
|
||||
const queryTimeoutMs = 2000
|
||||
const rateLimit = 20
|
||||
const auditFile = path.join(repoRoot, 'evidence/M1/POC-DORIS-002/proxy-audit.jsonl')
|
||||
const password = await secret('integration-password')
|
||||
const clientToken = await secret('client-token')
|
||||
const pool = mysql.createPool({ host, port, user: 'poc_doris_integration', password, waitForConnections: true, connectionLimit: maxActive, queueLimit: maxActive, connectTimeout: 5000 })
|
||||
const inFlight = new Map()
|
||||
let active = 0
|
||||
let requestTimes = []
|
||||
|
||||
function json(response, status, body) {
|
||||
const value = JSON.stringify(body)
|
||||
response.writeHead(status, { 'content-type': 'application/json; charset=utf-8', 'content-length': Buffer.byteLength(value), 'cache-control': 'no-store' })
|
||||
response.end(value)
|
||||
return Buffer.byteLength(value)
|
||||
}
|
||||
|
||||
async function audit(record) {
|
||||
await fs.appendFile(auditFile, `${JSON.stringify({ at: new Date().toISOString(), principal: 'poc_doris_integration', ...record })}\n`)
|
||||
}
|
||||
|
||||
function rateAllowed() {
|
||||
const now = Date.now()
|
||||
requestTimes = requestTimes.filter((value) => now - value < 1000)
|
||||
if (requestTimes.length >= rateLimit) return false
|
||||
requestTimes.push(now)
|
||||
return true
|
||||
}
|
||||
|
||||
function isAuthorized(request) {
|
||||
return request.headers.authorization === `Bearer ${clientToken}`
|
||||
}
|
||||
|
||||
async function boundedQuery(sql, params, requestId) {
|
||||
const connection = await pool.getConnection()
|
||||
let cancel
|
||||
const cancelled = new Promise((_, reject) => {
|
||||
cancel = () => reject(Object.assign(new Error('bounded proxy query cancelled'), { code: 'POC_PROXY_CANCELLED' }))
|
||||
})
|
||||
inFlight.set(requestId, { connection, cancel })
|
||||
let timer
|
||||
try {
|
||||
const query = connection.query(sql, params)
|
||||
const timeout = new Promise((_, reject) => {
|
||||
timer = setTimeout(() => {
|
||||
connection.destroy()
|
||||
reject(Object.assign(new Error('bounded proxy query timeout'), { code: 'POC_PROXY_TIMEOUT' }))
|
||||
}, queryTimeoutMs)
|
||||
})
|
||||
return await Promise.race([query, timeout, cancelled])
|
||||
} finally {
|
||||
clearTimeout(timer)
|
||||
inFlight.delete(requestId)
|
||||
if (!connection._closing) connection.release()
|
||||
}
|
||||
}
|
||||
|
||||
const server = http.createServer(async (request, response) => {
|
||||
const started = performance.now()
|
||||
const url = new URL(request.url, `http://${request.headers.host ?? `127.0.0.1:${listenPort}`}`)
|
||||
const requestId = url.searchParams.get('requestId') || crypto.randomUUID()
|
||||
let status = 500
|
||||
let rows = 0
|
||||
let bytes = 0
|
||||
let outcome = 'error'
|
||||
try {
|
||||
if (url.pathname === '/health') {
|
||||
status = 200
|
||||
outcome = 'healthy'
|
||||
bytes = json(response, status, { status: 'UP', limits: { maxActive, maxPageRows, maxDownloadRows, maxDownloadBytes, queryTimeoutMs, rateLimit } })
|
||||
return
|
||||
}
|
||||
if (!isAuthorized(request)) {
|
||||
status = 401
|
||||
outcome = 'unauthorized'
|
||||
bytes = json(response, status, { error: 'unauthorized' })
|
||||
return
|
||||
}
|
||||
if (url.pathname === '/metrics') {
|
||||
status = 200
|
||||
outcome = 'metrics'
|
||||
bytes = json(response, status, { active, inFlight: inFlight.size, rssBytes: process.memoryUsage().rss, heapUsedBytes: process.memoryUsage().heapUsed })
|
||||
return
|
||||
}
|
||||
if (request.method === 'DELETE' && url.pathname.startsWith('/cancel/')) {
|
||||
const target = decodeURIComponent(url.pathname.slice('/cancel/'.length))
|
||||
const targetQuery = inFlight.get(target)
|
||||
if (!targetQuery) {
|
||||
status = 404
|
||||
outcome = 'not-found'
|
||||
bytes = json(response, status, { error: 'request is not active' })
|
||||
} else {
|
||||
targetQuery.cancel()
|
||||
targetQuery.connection.destroy()
|
||||
status = 202
|
||||
outcome = 'cancelled'
|
||||
bytes = json(response, status, { status: 'cancelled' })
|
||||
}
|
||||
return
|
||||
}
|
||||
if (!rateAllowed()) {
|
||||
status = 429
|
||||
outcome = 'rate-limited'
|
||||
bytes = json(response, status, { error: 'rate limit exceeded', retryAfterMs: 1000 })
|
||||
return
|
||||
}
|
||||
if (active >= maxActive) {
|
||||
status = 429
|
||||
outcome = 'concurrency-limited'
|
||||
bytes = json(response, status, { error: 'concurrency limit exceeded' })
|
||||
return
|
||||
}
|
||||
active += 1
|
||||
if (url.pathname === '/query') {
|
||||
const limit = Number(url.searchParams.get('limit') || 20)
|
||||
const offset = Number(url.searchParams.get('offset') || 0)
|
||||
if (!Number.isInteger(limit) || !Number.isInteger(offset) || limit < 1 || limit > maxPageRows || offset < 0) {
|
||||
status = 400
|
||||
outcome = 'invalid-page'
|
||||
bytes = json(response, status, { error: `limit must be 1-${maxPageRows}; offset must be non-negative` })
|
||||
return
|
||||
}
|
||||
const [result] = await boundedQuery('SELECT id, tenant_id, public_value FROM poc_doris.query_probe ORDER BY id LIMIT ? OFFSET ?', [limit, offset], requestId)
|
||||
rows = result.length
|
||||
status = 200
|
||||
outcome = 'success'
|
||||
bytes = json(response, status, { requestId, rows: result })
|
||||
return
|
||||
}
|
||||
if (url.pathname === '/download') {
|
||||
const limit = Number(url.searchParams.get('limit') || maxDownloadRows)
|
||||
if (!Number.isInteger(limit) || limit < 1 || limit > maxDownloadRows) {
|
||||
status = 413
|
||||
outcome = 'row-cap'
|
||||
bytes = json(response, status, { error: `download row cap is ${maxDownloadRows}` })
|
||||
return
|
||||
}
|
||||
const [result] = await boundedQuery('SELECT id, tenant_id, public_value, padding FROM poc_doris.query_probe ORDER BY id LIMIT ?', [limit], requestId)
|
||||
const csv = ['id,tenant_id,public_value,padding', ...result.map((row) => `${row.id},${row.tenant_id},${row.public_value},${row.padding}`)].join('\n')
|
||||
bytes = Buffer.byteLength(csv)
|
||||
if (bytes > maxDownloadBytes) {
|
||||
status = 413
|
||||
outcome = 'byte-cap'
|
||||
bytes = json(response, status, { error: `download byte cap is ${maxDownloadBytes}` })
|
||||
return
|
||||
}
|
||||
rows = result.length
|
||||
status = 200
|
||||
outcome = 'success'
|
||||
response.writeHead(status, { 'content-type': 'text/csv; charset=utf-8', 'content-length': bytes, 'cache-control': 'no-store' })
|
||||
response.end(csv)
|
||||
return
|
||||
}
|
||||
if (url.pathname === '/slow') {
|
||||
const seconds = Math.max(0, Math.min(30, Number(url.searchParams.get('seconds') || 5)))
|
||||
await boundedQuery('SELECT SLEEP(?) AS slept', [seconds], requestId)
|
||||
rows = 1
|
||||
status = 200
|
||||
outcome = 'success'
|
||||
bytes = json(response, status, { requestId, status: 'completed' })
|
||||
return
|
||||
}
|
||||
status = 404
|
||||
outcome = 'not-found'
|
||||
bytes = json(response, status, { error: 'not found' })
|
||||
} catch (error) {
|
||||
status = error.code === 'POC_PROXY_TIMEOUT' ? 504 : error.code === 'POC_PROXY_CANCELLED' ? 499 : 500
|
||||
outcome = error.code === 'POC_PROXY_TIMEOUT' ? 'timeout' : error.code === 'POC_PROXY_CANCELLED' ? 'cancelled-request' : 'query-error'
|
||||
bytes = json(response, status, { error: outcome })
|
||||
} finally {
|
||||
if (!['/health', '/metrics'].includes(url.pathname) && !(request.method === 'DELETE' && url.pathname.startsWith('/cancel/'))) active = Math.max(0, active - 1)
|
||||
await audit({ requestId, method: request.method, path: url.pathname, status, outcome, rows, bytes, elapsedMs: Math.round((performance.now() - started) * 100) / 100 })
|
||||
}
|
||||
})
|
||||
|
||||
server.listen(listenPort, '127.0.0.1', () => {
|
||||
console.log(`bounded Doris POC proxy listening on 127.0.0.1:${listenPort}`)
|
||||
})
|
||||
|
||||
async function shutdown() {
|
||||
server.close()
|
||||
for (const targetQuery of inFlight.values()) targetQuery.connection.destroy()
|
||||
await pool.end()
|
||||
}
|
||||
process.on('SIGINT', async () => { await shutdown(); process.exit(0) })
|
||||
process.on('SIGTERM', async () => { await shutdown(); process.exit(0) })
|
||||
@@ -0,0 +1,40 @@
|
||||
import fs from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import mysql from 'mysql2/promise'
|
||||
|
||||
export const scriptDir = path.resolve(import.meta.dirname, '..')
|
||||
export const repoRoot = path.resolve(scriptDir, '../../../..')
|
||||
export const localDir = path.join(scriptDir, 'local')
|
||||
export const host = '127.0.0.1'
|
||||
export const port = 35090
|
||||
|
||||
export async function secret(name) {
|
||||
return (await fs.readFile(path.join(localDir, `${name}.secret`), 'utf8')).trim()
|
||||
}
|
||||
|
||||
export async function connect(user, password, extra = {}) {
|
||||
return mysql.createConnection({
|
||||
host,
|
||||
port,
|
||||
user,
|
||||
password,
|
||||
namedPlaceholders: true,
|
||||
connectTimeout: 5000,
|
||||
decimalNumbers: true,
|
||||
...extra,
|
||||
})
|
||||
}
|
||||
|
||||
export async function rootConnection() {
|
||||
const rootPassword = await secret('root-password')
|
||||
try {
|
||||
return await connect('root', rootPassword, { multipleStatements: true })
|
||||
} catch {
|
||||
return connect('root', '', { multipleStatements: true })
|
||||
}
|
||||
}
|
||||
|
||||
export async function writeJson(file, value) {
|
||||
await fs.mkdir(path.dirname(file), { recursive: true })
|
||||
await fs.writeFile(file, `${JSON.stringify(value, null, 2)}\n`)
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import path from 'node:path'
|
||||
import { connect, repoRoot, secret, writeJson } from './common.mjs'
|
||||
|
||||
const evidence = path.join(repoRoot, 'evidence/M1/POC-DORIS-002')
|
||||
const devPassword = await secret('dev-password')
|
||||
const clientToken = await secret('client-token')
|
||||
const started = Date.now()
|
||||
const directAttempts = []
|
||||
let directResult = { status: 'FAIL', visibleRows: null }
|
||||
for (let attempt = 1; attempt <= 60; attempt += 1) {
|
||||
let direct
|
||||
try {
|
||||
direct = await connect('poc_doris_dev', devPassword)
|
||||
const [rows] = await direct.query('SELECT COUNT(*) AS count FROM poc_doris.query_probe')
|
||||
const visibleRows = Number(rows[0].count)
|
||||
directAttempts.push({ attempt, elapsedMs: Date.now() - started, status: 'PASS', visibleRows })
|
||||
directResult = { status: visibleRows === 100000 ? 'PASS' : 'FAIL', visibleRows }
|
||||
break
|
||||
} catch (error) {
|
||||
directAttempts.push({ attempt, elapsedMs: Date.now() - started, status: 'FAIL', errorCode: error.code, error: error.message })
|
||||
} finally {
|
||||
await direct?.end().catch(() => {})
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
}
|
||||
|
||||
let proxyResult = { status: 'FAIL', httpStatus: null, rows: 0 }
|
||||
if (directResult.status === 'PASS') {
|
||||
const response = await fetch('http://127.0.0.1:35130/query?limit=10&offset=0', {
|
||||
headers: { authorization: `Bearer ${clientToken}` },
|
||||
})
|
||||
const body = await response.json()
|
||||
proxyResult = { status: response.status === 200 && body.rows?.length === 10 ? 'PASS' : 'FAIL', httpStatus: response.status, rows: body.rows?.length ?? 0 }
|
||||
}
|
||||
const result = {
|
||||
checkedAt: new Date().toISOString(),
|
||||
businessRecoveryElapsedMs: Date.now() - started,
|
||||
directAttempts,
|
||||
direct: directResult,
|
||||
integrationProxy: proxyResult,
|
||||
}
|
||||
await writeJson(path.join(evidence, 'recovery-results.json'), result)
|
||||
if (result.direct.status !== 'PASS' || result.integrationProxy.status !== 'PASS') {
|
||||
throw new Error(`Doris recovery probe failed: ${JSON.stringify(result)}`)
|
||||
}
|
||||
console.log('PASS: direct and bounded-proxy paths recovered after the BE restart')
|
||||
@@ -0,0 +1,2 @@
|
||||
/local/
|
||||
*.secret
|
||||
@@ -0,0 +1,47 @@
|
||||
FROM bellsoft/liberica-openjdk-rocky:21.0.12-cds@sha256:b8493dbedf98eb152731f75ef52b9e6cd2fecc0f54684d5a5d7abd7703139490
|
||||
|
||||
USER root
|
||||
|
||||
COPY local/artifacts/hadoop-3.4.1.tar.gz /tmp/hadoop-3.4.1.tar.gz
|
||||
COPY local/artifacts/apache-hive-4.2.0-bin.tar.gz /tmp/apache-hive-4.2.0-bin.tar.gz
|
||||
COPY local/artifacts/apache-tez-0.10.5-bin.tar.gz /tmp/apache-tez-0.10.5-bin.tar.gz
|
||||
|
||||
RUN microdnf -y install procps-ng shadow-utils && \
|
||||
microdnf clean all && \
|
||||
tar -xzf /tmp/hadoop-3.4.1.tar.gz -C /opt && \
|
||||
mv /opt/hadoop-3.4.1 /opt/hadoop && \
|
||||
rm -rf /opt/hadoop/share/doc && \
|
||||
tar -xzf /tmp/apache-hive-4.2.0-bin.tar.gz -C /opt && \
|
||||
mv /opt/apache-hive-4.2.0-bin /opt/hive && \
|
||||
rm -rf /opt/hive/jdbc && \
|
||||
tar -xzf /tmp/apache-tez-0.10.5-bin.tar.gz -C /opt && \
|
||||
mv /opt/apache-tez-0.10.5-bin /opt/tez && \
|
||||
rm -rf /opt/tez/share && \
|
||||
rm -f /tmp/hadoop-3.4.1.tar.gz /tmp/apache-hive-4.2.0-bin.tar.gz /tmp/apache-tez-0.10.5-bin.tar.gz && \
|
||||
(id hive >/dev/null 2>&1 || useradd --no-create-home --shell /sbin/nologin --uid 1000 hive) && \
|
||||
install -d -o hive -g hive /opt/hive/data/warehouse /home/hive/.beeline /opt/aixun-poc && \
|
||||
chown -R hive:hive /opt/hadoop /opt/hive /opt/tez
|
||||
|
||||
ADD --chmod=0444 --checksum=sha256:f2ca3dfaf00d4aa311470db7ea3051962944ba0cb60005a2f75467549c39f425 \
|
||||
https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/9.5.0/mysql-connector-j-9.5.0.jar \
|
||||
/opt/hive/lib/mysql-connector-j-9.5.0.jar
|
||||
|
||||
COPY --chmod=0555 start-hive.sh /opt/aixun-poc/start-hive.sh
|
||||
COPY --chmod=0555 apache-entrypoint.sh /entrypoint.sh
|
||||
COPY auth/HiveSecretAuthenticator.java /tmp/HiveSecretAuthenticator.java
|
||||
|
||||
RUN install -d /tmp/hive-auth-classes && \
|
||||
javac -cp '/opt/hive/lib/*' -d /tmp/hive-auth-classes /tmp/HiveSecretAuthenticator.java && \
|
||||
jar --create --file /opt/hive/lib/aixun-datagov-hive-auth-poc.jar -C /tmp/hive-auth-classes . && \
|
||||
rm -rf /tmp/hive-auth-classes /tmp/HiveSecretAuthenticator.java && \
|
||||
chown hive:hive /opt/hive/lib/aixun-datagov-hive-auth-poc.jar
|
||||
|
||||
ENV HADOOP_HOME=/opt/hadoop \
|
||||
HIVE_HOME=/opt/hive \
|
||||
TEZ_HOME=/opt/tez \
|
||||
HIVE_VER=4.2.0 \
|
||||
PATH=/opt/hive/bin:/opt/hadoop/bin:${PATH}
|
||||
|
||||
USER hive
|
||||
WORKDIR /opt/hive
|
||||
ENTRYPOINT ["/opt/aixun-poc/start-hive.sh"]
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Derived from Apache Hive tag rel/release-4.2.0
|
||||
# packaging/src/docker/entrypoint.sh (Apache-2.0), narrowed to the two fixed
|
||||
# 4.2.0 services used by this POC.
|
||||
|
||||
set -x
|
||||
|
||||
: "${DB_DRIVER:=derby}"
|
||||
|
||||
SKIP_SCHEMA_INIT="${IS_RESUME:-false}"
|
||||
[[ ${VERBOSE:-false} = "true" ]] && VERBOSE_MODE="--verbose"
|
||||
|
||||
initialize_hive() {
|
||||
command_name="-initOrUpgradeSchema"
|
||||
if [[ -n "${VERBOSE_MODE:-}" ]]; then
|
||||
"$HIVE_HOME/bin/schematool" -dbType "$DB_DRIVER" "$command_name" "$VERBOSE_MODE"
|
||||
else
|
||||
"$HIVE_HOME/bin/schematool" -dbType "$DB_DRIVER" "$command_name"
|
||||
fi
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo "Initialized Hive Metastore Server schema successfully."
|
||||
else
|
||||
echo "Hive Metastore Server schema initialization failed!" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
export HIVE_CONF_DIR=$HIVE_HOME/conf
|
||||
if [[ -d "${HIVE_CUSTOM_CONF_DIR:-}" ]]; then
|
||||
find "$HIVE_CUSTOM_CONF_DIR" -type f -exec ln -sfn {} "$HIVE_CONF_DIR"/ \;
|
||||
export HADOOP_CONF_DIR=$HIVE_CONF_DIR
|
||||
export TEZ_CONF_DIR=$HIVE_CONF_DIR
|
||||
fi
|
||||
|
||||
export HADOOP_CLIENT_OPTS="${HADOOP_CLIENT_OPTS:-} -Xmx1G ${SERVICE_OPTS:-}"
|
||||
if [[ "$SKIP_SCHEMA_INIT" == "false" ]]; then
|
||||
initialize_hive
|
||||
fi
|
||||
|
||||
if [[ "${SERVICE_NAME:-}" == "hiveserver2" ]]; then
|
||||
export HADOOP_CLASSPATH="$TEZ_HOME/*:$TEZ_HOME/lib/*:${HADOOP_CLASSPATH:-}"
|
||||
exec "$HIVE_HOME/bin/hive" --skiphadoopversion --skiphbasecp --service "$SERVICE_NAME"
|
||||
elif [[ "${SERVICE_NAME:-}" == "metastore" ]]; then
|
||||
export METASTORE_PORT=${METASTORE_PORT:-9083}
|
||||
exec "$HIVE_HOME/bin/hive" --skiphadoopversion --skiphbasecp --service "$SERVICE_NAME"
|
||||
else
|
||||
echo "unsupported Hive service" >&2
|
||||
exit 64
|
||||
fi
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.aixunkeji.datagov.poc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.security.MessageDigest;
|
||||
import javax.security.sasl.AuthenticationException;
|
||||
import org.apache.hive.service.auth.PasswdAuthenticationProvider;
|
||||
|
||||
/** POC-only HiveServer2 custom authenticator backed by read-only Docker secretRefs. */
|
||||
public final class HiveSecretAuthenticator implements PasswdAuthenticationProvider {
|
||||
private static final Path SECRET_ROOT = Path.of("/run/secrets");
|
||||
private static final String[] PRINCIPALS = {"admin", "dev", "test"};
|
||||
|
||||
@Override
|
||||
public void authenticate(String user, String password) throws AuthenticationException {
|
||||
for (String principal : PRINCIPALS) {
|
||||
try {
|
||||
String expectedUser = read("hive_auth_" + principal + "_username");
|
||||
String expectedPassword = read("hive_auth_" + principal + "_password");
|
||||
long expiresAt = Long.parseLong(read("hive_auth_" + principal + "_expiry_epoch"));
|
||||
boolean userMatches = MessageDigest.isEqual(
|
||||
expectedUser.getBytes(StandardCharsets.UTF_8), user.getBytes(StandardCharsets.UTF_8));
|
||||
boolean passwordMatches = MessageDigest.isEqual(
|
||||
expectedPassword.getBytes(StandardCharsets.UTF_8), password.getBytes(StandardCharsets.UTF_8));
|
||||
if (userMatches && passwordMatches && System.currentTimeMillis() / 1000L < expiresAt) {
|
||||
return;
|
||||
}
|
||||
} catch (IOException | NumberFormatException ignored) {
|
||||
throw new AuthenticationException("Hive POC authentication backend unavailable");
|
||||
}
|
||||
}
|
||||
throw new AuthenticationException("Invalid or expired Hive POC credential");
|
||||
}
|
||||
|
||||
private static String read(String name) throws IOException {
|
||||
return Files.readString(SECRET_ROOT.resolve(name), StandardCharsets.UTF_8).trim();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.0.45@sha256:4af1f8815716546f5b12410f7621f37f93db8dd11a184706ef59111930b8c2ff
|
||||
container_name: aixun-datagov-poc-hive-mysql
|
||||
restart: unless-stopped
|
||||
command: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]
|
||||
environment:
|
||||
MYSQL_DATABASE: aixun_datagov_poc_hive_metastore
|
||||
MYSQL_USER: hive_metastore
|
||||
MYSQL_PASSWORD_FILE: /run/secrets/hive_mysql_password
|
||||
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/hive_mysql_root_password
|
||||
secrets:
|
||||
- hive_mysql_password
|
||||
- hive_mysql_root_password
|
||||
ports:
|
||||
- "127.0.0.1:34006:3306"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "MYSQL_PWD=$$(cat /run/secrets/hive_mysql_password) mysqladmin ping -h 127.0.0.1 -u hive_metastore --silent"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
volumes:
|
||||
- hive_mysql_data:/var/lib/mysql
|
||||
networks:
|
||||
- hive_net
|
||||
labels: &poc_labels
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
com.aixun.poc: POC-HIVE-001
|
||||
|
||||
minio:
|
||||
image: minio/minio:RELEASE.2025-04-22T22-12-26Z@sha256:a1ea29fa28355559ef137d71fc570e508a214ec84ff8083e39bc5428980b015e
|
||||
container_name: aixun-datagov-poc-hive-minio
|
||||
restart: unless-stopped
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
command:
|
||||
- >-
|
||||
export MINIO_ROOT_USER="$$(cat /run/secrets/minio_root_user)";
|
||||
export MINIO_ROOT_PASSWORD="$$(cat /run/secrets/minio_root_password)";
|
||||
exec minio server /data --console-address :9001
|
||||
secrets:
|
||||
- minio_root_user
|
||||
- minio_root_password
|
||||
ports:
|
||||
- "127.0.0.1:34001:9000"
|
||||
- "127.0.0.1:34002:9001"
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:9000/minio/health/live"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
volumes:
|
||||
- hive_minio_data:/data
|
||||
networks:
|
||||
- hive_net
|
||||
labels: *poc_labels
|
||||
|
||||
minio-tools:
|
||||
image: minio/mc:RELEASE.2025-04-16T18-13-26Z@sha256:aead63c77f9db9107f1696fb08ecb0faeda23729cde94b0f663edf4fe09728e3
|
||||
container_name: aixun-datagov-poc-hive-tools
|
||||
restart: unless-stopped
|
||||
entrypoint: ["/opt/aixun-poc/minio-bootstrap.sh"]
|
||||
depends_on:
|
||||
minio:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "test", "-f", "/tmp/bootstrap-ready"]
|
||||
interval: 3s
|
||||
timeout: 2s
|
||||
retries: 20
|
||||
secrets:
|
||||
- minio_root_user
|
||||
- minio_root_password
|
||||
- hive_s3_access_key
|
||||
- hive_s3_secret_key
|
||||
volumes:
|
||||
- ./minio-bootstrap.sh:/opt/aixun-poc/minio-bootstrap.sh:ro
|
||||
- ./hive-bucket-policy.json:/opt/aixun-poc/hive-bucket-policy.json:ro
|
||||
networks:
|
||||
- hive_net
|
||||
labels: *poc_labels
|
||||
|
||||
hms:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: aixun-datagov/poc-hive:4.2.0-authz-1
|
||||
container_name: aixun-datagov-poc-hive-hms
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
SERVICE_NAME: metastore
|
||||
DB_DRIVER: mysql
|
||||
HIVE_VER: 4.2.0
|
||||
IS_RESUME: "false"
|
||||
HIVE_POC_AUTH_ENABLED: "true"
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
minio-tools:
|
||||
condition: service_healthy
|
||||
secrets:
|
||||
- hive_mysql_password
|
||||
- hive_s3_access_key
|
||||
- hive_s3_secret_key
|
||||
- hive_auth_admin_username
|
||||
- hive_auth_admin_password
|
||||
- hive_auth_admin_expiry_epoch
|
||||
- hive_auth_dev_username
|
||||
- hive_auth_dev_password
|
||||
- hive_auth_dev_expiry_epoch
|
||||
- hive_auth_test_username
|
||||
- hive_auth_test_password
|
||||
- hive_auth_test_expiry_epoch
|
||||
ports:
|
||||
- "127.0.0.1:34083:9083"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "bash -c '</dev/tcp/127.0.0.1/9083'"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
start_period: 30s
|
||||
networks:
|
||||
- hive_net
|
||||
labels: *poc_labels
|
||||
|
||||
hiveserver2:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: aixun-datagov/poc-hive:4.2.0-authz-1
|
||||
container_name: aixun-datagov-poc-hive-hs2
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
SERVICE_NAME: hiveserver2
|
||||
DB_DRIVER: mysql
|
||||
HIVE_VER: 4.2.0
|
||||
IS_RESUME: "true"
|
||||
HIVE_POC_AUTH_ENABLED: "true"
|
||||
depends_on:
|
||||
hms:
|
||||
condition: service_healthy
|
||||
secrets:
|
||||
- hive_mysql_password
|
||||
- hive_s3_access_key
|
||||
- hive_s3_secret_key
|
||||
- hive_auth_admin_username
|
||||
- hive_auth_admin_password
|
||||
- hive_auth_admin_expiry_epoch
|
||||
- hive_auth_dev_username
|
||||
- hive_auth_dev_password
|
||||
- hive_auth_dev_expiry_epoch
|
||||
- hive_auth_test_username
|
||||
- hive_auth_test_password
|
||||
- hive_auth_test_expiry_epoch
|
||||
ports:
|
||||
- "127.0.0.1:34000:10000"
|
||||
- "127.0.0.1:34003:10002"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "bash -c '</dev/tcp/127.0.0.1/10000'"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
start_period: 30s
|
||||
networks:
|
||||
- hive_net
|
||||
labels: *poc_labels
|
||||
|
||||
secrets:
|
||||
hive_mysql_root_password:
|
||||
file: ./local/hive-mysql-root.secret
|
||||
hive_mysql_password:
|
||||
file: ./local/hive-mysql-app.secret
|
||||
minio_root_user:
|
||||
file: ./local/minio-root-user.secret
|
||||
minio_root_password:
|
||||
file: ./local/minio-root-password.secret
|
||||
hive_s3_access_key:
|
||||
file: ./local/hive-s3-access-key.secret
|
||||
hive_s3_secret_key:
|
||||
file: ./local/hive-s3-secret-key.secret
|
||||
hive_auth_admin_username:
|
||||
file: ./local/hive-auth-admin-username.secret
|
||||
hive_auth_admin_password:
|
||||
file: ./local/hive-auth-admin-password.secret
|
||||
hive_auth_admin_expiry_epoch:
|
||||
file: ./local/hive-auth-admin-expiry-epoch.secret
|
||||
hive_auth_dev_username:
|
||||
file: ./local/hive-auth-dev-username.secret
|
||||
hive_auth_dev_password:
|
||||
file: ./local/hive-auth-dev-password.secret
|
||||
hive_auth_dev_expiry_epoch:
|
||||
file: ./local/hive-auth-dev-expiry-epoch.secret
|
||||
hive_auth_test_username:
|
||||
file: ./local/hive-auth-test-username.secret
|
||||
hive_auth_test_password:
|
||||
file: ./local/hive-auth-test-password.secret
|
||||
hive_auth_test_expiry_epoch:
|
||||
file: ./local/hive-auth-test-expiry-epoch.secret
|
||||
|
||||
networks:
|
||||
hive_net:
|
||||
name: aixun-datagov-poc-hive-net
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
|
||||
volumes:
|
||||
hive_mysql_data:
|
||||
name: aixun-datagov-poc-hive-mysql-data
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
hive_minio_data:
|
||||
name: aixun-datagov-poc-hive-minio-data
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd "$(dirname "$0")" && pwd -P)
|
||||
artifact_dir="$script_dir/local/artifacts"
|
||||
install -d -m 0700 "$artifact_dir"
|
||||
|
||||
download_and_verify() {
|
||||
artifact_name=$1
|
||||
mirror_url=$2
|
||||
checksum_url=$3
|
||||
checksum_algorithm=$4
|
||||
target_file="$artifact_dir/$artifact_name"
|
||||
checksum_file="$artifact_dir/$artifact_name.$checksum_algorithm"
|
||||
|
||||
curl -fL --retry 5 --retry-delay 2 --continue-at - \
|
||||
--output "$target_file" "$mirror_url"
|
||||
curl -fsSL --retry 5 --output "$checksum_file" "$checksum_url"
|
||||
|
||||
if [[ "$checksum_algorithm" == sha256 ]]; then
|
||||
(cd "$artifact_dir" && shasum -a 256 -c "$(basename "$checksum_file")")
|
||||
else
|
||||
(cd "$artifact_dir" && shasum -a 512 -c "$(basename "$checksum_file")")
|
||||
fi
|
||||
}
|
||||
|
||||
download_and_verify \
|
||||
hadoop-3.4.1.tar.gz \
|
||||
https://mirrors.huaweicloud.com/apache/hadoop/common/hadoop-3.4.1/hadoop-3.4.1.tar.gz \
|
||||
https://archive.apache.org/dist/hadoop/common/hadoop-3.4.1/hadoop-3.4.1.tar.gz.sha512 \
|
||||
sha512
|
||||
download_and_verify \
|
||||
apache-tez-0.10.5-bin.tar.gz \
|
||||
https://mirrors.huaweicloud.com/apache/tez/0.10.5/apache-tez-0.10.5-bin.tar.gz \
|
||||
https://downloads.apache.org/tez/0.10.5/apache-tez-0.10.5-bin.tar.gz.sha512 \
|
||||
sha512
|
||||
download_and_verify \
|
||||
apache-hive-4.2.0-bin.tar.gz \
|
||||
https://mirrors.huaweicloud.com/apache/hive/hive-4.2.0/apache-hive-4.2.0-bin.tar.gz \
|
||||
https://downloads.apache.org/hive/hive-4.2.0/apache-hive-4.2.0-bin.tar.gz.sha256 \
|
||||
sha256
|
||||
|
||||
chmod 0600 "$artifact_dir"/*
|
||||
echo "PASS: official Apache artifacts downloaded through a mirror and verified against Apache checksums"
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd "$(dirname "$0")" && pwd -P)
|
||||
secret_dir="$script_dir/local"
|
||||
rotate=${1:-}
|
||||
install -d -m 0700 "$secret_dir"
|
||||
|
||||
for principal in admin dev test; do
|
||||
username_file="$secret_dir/hive-auth-$principal-username.secret"
|
||||
password_file="$secret_dir/hive-auth-$principal-password.secret"
|
||||
expiry_file="$secret_dir/hive-auth-$principal-expiry-epoch.secret"
|
||||
if [[ ! -f "$username_file" ]]; then
|
||||
printf 'poc_hive_%s' "$principal" >"$username_file"
|
||||
fi
|
||||
if [[ "$rotate" == "--rotate-$principal" || ! -f "$password_file" ]]; then
|
||||
printf 'Aa1!%s' "$(openssl rand -hex 10)" >"$password_file"
|
||||
fi
|
||||
if [[ "$rotate" == "--expire-$principal" ]]; then
|
||||
printf '%s' "$(( $(date +%s) - 1 ))" >"$expiry_file"
|
||||
elif [[ "$rotate" == "--rotate-$principal" || "$rotate" == "--unexpire-$principal" || ! -f "$expiry_file" ]]; then
|
||||
printf '%s' "$(( $(date +%s) + 86400 ))" >"$expiry_file"
|
||||
fi
|
||||
done
|
||||
chmod 0600 "$secret_dir"/hive-auth-*.secret
|
||||
echo "PASS: Hive authentication secretRefs updated without printing values"
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd "$(dirname "$0")" && pwd -P)
|
||||
secret_dir="$script_dir/local"
|
||||
install -d -m 0700 "$secret_dir"
|
||||
|
||||
secret_files=(
|
||||
hive-mysql-root.secret
|
||||
hive-mysql-app.secret
|
||||
minio-root-user.secret
|
||||
minio-root-password.secret
|
||||
hive-s3-access-key.secret
|
||||
hive-s3-secret-key.secret
|
||||
)
|
||||
|
||||
for secret_file in "${secret_files[@]}"; do
|
||||
if [[ -e "$secret_dir/$secret_file" ]]; then
|
||||
echo "FAIL: refusing to overwrite existing secretRef $secret_file" >&2
|
||||
exit 73
|
||||
fi
|
||||
done
|
||||
|
||||
umask 077
|
||||
openssl rand -hex 24 >"$secret_dir/hive-mysql-root.secret"
|
||||
openssl rand -hex 24 >"$secret_dir/hive-mysql-app.secret"
|
||||
printf 'dgminio%s\n' "$(openssl rand -hex 8)" >"$secret_dir/minio-root-user.secret"
|
||||
openssl rand -hex 24 >"$secret_dir/minio-root-password.secret"
|
||||
printf 'dghive%s\n' "$(openssl rand -hex 8)" >"$secret_dir/hive-s3-access-key.secret"
|
||||
openssl rand -hex 24 >"$secret_dir/hive-s3-secret-key.secret"
|
||||
chmod 0600 "$secret_dir"/*.secret
|
||||
|
||||
echo "PASS: six local secretRefs created with mode 0600; values were not printed"
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:ListBucket", "s3:GetBucketLocation"],
|
||||
"Resource": ["arn:aws:s3:::aixun-datagov-poc-hive"]
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"],
|
||||
"Resource": ["arn:aws:s3:::aixun-datagov-poc-hive/*"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
for secret_file in \
|
||||
/run/secrets/minio_root_user \
|
||||
/run/secrets/minio_root_password \
|
||||
/run/secrets/hive_s3_access_key \
|
||||
/run/secrets/hive_s3_secret_key
|
||||
do
|
||||
if [ ! -r "$secret_file" ]; then
|
||||
echo "required secretRef is unavailable" >&2
|
||||
exit 70
|
||||
fi
|
||||
done
|
||||
|
||||
root_user=$(cat /run/secrets/minio_root_user)
|
||||
root_password=$(cat /run/secrets/minio_root_password)
|
||||
hive_access_key=$(cat /run/secrets/hive_s3_access_key)
|
||||
hive_secret_key=$(cat /run/secrets/hive_s3_secret_key)
|
||||
|
||||
mc alias set poc http://minio:9000 "$root_user" "$root_password" >/dev/null 2>&1
|
||||
mc mb --ignore-existing poc/aixun-datagov-poc-hive >/dev/null 2>&1
|
||||
mc mb --ignore-existing poc/aixun-datagov-poc-hive-backup >/dev/null 2>&1
|
||||
mc admin policy create poc aixun-datagov-poc-hive-rw /opt/aixun-poc/hive-bucket-policy.json >/dev/null 2>&1 || \
|
||||
mc admin policy info poc aixun-datagov-poc-hive-rw >/dev/null 2>&1
|
||||
mc admin user add poc "$hive_access_key" "$hive_secret_key" >/dev/null 2>&1
|
||||
mc admin policy attach poc aixun-datagov-poc-hive-rw --user "$hive_access_key" >/dev/null 2>&1
|
||||
|
||||
unset root_user root_password hive_access_key hive_secret_key
|
||||
touch /tmp/bootstrap-ready
|
||||
echo "PASS: object-store bucket and least-scope POC policy are ready"
|
||||
exec tail -f /dev/null
|
||||
@@ -0,0 +1,153 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
script_dir="$repo_root/script/datagov/poc/hive"
|
||||
auth_evidence="$repo_root/evidence/M1/POC-AUTH-001/hive"
|
||||
sec_evidence="$repo_root/evidence/M1/POC-SEC-001/hive"
|
||||
container=aixun-datagov-poc-hive-hs2
|
||||
mkdir -p "$auth_evidence" "$sec_evidence"
|
||||
|
||||
run_query() {
|
||||
principal=$1
|
||||
sql=$2
|
||||
output=$3
|
||||
password_path="/run/secrets/hive_auth_${principal}_password"
|
||||
username=$(tr -d '\r\n' <"$script_dir/local/hive-auth-$principal-username.secret")
|
||||
set +e
|
||||
docker exec \
|
||||
-e POC_USER="$username" \
|
||||
-e POC_PASSWORD_PATH="$password_path" \
|
||||
-e POC_SQL="$sql" \
|
||||
"$container" bash -lc '
|
||||
TERM=dumb JAVA_TOOL_OPTIONS=-Dorg.jline.terminal.dumb=true \
|
||||
/opt/hive/bin/beeline --silent=true --showHeader=true --outputformat=tsv2 \
|
||||
-u jdbc:hive2://127.0.0.1:10000/default \
|
||||
-n "$POC_USER" -p "$(cat "$POC_PASSWORD_PATH")" -e "$POC_SQL"
|
||||
' >"$output" 2>"$output.stderr"
|
||||
status=$?
|
||||
set -e
|
||||
printf 'exit_code=%s\n' "$status" >>"$output"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
expect_success() {
|
||||
principal=$1
|
||||
sql=$2
|
||||
output=$3
|
||||
marker=$4
|
||||
run_query "$principal" "$sql" "$output" || {
|
||||
echo "FAIL: expected success: $output" >&2
|
||||
return 1
|
||||
}
|
||||
rg -F "$marker" "$output" >/dev/null || {
|
||||
echo "FAIL: expected marker is absent: $marker" >&2
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
expect_failure() {
|
||||
principal=$1
|
||||
sql=$2
|
||||
output=$3
|
||||
if run_query "$principal" "$sql" "$output"; then
|
||||
echo "FAIL: expected denial: $output" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Each configured identity can authenticate and is reported independently.
|
||||
expect_success admin 'SELECT current_user() AS authenticated_user' "$auth_evidence/admin-allow.tsv" poc_hive_admin
|
||||
expect_success dev 'SELECT current_user() AS authenticated_user' "$auth_evidence/dev-allow.tsv" poc_hive_dev
|
||||
expect_success test 'SELECT current_user() AS authenticated_user' "$auth_evidence/test-allow.tsv" poc_hive_test
|
||||
|
||||
# Missing and wrong credentials fail before a session is created.
|
||||
set +e
|
||||
docker exec "$container" bash -lc '
|
||||
TERM=dumb JAVA_TOOL_OPTIONS=-Dorg.jline.terminal.dumb=true \
|
||||
/opt/hive/bin/beeline --silent=true --outputformat=tsv2 \
|
||||
-u jdbc:hive2://127.0.0.1:10000/default -n poc_hive_missing -p "" -e "SELECT 1"
|
||||
' >"$auth_evidence/missing-credentials.txt" 2>"$auth_evidence/missing-credentials.stderr"
|
||||
missing_status=$?
|
||||
docker exec "$container" bash -lc '
|
||||
TERM=dumb JAVA_TOOL_OPTIONS=-Dorg.jline.terminal.dumb=true \
|
||||
/opt/hive/bin/beeline --silent=true --outputformat=tsv2 \
|
||||
-u jdbc:hive2://127.0.0.1:10000/default -n poc_hive_dev -p "invalid-poc-password" -e "SELECT 1"
|
||||
' >"$auth_evidence/wrong-credentials.txt" 2>"$auth_evidence/wrong-credentials.stderr"
|
||||
wrong_status=$?
|
||||
set -e
|
||||
printf 'exit_code=%s\n' "$missing_status" >>"$auth_evidence/missing-credentials.txt"
|
||||
printf 'exit_code=%s\n' "$wrong_status" >>"$auth_evidence/wrong-credentials.txt"
|
||||
(( missing_status != 0 && wrong_status != 0 )) || {
|
||||
echo 'FAIL: missing or wrong credentials did not fail closed' >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Table policy: apply/readback is in the setup evidence; now prove allow and deny.
|
||||
expect_success dev 'SELECT COUNT(*) AS permitted_rows FROM poc_sec.auth_probe' "$sec_evidence/table-allow-dev.tsv" '2'
|
||||
expect_failure test 'SELECT COUNT(*) FROM poc_sec.auth_probe' "$sec_evidence/table-deny-test.tsv"
|
||||
expect_failure dev 'SHOW ROLES' "$auth_evidence/dev-admin-deny.tsv"
|
||||
|
||||
# Export attempts remain governed by the source table privilege.
|
||||
expect_failure test "INSERT OVERWRITE LOCAL DIRECTORY '/tmp/poc-sec-denied-export' SELECT * FROM poc_sec.auth_probe" "$sec_evidence/export-deny-test.tsv"
|
||||
|
||||
# Expiry is evaluated on every new authentication attempt.
|
||||
"$script_dir/generate-auth-secrets.sh" --expire-test >"$auth_evidence/expire-action.txt"
|
||||
expect_failure test 'SELECT current_user()' "$auth_evidence/expired-test-deny.tsv"
|
||||
"$script_dir/generate-auth-secrets.sh" --unexpire-test >"$auth_evidence/unexpire-action.txt"
|
||||
expect_success test 'SELECT current_user() AS authenticated_user' "$auth_evidence/unexpired-test-allow.tsv" poc_hive_test
|
||||
|
||||
# Rotation: the former password is mounted read-only into a transient POC client.
|
||||
old_password=$(mktemp)
|
||||
trap 'rm -f "$old_password"' EXIT
|
||||
chmod 0600 "$old_password"
|
||||
cp "$script_dir/local/hive-auth-dev-password.secret" "$old_password"
|
||||
"$script_dir/generate-auth-secrets.sh" --rotate-dev >"$auth_evidence/rotate-action.txt"
|
||||
expect_success dev 'SELECT current_user() AS authenticated_user' "$auth_evidence/rotated-dev-new-allow.tsv" poc_hive_dev
|
||||
set +e
|
||||
docker run --rm \
|
||||
--name aixun-datagov-poc-hive-auth-client \
|
||||
--label com.aixun.project=aixun-datagov \
|
||||
--label com.aixun.scope=poc \
|
||||
--label com.aixun.poc=POC-AUTH-001 \
|
||||
--network aixun-datagov-poc-hive-net \
|
||||
--user 0:0 \
|
||||
--mount "type=bind,src=$old_password,dst=/run/old-password,readonly" \
|
||||
--entrypoint bash \
|
||||
aixun-datagov/poc-hive:4.2.0-authz-1 -lc '
|
||||
TERM=dumb JAVA_TOOL_OPTIONS=-Dorg.jline.terminal.dumb=true \
|
||||
/opt/hive/bin/beeline --silent=true --outputformat=tsv2 \
|
||||
-u jdbc:hive2://hiveserver2:10000/default -n poc_hive_dev \
|
||||
-p "$(cat /run/old-password)" -e "SELECT 1"
|
||||
' >"$auth_evidence/rotated-dev-old-deny.txt" 2>"$auth_evidence/rotated-dev-old-deny.stderr"
|
||||
old_status=$?
|
||||
set -e
|
||||
printf 'exit_code=%s\n' "$old_status" >>"$auth_evidence/rotated-dev-old-deny.txt"
|
||||
(( old_status != 0 )) || {
|
||||
echo 'FAIL: former Hive password was still accepted after rotation' >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Attempt the required column decision explicitly. Hive 4.2 SQL-standard
|
||||
# authorization may reject this syntax; either outcome is captured without
|
||||
# claiming enforcement prematurely.
|
||||
column_sql='SET ROLE admin; REVOKE SELECT ON TABLE poc_sec.auth_probe FROM USER poc_hive_dev; GRANT SELECT(public_value) ON TABLE poc_sec.auth_probe TO USER poc_hive_dev; SHOW GRANT USER poc_hive_dev ON TABLE poc_sec.auth_probe;'
|
||||
if run_query admin "$column_sql" "$sec_evidence/column-policy-attempt.tsv"; then
|
||||
if run_query dev 'SELECT public_value FROM poc_sec.auth_probe ORDER BY id' "$sec_evidence/column-public-allow.tsv" \
|
||||
&& ! run_query dev 'SELECT secret_value FROM poc_sec.auth_probe' "$sec_evidence/column-secret-deny.tsv"; then
|
||||
echo 'ENFORCED: column allow and deny both proved' >"$sec_evidence/column-result.txt"
|
||||
else
|
||||
echo 'NOT_ENFORCED: column policy applied but allow/deny contract did not close' >"$sec_evidence/column-result.txt"
|
||||
fi
|
||||
else
|
||||
echo 'UNSUPPORTED: Hive SQL-standard authorizer rejected column policy syntax' >"$sec_evidence/column-result.txt"
|
||||
fi
|
||||
|
||||
# Always restore the table-level dev grant used by the accepted POC baseline.
|
||||
expect_success admin 'SET ROLE admin; GRANT SELECT ON TABLE poc_sec.auth_probe TO USER poc_hive_dev; SHOW GRANT USER poc_hive_dev ON TABLE poc_sec.auth_probe' "$sec_evidence/table-policy-restored.tsv" poc_hive_dev
|
||||
|
||||
docker logs "$container" 2>&1 \
|
||||
| rg 'poc_hive_(admin|dev|test)|authentication|authorization|denied|expired' \
|
||||
| tail -n 400 >"$auth_evidence/audit-log-excerpt.txt" || true
|
||||
|
||||
echo 'PASS: Hive authentication and table policy contract completed'
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
evidence_dir="$repo_root/evidence/M1/POC-HIVE-001"
|
||||
compose_file="$repo_root/script/datagov/poc/hive/docker-compose.yml"
|
||||
sql_file="$repo_root/script/datagov/poc/hive/sql/success.sql"
|
||||
project=aixun-datagov-poc-hive
|
||||
mkdir -p "$evidence_dir"
|
||||
|
||||
wait_healthy() {
|
||||
container_name=$1
|
||||
max_attempts=${2:-60}
|
||||
attempt=1
|
||||
while (( attempt <= max_attempts )); do
|
||||
health=$(docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' "$container_name")
|
||||
if [[ "$health" == healthy || "$health" == running ]]; then
|
||||
return 0
|
||||
fi
|
||||
sleep 5
|
||||
attempt=$((attempt + 1))
|
||||
done
|
||||
echo "FAIL: $container_name did not become healthy" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
for required_container in \
|
||||
aixun-datagov-poc-hive-mysql \
|
||||
aixun-datagov-poc-hive-minio \
|
||||
aixun-datagov-poc-hive-tools \
|
||||
aixun-datagov-poc-hive-hms \
|
||||
aixun-datagov-poc-hive-hs2
|
||||
do
|
||||
wait_healthy "$required_container"
|
||||
done
|
||||
|
||||
{
|
||||
date -u '+tested_at_utc=%Y-%m-%dT%H:%M:%SZ'
|
||||
docker exec aixun-datagov-poc-hive-hs2 bash -lc 'java -version 2>&1 | head -3; hive --version 2>&1 | head -8'
|
||||
} >"$evidence_dir/runtime-versions.txt"
|
||||
|
||||
if docker exec -i aixun-datagov-poc-hive-hs2 \
|
||||
env TERM=dumb JAVA_TOOL_OPTIONS=-Dorg.jline.terminal.dumb=true \
|
||||
/opt/hive/bin/beeline --silent=true --showHeader=true --outputformat=tsv2 \
|
||||
-u jdbc:hive2://127.0.0.1:10000/default -n poc_hive \
|
||||
<"$sql_file" >"$evidence_dir/success-output.tsv" 2>"$evidence_dir/success-stderr.txt"; then
|
||||
echo 'PASS: managed ORC, external Parquet, and partition contract completed' \
|
||||
>"$evidence_dir/success-result.txt"
|
||||
else
|
||||
echo 'FAIL: Hive success contract returned nonzero' >"$evidence_dir/success-result.txt"
|
||||
exit 1
|
||||
fi
|
||||
if ! grep -F $'Table Type: \tMANAGED_TABLE' "$evidence_dir/success-output.tsv" >/dev/null; then
|
||||
echo 'FAIL: managed_orc was not recorded as MANAGED_TABLE' >"$evidence_dir/success-result.txt"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set +e
|
||||
docker exec aixun-datagov-poc-hive-hs2 \
|
||||
env TERM=dumb JAVA_TOOL_OPTIONS=-Dorg.jline.terminal.dumb=true \
|
||||
/opt/hive/bin/beeline --silent=true --outputformat=tsv2 \
|
||||
-u jdbc:hive2://127.0.0.1:10000/poc_hive -n poc_hive \
|
||||
-e 'SELECT * FROM table_that_does_not_exist' \
|
||||
>"$evidence_dir/missing-table-output.txt" 2>"$evidence_dir/missing-table-stderr.txt"
|
||||
missing_table_exit=$?
|
||||
set -e
|
||||
if (( missing_table_exit == 0 )); then
|
||||
echo 'FAIL: missing table was reported as success' >"$evidence_dir/missing-table-result.txt"
|
||||
exit 1
|
||||
fi
|
||||
printf 'PASS: missing table failed closed; exit=%d\n' "$missing_table_exit" \
|
||||
>"$evidence_dir/missing-table-result.txt"
|
||||
|
||||
docker exec aixun-datagov-poc-hive-tools sh -c '
|
||||
root_user=$(cat /run/secrets/minio_root_user)
|
||||
root_password=$(cat /run/secrets/minio_root_password)
|
||||
mc alias set verify http://minio:9000 "$root_user" "$root_password" >/dev/null 2>&1
|
||||
mc ls --recursive verify/aixun-datagov-poc-hive
|
||||
' >"$evidence_dir/object-layout.txt"
|
||||
|
||||
docker compose -p "$project" -f "$compose_file" ps \
|
||||
>"$evidence_dir/compose-ps.txt"
|
||||
echo 'PASS: basic Hive contract evidence captured'
|
||||
@@ -0,0 +1,216 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
evidence_dir="$repo_root/evidence/M1/POC-HIVE-001/resilience"
|
||||
compose_file="$repo_root/script/datagov/poc/hive/docker-compose.yml"
|
||||
local_dir="$repo_root/script/datagov/poc/hive/local"
|
||||
project=aixun-datagov-poc-hive
|
||||
mkdir -p "$evidence_dir"
|
||||
|
||||
wait_healthy() {
|
||||
container_name=$1
|
||||
max_attempts=${2:-90}
|
||||
for _ in $(seq 1 "$max_attempts"); do
|
||||
health=$(docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' "$container_name" 2>/dev/null || true)
|
||||
if [[ "$health" == healthy ]]; then
|
||||
return 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
echo "FAIL: $container_name did not become healthy" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
beeline_query() {
|
||||
sql=$1
|
||||
output_file=$2
|
||||
error_file=$3
|
||||
docker exec aixun-datagov-poc-hive-hs2 \
|
||||
timeout 45 env TERM=dumb JAVA_TOOL_OPTIONS=-Dorg.jline.terminal.dumb=true \
|
||||
/opt/hive/bin/beeline --silent=true --showHeader=true --outputformat=tsv2 \
|
||||
-u jdbc:hive2://127.0.0.1:10000/default -n poc_hive -e "$sql" \
|
||||
>"$output_file" 2>"$error_file"
|
||||
}
|
||||
|
||||
ensure_runtime_recovered() {
|
||||
docker start aixun-datagov-poc-hive-mysql aixun-datagov-poc-hive-minio aixun-datagov-poc-hive-tools aixun-datagov-poc-hive-hms aixun-datagov-poc-hive-hs2 >/dev/null 2>&1 || true
|
||||
docker exec aixun-datagov-poc-hive-tools sh -c '
|
||||
user=$(cat /run/secrets/hive_s3_access_key)
|
||||
mc admin policy attach poc aixun-datagov-poc-hive-rw --user "$user" >/dev/null 2>&1 || true
|
||||
' >/dev/null 2>&1 || true
|
||||
}
|
||||
trap ensure_runtime_recovered EXIT
|
||||
|
||||
for container_name in \
|
||||
aixun-datagov-poc-hive-mysql \
|
||||
aixun-datagov-poc-hive-minio \
|
||||
aixun-datagov-poc-hive-tools \
|
||||
aixun-datagov-poc-hive-hms \
|
||||
aixun-datagov-poc-hive-hs2
|
||||
do
|
||||
wait_healthy "$container_name"
|
||||
done
|
||||
|
||||
# 1. Metastore outage must fail, then recover without recreating data.
|
||||
docker stop aixun-datagov-poc-hive-hms >"$evidence_dir/hms-stop.txt"
|
||||
set +e
|
||||
beeline_query 'SHOW DATABASES' "$evidence_dir/hms-outage-output.txt" "$evidence_dir/hms-outage-stderr.txt"
|
||||
hms_outage_exit=$?
|
||||
set -e
|
||||
if (( hms_outage_exit == 0 )); then
|
||||
echo 'FAIL: SHOW DATABASES succeeded while HMS was stopped' >&2
|
||||
exit 1
|
||||
fi
|
||||
printf 'PASS: HMS outage failed closed; exit=%d\n' "$hms_outage_exit" >"$evidence_dir/hms-outage-result.txt"
|
||||
docker start aixun-datagov-poc-hive-hms >"$evidence_dir/hms-start.txt"
|
||||
wait_healthy aixun-datagov-poc-hive-hms
|
||||
beeline_query 'SHOW DATABASES' "$evidence_dir/hms-recovery-output.txt" "$evidence_dir/hms-recovery-stderr.txt"
|
||||
grep -Fx 'poc_hive' "$evidence_dir/hms-recovery-output.txt" >/dev/null
|
||||
echo 'PASS: HMS recovery restored metadata reads' >"$evidence_dir/hms-recovery-result.txt"
|
||||
|
||||
# 2. Remove the S3 user policy, verify data access is denied, then restore it.
|
||||
docker exec aixun-datagov-poc-hive-tools sh -c '
|
||||
user=$(cat /run/secrets/hive_s3_access_key)
|
||||
mc admin policy detach poc aixun-datagov-poc-hive-rw --user "$user" >/dev/null
|
||||
' >"$evidence_dir/object-policy-detach.txt" 2>&1
|
||||
set +e
|
||||
beeline_query 'SET hive.query.results.cache.enabled=false; USE poc_hive; SELECT SUM(id) FROM managed_orc' "$evidence_dir/object-denied-output.txt" "$evidence_dir/object-denied-stderr.txt"
|
||||
object_denied_exit=$?
|
||||
set -e
|
||||
if (( object_denied_exit == 0 )); then
|
||||
echo 'FAIL: Hive read succeeded without the object-store policy' >&2
|
||||
exit 1
|
||||
fi
|
||||
printf 'PASS: object-store access was denied; exit=%d\n' "$object_denied_exit" >"$evidence_dir/object-denied-result.txt"
|
||||
docker exec aixun-datagov-poc-hive-tools sh -c '
|
||||
user=$(cat /run/secrets/hive_s3_access_key)
|
||||
mc admin policy attach poc aixun-datagov-poc-hive-rw --user "$user" >/dev/null
|
||||
' >"$evidence_dir/object-policy-attach.txt" 2>&1
|
||||
beeline_query 'SET hive.query.results.cache.enabled=false; USE poc_hive; SELECT SUM(id) AS id_sum FROM managed_orc' "$evidence_dir/object-recovery-output.txt" "$evidence_dir/object-recovery-stderr.txt"
|
||||
grep -Fx '6' "$evidence_dir/object-recovery-output.txt" >/dev/null
|
||||
echo 'PASS: object-store policy recovery restored the data read' >"$evidence_dir/object-recovery-result.txt"
|
||||
|
||||
# 3. Restart both Hive services and prove metadata and objects remain readable.
|
||||
docker inspect -f '{{.Name}} {{.State.StartedAt}} {{.RestartCount}}' aixun-datagov-poc-hive-hms aixun-datagov-poc-hive-hs2 >"$evidence_dir/restart-before.txt"
|
||||
docker restart aixun-datagov-poc-hive-hms >"$evidence_dir/restart-hms.txt"
|
||||
wait_healthy aixun-datagov-poc-hive-hms
|
||||
docker restart aixun-datagov-poc-hive-hs2 >"$evidence_dir/restart-hs2.txt"
|
||||
wait_healthy aixun-datagov-poc-hive-hs2
|
||||
docker inspect -f '{{.Name}} {{.State.StartedAt}} {{.RestartCount}}' aixun-datagov-poc-hive-hms aixun-datagov-poc-hive-hs2 >"$evidence_dir/restart-after.txt"
|
||||
beeline_query 'USE poc_hive; SELECT COUNT(*) AS managed_count FROM managed_orc; SELECT COUNT(*) AS external_count FROM external_parquet' "$evidence_dir/restart-read-output.txt" "$evidence_dir/restart-read-stderr.txt"
|
||||
test "$(grep -Fx '3' "$evidence_dir/restart-read-output.txt" | wc -l | tr -d ' ')" -ge 1
|
||||
test "$(grep -Fx '2' "$evidence_dir/restart-read-output.txt" | wc -l | tr -d ' ')" -ge 1
|
||||
echo 'PASS: metadata and objects remained readable after service restarts' >"$evidence_dir/restart-result.txt"
|
||||
|
||||
# 4. Rotate the least-scope object-store credential without exposing values.
|
||||
old_s3_access_file="$local_dir/hive-s3-access-key.before-rotation.secret"
|
||||
old_s3_secret_file="$local_dir/hive-s3-secret-key.before-rotation.secret"
|
||||
cp "$local_dir/hive-s3-access-key.secret" "$old_s3_access_file"
|
||||
cp "$local_dir/hive-s3-secret-key.secret" "$old_s3_secret_file"
|
||||
chmod 0600 "$old_s3_access_file" "$old_s3_secret_file"
|
||||
printf 'poc-hive-%s\n' "$(openssl rand -hex 8)" >"$local_dir/hive-s3-access-key.secret"
|
||||
openssl rand -hex 24 >"$local_dir/hive-s3-secret-key.secret"
|
||||
chmod 0600 "$local_dir/hive-s3-access-key.secret" "$local_dir/hive-s3-secret-key.secret"
|
||||
{
|
||||
printf '%s\n' "$(<"$local_dir/hive-s3-access-key.secret")"
|
||||
printf '%s\n' "$(<"$local_dir/hive-s3-secret-key.secret")"
|
||||
} | docker exec -i aixun-datagov-poc-hive-tools sh -c '
|
||||
IFS= read -r new_user
|
||||
IFS= read -r new_secret
|
||||
mc admin user add poc "$new_user" "$new_secret" >/dev/null
|
||||
mc admin policy attach poc aixun-datagov-poc-hive-rw --user "$new_user" >/dev/null
|
||||
unset new_user new_secret
|
||||
' >"$evidence_dir/s3-rotation-create.txt" 2>&1
|
||||
docker compose -p "$project" -f "$compose_file" up -d --no-deps --force-recreate hms hiveserver2 >"$evidence_dir/s3-rotation-recreate.txt" 2>&1
|
||||
wait_healthy aixun-datagov-poc-hive-hms
|
||||
wait_healthy aixun-datagov-poc-hive-hs2
|
||||
beeline_query 'USE poc_hive; SELECT SUM(id) AS id_sum FROM managed_orc' "$evidence_dir/s3-rotation-read-output.txt" "$evidence_dir/s3-rotation-read-stderr.txt"
|
||||
grep -Fx '6' "$evidence_dir/s3-rotation-read-output.txt" >/dev/null
|
||||
sed -n '1p' "$old_s3_access_file" | docker exec -i aixun-datagov-poc-hive-tools sh -c '
|
||||
IFS= read -r old_user
|
||||
mc admin user remove poc "$old_user" >/dev/null
|
||||
unset old_user
|
||||
' >"$evidence_dir/s3-rotation-retire-old.txt" 2>&1
|
||||
rm -f "$old_s3_access_file" "$old_s3_secret_file"
|
||||
echo 'PASS: S3 credential rotated, read verified, and prior principal retired' >"$evidence_dir/s3-rotation-result.txt"
|
||||
|
||||
# 5. Rotate the Metastore DB credential, then prove the previous credential is rejected.
|
||||
old_mysql_file="$local_dir/hive-mysql-app.before-rotation.secret"
|
||||
cp "$local_dir/hive-mysql-app.secret" "$old_mysql_file"
|
||||
chmod 0600 "$old_mysql_file"
|
||||
openssl rand -hex 24 >"$local_dir/hive-mysql-app.secret"
|
||||
chmod 0600 "$local_dir/hive-mysql-app.secret"
|
||||
sed -n '1p' "$local_dir/hive-mysql-app.secret" | docker exec -i aixun-datagov-poc-hive-mysql sh -c '
|
||||
IFS= read -r new_password
|
||||
MYSQL_PWD=$(cat /run/secrets/hive_mysql_root_password)
|
||||
export MYSQL_PWD
|
||||
printf "ALTER USER '\''hive_metastore'\''@'\''%%'\'' IDENTIFIED BY '\''%s'\'';\n" "$new_password" | mysql -u root
|
||||
unset new_password MYSQL_PWD
|
||||
' >"$evidence_dir/mysql-rotation-alter.txt" 2>&1
|
||||
docker compose -p "$project" -f "$compose_file" up -d --no-deps --force-recreate mysql >"$evidence_dir/mysql-rotation-recreate.txt" 2>&1
|
||||
wait_healthy aixun-datagov-poc-hive-mysql
|
||||
docker compose -p "$project" -f "$compose_file" up -d --no-deps --force-recreate hms hiveserver2 >>"$evidence_dir/mysql-rotation-recreate.txt" 2>&1
|
||||
wait_healthy aixun-datagov-poc-hive-hms
|
||||
wait_healthy aixun-datagov-poc-hive-hs2
|
||||
beeline_query 'USE poc_hive; SELECT COUNT(*) AS managed_count FROM managed_orc' "$evidence_dir/mysql-rotation-read-output.txt" "$evidence_dir/mysql-rotation-read-stderr.txt"
|
||||
grep -Fx '3' "$evidence_dir/mysql-rotation-read-output.txt" >/dev/null
|
||||
set +e
|
||||
sed -n '1p' "$old_mysql_file" | docker exec -i aixun-datagov-poc-hive-mysql sh -c '
|
||||
IFS= read -r old_password
|
||||
MYSQL_PWD=$old_password mysql -N -h 127.0.0.1 -u hive_metastore aixun_datagov_poc_hive_metastore -e "SELECT CURRENT_USER()" >/dev/null
|
||||
code=$?
|
||||
unset old_password MYSQL_PWD
|
||||
exit "$code"
|
||||
' >"$evidence_dir/mysql-old-credential-output.txt" 2>"$evidence_dir/mysql-old-credential-stderr.txt"
|
||||
old_mysql_exit=$?
|
||||
set -e
|
||||
if (( old_mysql_exit == 0 )); then
|
||||
echo 'FAIL: previous Metastore DB credential still authenticated' >&2
|
||||
exit 1
|
||||
fi
|
||||
rm -f "$old_mysql_file"
|
||||
printf 'PASS: DB credential rotated and previous credential rejected; old_exit=%d\n' "$old_mysql_exit" >"$evidence_dir/mysql-rotation-result.txt"
|
||||
|
||||
# 6. Create recoverable metadata and object backups, then restore to isolated targets.
|
||||
backup_stamp=$(date -u '+%Y%m%dT%H%M%SZ')
|
||||
docker exec aixun-datagov-poc-hive-mysql sh -c '
|
||||
MYSQL_PWD=$(cat /run/secrets/hive_mysql_password)
|
||||
export MYSQL_PWD
|
||||
mysqldump --single-transaction --skip-comments --no-tablespaces -u hive_metastore aixun_datagov_poc_hive_metastore
|
||||
unset MYSQL_PWD
|
||||
' | gzip -9 >"$evidence_dir/metastore-backup.sql.gz"
|
||||
gzip -t "$evidence_dir/metastore-backup.sql.gz"
|
||||
docker exec aixun-datagov-poc-hive-mysql sh -c '
|
||||
MYSQL_PWD=$(cat /run/secrets/hive_mysql_root_password)
|
||||
export MYSQL_PWD
|
||||
mysql -u root -e "CREATE DATABASE IF NOT EXISTS aixun_datagov_poc_hive_restore CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"
|
||||
unset MYSQL_PWD
|
||||
' >"$evidence_dir/metastore-restore-create.txt" 2>&1
|
||||
gzip -dc "$evidence_dir/metastore-backup.sql.gz" | docker exec -i aixun-datagov-poc-hive-mysql sh -c '
|
||||
MYSQL_PWD=$(cat /run/secrets/hive_mysql_root_password)
|
||||
export MYSQL_PWD
|
||||
mysql -u root aixun_datagov_poc_hive_restore
|
||||
unset MYSQL_PWD
|
||||
' >"$evidence_dir/metastore-restore-import.txt" 2>&1
|
||||
docker exec aixun-datagov-poc-hive-mysql sh -c '
|
||||
MYSQL_PWD=$(cat /run/secrets/hive_mysql_root_password)
|
||||
export MYSQL_PWD
|
||||
mysql -N -u root -e "SELECT '\''live_tables'\'', COUNT(*) FROM aixun_datagov_poc_hive_metastore.TBLS; SELECT '\''restored_tables'\'', COUNT(*) FROM aixun_datagov_poc_hive_restore.TBLS; SELECT '\''live_partitions'\'', COUNT(*) FROM aixun_datagov_poc_hive_metastore.PARTITIONS; SELECT '\''restored_partitions'\'', COUNT(*) FROM aixun_datagov_poc_hive_restore.PARTITIONS"
|
||||
unset MYSQL_PWD
|
||||
' >"$evidence_dir/metastore-restore-counts.tsv"
|
||||
docker exec aixun-datagov-poc-hive-tools sh -c '
|
||||
mc mb --ignore-existing poc/aixun-datagov-poc-hive-restore >/dev/null
|
||||
mc mirror --overwrite poc/aixun-datagov-poc-hive poc/aixun-datagov-poc-hive-backup/'"$backup_stamp"' >/dev/null
|
||||
mc mirror --overwrite poc/aixun-datagov-poc-hive-backup/'"$backup_stamp"' poc/aixun-datagov-poc-hive-restore/'"$backup_stamp"' >/dev/null
|
||||
echo source
|
||||
mc du poc/aixun-datagov-poc-hive
|
||||
echo backup
|
||||
mc du poc/aixun-datagov-poc-hive-backup/'"$backup_stamp"'
|
||||
echo restored
|
||||
mc du poc/aixun-datagov-poc-hive-restore/'"$backup_stamp"'
|
||||
' >"$evidence_dir/object-backup-restore.txt" 2>&1
|
||||
echo 'PASS: metadata and objects backed up and restored into isolated verification targets' >"$evidence_dir/backup-restore-result.txt"
|
||||
|
||||
docker compose -p "$project" -f "$compose_file" ps >"$evidence_dir/compose-ps-final.txt"
|
||||
echo 'PASS: all Hive resilience contracts completed'
|
||||
@@ -0,0 +1,17 @@
|
||||
SET ROLE admin;
|
||||
CREATE DATABASE IF NOT EXISTS poc_sec;
|
||||
CREATE TABLE IF NOT EXISTS poc_sec.auth_probe (
|
||||
id INT,
|
||||
public_value STRING,
|
||||
secret_value STRING
|
||||
)
|
||||
STORED AS ORC
|
||||
TBLPROPERTIES ('transactional'='true', 'transactional_properties'='insert_only');
|
||||
INSERT INTO poc_sec.auth_probe VALUES
|
||||
(1, 'public-a', 'secret-a'),
|
||||
(2, 'public-b', 'secret-b');
|
||||
REVOKE SELECT ON TABLE poc_sec.auth_probe FROM USER poc_hive_dev;
|
||||
REVOKE SELECT ON TABLE poc_sec.auth_probe FROM USER poc_hive_test;
|
||||
GRANT SELECT ON TABLE poc_sec.auth_probe TO USER poc_hive_dev;
|
||||
SHOW GRANT USER poc_hive_dev ON TABLE poc_sec.auth_probe;
|
||||
SHOW GRANT USER poc_hive_test ON TABLE poc_sec.auth_probe;
|
||||
@@ -0,0 +1,42 @@
|
||||
CREATE DATABASE IF NOT EXISTS poc_hive
|
||||
LOCATION 's3a://aixun-datagov-poc-hive/warehouse/poc_hive.db';
|
||||
USE poc_hive;
|
||||
|
||||
DROP TABLE IF EXISTS managed_orc;
|
||||
CREATE TABLE managed_orc (
|
||||
id INT,
|
||||
name STRING
|
||||
)
|
||||
PARTITIONED BY (batch_date STRING)
|
||||
STORED AS ORC;
|
||||
|
||||
INSERT INTO managed_orc PARTITION (batch_date='2026-08-24')
|
||||
VALUES (1, 'alpha'), (2, 'beta'), (3, 'gamma');
|
||||
ALTER TABLE managed_orc ADD IF NOT EXISTS
|
||||
PARTITION (batch_date='2026-08-25');
|
||||
SELECT id, name, batch_date
|
||||
FROM managed_orc
|
||||
WHERE batch_date='2026-08-24'
|
||||
ORDER BY id;
|
||||
ALTER TABLE managed_orc DROP IF EXISTS
|
||||
PARTITION (batch_date='2026-08-25');
|
||||
|
||||
DROP TABLE IF EXISTS external_parquet;
|
||||
CREATE EXTERNAL TABLE external_parquet (
|
||||
id INT,
|
||||
amount DECIMAL(12,2)
|
||||
)
|
||||
PARTITIONED BY (batch_date STRING)
|
||||
STORED AS PARQUET
|
||||
LOCATION 's3a://aixun-datagov-poc-hive/external/external_parquet';
|
||||
INSERT INTO external_parquet PARTITION (batch_date='2026-08-24')
|
||||
VALUES (10, 12.34), (11, 56.78);
|
||||
SELECT id, amount, batch_date
|
||||
FROM external_parquet
|
||||
WHERE batch_date='2026-08-24'
|
||||
ORDER BY id;
|
||||
|
||||
DESCRIBE FORMATTED managed_orc;
|
||||
DESCRIBE FORMATTED external_parquet;
|
||||
SHOW PARTITIONS managed_orc;
|
||||
SHOW PARTITIONS external_parquet;
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
required_secret_files=(
|
||||
/run/secrets/hive_mysql_password
|
||||
/run/secrets/hive_s3_access_key
|
||||
/run/secrets/hive_s3_secret_key
|
||||
)
|
||||
if [[ "${HIVE_POC_AUTH_ENABLED:-false}" == "true" ]]; then
|
||||
for principal in admin dev test; do
|
||||
required_secret_files+=(
|
||||
"/run/secrets/hive_auth_${principal}_username"
|
||||
"/run/secrets/hive_auth_${principal}_password"
|
||||
"/run/secrets/hive_auth_${principal}_expiry_epoch"
|
||||
)
|
||||
done
|
||||
fi
|
||||
for required_secret_file in "${required_secret_files[@]}"; do
|
||||
if [[ ! -r "$required_secret_file" ]]; then
|
||||
echo "required secretRef is unavailable" >&2
|
||||
exit 70
|
||||
fi
|
||||
done
|
||||
|
||||
mysql_password=$(< /run/secrets/hive_mysql_password)
|
||||
s3_access_key=$(< /run/secrets/hive_s3_access_key)
|
||||
s3_secret_key=$(< /run/secrets/hive_s3_secret_key)
|
||||
runtime_conf=/tmp/aixun-datagov-poc-hive-conf
|
||||
install -d -m 0700 "$runtime_conf"
|
||||
auth_xml=''
|
||||
if [[ "${HIVE_POC_AUTH_ENABLED:-false}" == "true" ]]; then
|
||||
auth_xml='
|
||||
<property><name>hive.server2.authentication</name><value>CUSTOM</value></property>
|
||||
<property><name>hive.server2.custom.authentication.class</name><value>cn.aixunkeji.datagov.poc.HiveSecretAuthenticator</value></property>
|
||||
<property><name>hive.security.authorization.enabled</name><value>true</value></property>
|
||||
<property><name>hive.security.authorization.manager</name><value>org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory</value></property>
|
||||
<property><name>hive.security.authenticator.manager</name><value>org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator</value></property>
|
||||
<property><name>hive.users.in.admin.role</name><value>poc_hive_admin</value></property>'
|
||||
fi
|
||||
|
||||
cat >"$runtime_conf/hive-site.xml" <<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<property><name>javax.jdo.option.ConnectionDriverName</name><value>com.mysql.cj.jdbc.Driver</value></property>
|
||||
<property><name>javax.jdo.option.ConnectionURL</name><value>jdbc:mysql://mysql:3306/aixun_datagov_poc_hive_metastore?createDatabaseIfNotExist=false&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC</value></property>
|
||||
<property><name>javax.jdo.option.ConnectionUserName</name><value>hive_metastore</value></property>
|
||||
<property><name>javax.jdo.option.ConnectionPassword</name><value>${mysql_password}</value></property>
|
||||
<property><name>hive.metastore.schema.verification</name><value>true</value></property>
|
||||
<property><name>metastore.event.db.notification.api.auth</name><value>false</value></property>
|
||||
<property><name>hive.metastore.warehouse.dir</name><value>s3a://aixun-datagov-poc-hive/warehouse</value></property>
|
||||
<property><name>hive.metastore.uris</name><value>thrift://hms:9083</value></property>
|
||||
<property><name>fs.defaultFS</name><value>s3a://aixun-datagov-poc-hive/</value></property>
|
||||
<property><name>fs.s3a.impl</name><value>org.apache.hadoop.fs.s3a.S3AFileSystem</value></property>
|
||||
<property><name>fs.s3a.endpoint</name><value>http://minio:9000</value></property>
|
||||
<property><name>fs.s3a.endpoint.region</name><value>us-east-1</value></property>
|
||||
<property><name>fs.s3a.path.style.access</name><value>true</value></property>
|
||||
<property><name>fs.s3a.connection.ssl.enabled</name><value>false</value></property>
|
||||
<property><name>fs.s3a.aws.credentials.provider</name><value>org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider</value></property>
|
||||
<property><name>fs.s3a.access.key</name><value>${s3_access_key}</value></property>
|
||||
<property><name>fs.s3a.secret.key</name><value>${s3_secret_key}</value></property>
|
||||
<property><name>mapreduce.framework.name</name><value>local</value></property>
|
||||
<property><name>hive.execution.engine</name><value>mr</value></property>
|
||||
<property><name>hive.create.as.external.legacy</name><value>false</value></property>
|
||||
<property><name>hive.create.as.insert.only</name><value>true</value></property>
|
||||
<property><name>hive.support.concurrency</name><value>true</value></property>
|
||||
<property><name>hive.txn.manager</name><value>org.apache.hadoop.hive.ql.lockmgr.DbTxnManager</value></property>
|
||||
<property><name>hive.exec.mode.local.auto</name><value>true</value></property>
|
||||
<property><name>hive.server2.enable.doAs</name><value>false</value></property>
|
||||
<property><name>hive.server2.logging.operation.enabled</name><value>true</value></property>
|
||||
${auth_xml}
|
||||
</configuration>
|
||||
EOF
|
||||
chmod 0600 "$runtime_conf/hive-site.xml"
|
||||
export HIVE_CUSTOM_CONF_DIR=$runtime_conf
|
||||
export HADOOP_CLASSPATH='/opt/hadoop/share/hadoop/tools/lib/*'
|
||||
unset mysql_password s3_access_key s3_secret_key
|
||||
|
||||
exec /entrypoint.sh
|
||||
@@ -0,0 +1 @@
|
||||
local/
|
||||
@@ -0,0 +1,183 @@
|
||||
x-openmetadata-environment: &openmetadata_environment
|
||||
OPENMETADATA_CLUSTER_NAME: aixun-datagov-poc-openmetadata
|
||||
SERVER_PORT: "8585"
|
||||
SERVER_ADMIN_PORT: "8586"
|
||||
LOG_LEVEL: INFO
|
||||
AUTHORIZER_CLASS_NAME: org.openmetadata.service.security.DefaultAuthorizer
|
||||
AUTHORIZER_REQUEST_FILTER: org.openmetadata.service.security.JwtFilter
|
||||
AUTHORIZER_ADMIN_PRINCIPALS: "[admin]"
|
||||
AUTHORIZER_ALLOWED_REGISTRATION_DOMAIN: '["all"]'
|
||||
AUTHORIZER_INGESTION_PRINCIPALS: "[ingestion-bot]"
|
||||
AUTHORIZER_PRINCIPAL_DOMAIN: open-metadata.org
|
||||
AUTHORIZER_ALLOWED_DOMAINS: "[]"
|
||||
AUTHORIZER_ENFORCE_PRINCIPAL_DOMAIN: "false"
|
||||
AUTHENTICATION_PROVIDER: basic
|
||||
AUTHENTICATION_RESPONSE_TYPE: id_token
|
||||
AUTHENTICATION_PUBLIC_KEYS: "[http://server:8585/api/v1/system/config/jwks]"
|
||||
AUTHENTICATION_JWT_PRINCIPAL_CLAIMS: "[email,preferred_username,sub]"
|
||||
AUTHENTICATION_ENABLE_SELF_SIGNUP: "false"
|
||||
AUTHENTICATION_CLIENT_TYPE: public
|
||||
RSA_PUBLIC_KEY_FILE_PATH: /run/secrets/om_jwt_public
|
||||
RSA_PRIVATE_KEY_FILE_PATH: /run/secrets/om_jwt_private
|
||||
JWT_ISSUER: aixun-datagov-poc-openmetadata
|
||||
JWT_KEY_ID: aixun-datagov-poc-openmetadata-key-1
|
||||
DB_DRIVER_CLASS: com.mysql.cj.jdbc.Driver
|
||||
DB_SCHEME: mysql
|
||||
DB_PARAMS: allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC
|
||||
DB_USER: openmetadata_user
|
||||
DB_HOST: mysql
|
||||
DB_PORT: "3306"
|
||||
OM_DATABASE: aixun_datagov_poc_openmetadata
|
||||
ELASTICSEARCH_HOST: elasticsearch
|
||||
ELASTICSEARCH_PORT: "9200"
|
||||
ELASTICSEARCH_SCHEME: http
|
||||
SEARCH_TYPE: elasticsearch
|
||||
ELASTICSEARCH_CONNECTION_TIMEOUT_SECS: "5"
|
||||
ELASTICSEARCH_SOCKET_TIMEOUT_SECS: "60"
|
||||
OPENMETADATA_HEAP_OPTS: -Xmx1536M -Xms1536M
|
||||
PIPELINE_SERVICE_CLIENT_ENABLED: "false"
|
||||
SECRET_MANAGER: db
|
||||
WEB_CONF_FRAME_OPTION_ENABLED: "true"
|
||||
WEB_CONF_FRAME_OPTION: SAMEORIGIN
|
||||
WEB_CONF_CONTENT_TYPE_OPTIONS_ENABLED: "true"
|
||||
WEB_CONF_XSS_CSP_ENABLED: "true"
|
||||
WEB_CONF_XSS_CSP_POLICY: "default-src 'self'; frame-ancestors 'self'"
|
||||
|
||||
x-poc-labels: &poc_labels
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
com.aixun.poc: POC-AUTH-001
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: openmetadata/db:1.13.4@sha256:414f0fbc3fbc9b2de69d291a0ef2f82d0bf6bac67f8aa0bb851aeaa108f7c4f9
|
||||
container_name: aixun-datagov-poc-openmetadata-mysql
|
||||
restart: unless-stopped
|
||||
entrypoint: ["/opt/aixun-poc/mysql-wrapper.sh"]
|
||||
command: ["mysqld", "--sort_buffer_size=10M"]
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: /run/secrets/mysql_root_password
|
||||
MYSQL_DATABASE: aixun_datagov_poc_openmetadata
|
||||
MYSQL_USER: openmetadata_user
|
||||
secrets:
|
||||
- mysql_root_password
|
||||
- mysql_app_password
|
||||
ports:
|
||||
- "127.0.0.1:33006:3306"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "/healthcheck.sh"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 40
|
||||
volumes:
|
||||
- ./mysql-wrapper.sh:/opt/aixun-poc/mysql-wrapper.sh:ro
|
||||
- openmetadata_mysql_data:/var/lib/mysql
|
||||
networks:
|
||||
- openmetadata_net
|
||||
labels: *poc_labels
|
||||
|
||||
elasticsearch:
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:9.3.0@sha256:4f6bdcb742e892539c6ac49b0dd3e4e182e90218546e8c6a22db378c344acb60
|
||||
container_name: aixun-datagov-poc-openmetadata-elasticsearch
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
discovery.type: single-node
|
||||
ES_JAVA_OPTS: -Xms1024m -Xmx1024m
|
||||
xpack.security.enabled: "false"
|
||||
ports:
|
||||
- "127.0.0.1:33092:9200"
|
||||
- "127.0.0.1:33093:9300"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:9200/_cluster/health | grep -qE '\"status\":\"(green|yellow)\"'"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 40
|
||||
volumes:
|
||||
- openmetadata_elasticsearch_data:/usr/share/elasticsearch/data
|
||||
networks:
|
||||
- openmetadata_net
|
||||
labels: *poc_labels
|
||||
|
||||
migrate:
|
||||
image: openmetadata/server:1.13.4@sha256:99b48e01b941efb6ace3c742fdf074fb173734739b4c57c50ee4959f49d527f8
|
||||
container_name: aixun-datagov-poc-openmetadata-migrate
|
||||
restart: "no"
|
||||
entrypoint: ["/opt/aixun-poc/openmetadata-wrapper.sh"]
|
||||
command: ["./bootstrap/openmetadata-ops.sh", "migrate"]
|
||||
environment: *openmetadata_environment
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
elasticsearch:
|
||||
condition: service_healthy
|
||||
secrets:
|
||||
- mysql_app_password
|
||||
- om_jwt_private
|
||||
- om_jwt_public
|
||||
volumes:
|
||||
- ./openmetadata-wrapper.sh:/opt/aixun-poc/openmetadata-wrapper.sh:ro
|
||||
networks:
|
||||
- openmetadata_net
|
||||
labels: *poc_labels
|
||||
|
||||
server:
|
||||
image: openmetadata/server:1.13.4@sha256:99b48e01b941efb6ace3c742fdf074fb173734739b4c57c50ee4959f49d527f8
|
||||
container_name: aixun-datagov-poc-openmetadata-server
|
||||
restart: unless-stopped
|
||||
entrypoint: ["/opt/aixun-poc/openmetadata-wrapper.sh"]
|
||||
command: ["/openmetadata-start.sh"]
|
||||
environment: *openmetadata_environment
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
elasticsearch:
|
||||
condition: service_healthy
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
secrets:
|
||||
- mysql_app_password
|
||||
- om_jwt_private
|
||||
- om_jwt_public
|
||||
ports:
|
||||
- "127.0.0.1:33085:8585"
|
||||
- "127.0.0.1:33086:8586"
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:8586/healthcheck"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 60
|
||||
start_period: 30s
|
||||
volumes:
|
||||
- ./openmetadata-wrapper.sh:/opt/aixun-poc/openmetadata-wrapper.sh:ro
|
||||
networks:
|
||||
- openmetadata_net
|
||||
labels: *poc_labels
|
||||
|
||||
secrets:
|
||||
mysql_root_password:
|
||||
file: ./local/mysql-root.secret
|
||||
mysql_app_password:
|
||||
file: ./local/mysql-app.secret
|
||||
om_jwt_private:
|
||||
file: ./local/jwt-private.der
|
||||
om_jwt_public:
|
||||
file: ./local/jwt-public.der
|
||||
|
||||
networks:
|
||||
openmetadata_net:
|
||||
name: aixun-datagov-poc-openmetadata-net
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
|
||||
volumes:
|
||||
openmetadata_mysql_data:
|
||||
name: aixun-datagov-poc-openmetadata-mysql-data
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
openmetadata_elasticsearch_data:
|
||||
name: aixun-datagov-poc-openmetadata-elasticsearch-data
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd "$(dirname "$0")" && pwd -P)
|
||||
local_dir="$script_dir/local"
|
||||
rotate=${1:-}
|
||||
mkdir -p "$local_dir"
|
||||
chmod 700 "$local_dir"
|
||||
|
||||
for name in mysql-root mysql-app; do
|
||||
target="$local_dir/$name.secret"
|
||||
if [[ "$rotate" == "--rotate" || ! -f "$target" ]]; then
|
||||
umask 077
|
||||
printf '%s' "$(openssl rand -hex 18)" >"$target"
|
||||
fi
|
||||
chmod 600 "$target"
|
||||
done
|
||||
|
||||
for name in admin-password dev-password dev-password-rotated test-password wrong-password; do
|
||||
target="$local_dir/$name.secret"
|
||||
if [[ "$rotate" == "--rotate" || "$rotate" == "--rotate-auth" || ! -f "$target" ]]; then
|
||||
umask 077
|
||||
printf 'Aa1!%s' "$(openssl rand -hex 8)" >"$target"
|
||||
fi
|
||||
chmod 600 "$target"
|
||||
done
|
||||
|
||||
private_key="$local_dir/jwt-private.der"
|
||||
public_key="$local_dir/jwt-public.der"
|
||||
if [[ "$rotate" == "--rotate" || ! -f "$private_key" || ! -f "$public_key" ]]; then
|
||||
umask 077
|
||||
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 2>/dev/null \
|
||||
| openssl pkcs8 -topk8 -nocrypt -outform DER -out "$private_key"
|
||||
openssl pkey -inform DER -in "$private_key" -pubout -outform DER -out "$public_key"
|
||||
fi
|
||||
chmod 600 "$private_key" "$public_key"
|
||||
|
||||
echo "PASS: OpenMetadata POC secretRefs exist as ignored mode-0600 files"
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
export MYSQL_PASSWORD=$(</run/secrets/mysql_app_password)
|
||||
exec /entrypoint.sh "$@"
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
export DB_USER_PASSWORD=$(</run/secrets/mysql_app_password)
|
||||
exec "$@"
|
||||
@@ -0,0 +1,213 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
script_dir="$repo_root/script/datagov/poc/openmetadata"
|
||||
local_dir="$script_dir/local"
|
||||
evidence_dir="$repo_root/evidence/M1/POC-VERSION-001/openmetadata-runtime"
|
||||
compose_file="$script_dir/docker-compose.yml"
|
||||
project=aixun-datagov-poc-openmetadata
|
||||
base_url=http://127.0.0.1:33085
|
||||
mkdir -p "$evidence_dir"
|
||||
chmod 700 "$local_dir"
|
||||
|
||||
require_equal() {
|
||||
local actual=$1
|
||||
local expected=$2
|
||||
local label=$3
|
||||
if [[ "$actual" != "$expected" ]]; then
|
||||
printf 'FAIL: %s expected %s, got %s\n' "$label" "$expected" "$actual" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
login() {
|
||||
local label=$1
|
||||
local email=$2
|
||||
local password_file=$3
|
||||
local encoded request response status token_file config
|
||||
request="$local_dir/runtime-$label-login-request.json"
|
||||
response="$local_dir/runtime-$label-login-response.json"
|
||||
token_file="$local_dir/runtime-$label-token.secret"
|
||||
config="$local_dir/runtime-$label-curl.conf"
|
||||
encoded=$(openssl base64 -A -in "$password_file")
|
||||
umask 077
|
||||
printf '{"email":"%s","password":"%s"}\n' "$email" "$encoded" >"$request"
|
||||
unset encoded
|
||||
status=$(curl -sS -o "$response" -w '%{http_code}' -H 'Content-Type: application/json' --data-binary "@$request" "$base_url/api/v1/users/login")
|
||||
require_equal "$status" 200 "$label login HTTP status"
|
||||
jq -r '.accessToken' "$response" >"$token_file"
|
||||
chmod 600 "$token_file"
|
||||
printf 'silent\nshow-error\nheader = "Authorization: Bearer %s"\n' "$(<"$token_file")" >"$config"
|
||||
chmod 600 "$config"
|
||||
jq --argjson http "$status" '{http:$http,tokenType,expiresAtEpochMs:(.expiryTime // .accessTokenExpiresAt // null)}' "$response" >"$evidence_dir/$label-login.json"
|
||||
}
|
||||
|
||||
request() {
|
||||
local label=$1
|
||||
local config=$2
|
||||
local method=$3
|
||||
local endpoint=$4
|
||||
local body=${5:-}
|
||||
local output="$evidence_dir/$label.json"
|
||||
local args=(-o "$output" -w '%{http_code}' -X "$method")
|
||||
if [[ -n "$body" ]]; then
|
||||
args+=(-H 'Content-Type: application/json' --data-binary "@$body")
|
||||
fi
|
||||
curl --config "$config" "${args[@]}" "$base_url/api/v1$endpoint"
|
||||
}
|
||||
|
||||
wait_server_healthy() {
|
||||
local label=$1
|
||||
local started attempt state finished
|
||||
started=$(date +%s)
|
||||
for attempt in $(seq 1 180); do
|
||||
state=$(docker inspect -f '{{.State.Health.Status}}' aixun-datagov-poc-openmetadata-server 2>/dev/null || true)
|
||||
[[ "$state" == healthy ]] && break
|
||||
sleep 2
|
||||
done
|
||||
finished=$(date +%s)
|
||||
printf 'elapsed_seconds=%s\nstate=%s\n' "$((finished-started))" "$state" >"$evidence_dir/$label-health-timing.txt"
|
||||
require_equal "$state" healthy "$label server health"
|
||||
}
|
||||
|
||||
login admin admin@open-metadata.org "$local_dir/admin-password.secret"
|
||||
admin_config="$local_dir/runtime-admin-curl.conf"
|
||||
login dev poc_dev_svc@invalid.example "$local_dir/dev-password-rotated.secret"
|
||||
dev_config="$local_dir/runtime-dev-curl.conf"
|
||||
|
||||
no_auth_status=$(curl -sS -o "$evidence_dir/no-auth.json" -w '%{http_code}' "$base_url/api/v1/tables?limit=1")
|
||||
require_equal "$no_auth_status" 401 'missing authentication'
|
||||
|
||||
invalid_body="$evidence_dir/invalid-service-input.json"
|
||||
printf '{"serviceType":"CustomDatabase","description":"missing required name"}\n' >"$invalid_body"
|
||||
invalid_status=$(request invalid-service "$admin_config" POST '/services/databaseServices' "$invalid_body")
|
||||
require_equal "$invalid_status" 400 'invalid service payload'
|
||||
|
||||
dev_denied_body="$evidence_dir/dev-denied-service-input.json"
|
||||
printf '{"name":"poc_dev_must_not_create","serviceType":"CustomDatabase"}\n' >"$dev_denied_body"
|
||||
dev_denied_status=$(request dev-denied-service "$dev_config" POST '/services/databaseServices' "$dev_denied_body")
|
||||
require_equal "$dev_denied_status" 403 'DataConsumer service creation'
|
||||
|
||||
run_suffix=$(date +%s)
|
||||
service_name="poc_runtime_$run_suffix"
|
||||
database_fqn="$service_name.poc_database"
|
||||
schema_fqn="$database_fqn.poc_schema"
|
||||
|
||||
service_body="$evidence_dir/service-input.json"
|
||||
jq -nc --arg name "$service_name" '{name:$name,displayName:"M1 runtime POC",description:"POC metadata hierarchy without an executable connector",serviceType:"CustomDatabase"}' >"$service_body"
|
||||
service_status=$(request service-create "$admin_config" POST '/services/databaseServices' "$service_body")
|
||||
if [[ "$service_status" != 200 && "$service_status" != 201 ]]; then
|
||||
echo "FAIL: service creation HTTP $service_status" >&2
|
||||
exit 1
|
||||
fi
|
||||
service_id=$(jq -r '.id' "$evidence_dir/service-create.json")
|
||||
|
||||
database_body="$evidence_dir/database-input.json"
|
||||
jq -nc --arg service "$service_name" '{name:"poc_database",displayName:"POC Database",description:"M1 runtime database",service:$service}' >"$database_body"
|
||||
database_status=$(request database-create "$admin_config" POST '/databases' "$database_body")
|
||||
if [[ "$database_status" != 200 && "$database_status" != 201 ]]; then
|
||||
echo "FAIL: database creation HTTP $database_status" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
schema_body="$evidence_dir/schema-input.json"
|
||||
jq -nc --arg database "$database_fqn" '{name:"poc_schema",displayName:"POC Schema",description:"M1 runtime schema",database:$database}' >"$schema_body"
|
||||
schema_status=$(request schema-create "$admin_config" POST '/databaseSchemas' "$schema_body")
|
||||
if [[ "$schema_status" != 200 && "$schema_status" != 201 ]]; then
|
||||
echo "FAIL: schema creation HTTP $schema_status" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source_body="$evidence_dir/source-table-input.json"
|
||||
jq -nc --arg schema "$schema_fqn" '{name:"source_table",displayName:"POC Source",description:"Lineage source",tableType:"Regular",databaseSchema:$schema,columns:[{name:"id",dataType:"BIGINT",constraint:"PRIMARY_KEY"},{name:"value",dataType:"STRING"}]}' >"$source_body"
|
||||
source_status=$(request source-table-create "$admin_config" POST '/tables' "$source_body")
|
||||
if [[ "$source_status" != 200 && "$source_status" != 201 ]]; then
|
||||
echo "FAIL: source table creation HTTP $source_status" >&2
|
||||
exit 1
|
||||
fi
|
||||
source_id=$(jq -r '.id' "$evidence_dir/source-table-create.json")
|
||||
source_fqn=$(jq -r '.fullyQualifiedName' "$evidence_dir/source-table-create.json")
|
||||
|
||||
target_body="$evidence_dir/target-table-input.json"
|
||||
jq -nc --arg schema "$schema_fqn" '{name:"target_table",displayName:"POC Target",description:"Lineage target",tableType:"Regular",databaseSchema:$schema,columns:[{name:"id",dataType:"BIGINT",constraint:"PRIMARY_KEY"},{name:"value",dataType:"STRING"}]}' >"$target_body"
|
||||
target_status=$(request target-table-create "$admin_config" POST '/tables' "$target_body")
|
||||
if [[ "$target_status" != 200 && "$target_status" != 201 ]]; then
|
||||
echo "FAIL: target table creation HTTP $target_status" >&2
|
||||
exit 1
|
||||
fi
|
||||
target_id=$(jq -r '.id' "$evidence_dir/target-table-create.json")
|
||||
target_fqn=$(jq -r '.fullyQualifiedName' "$evidence_dir/target-table-create.json")
|
||||
|
||||
read_id_status=$(request source-read-id "$admin_config" GET "/tables/$source_id")
|
||||
require_equal "$read_id_status" 200 'table read by ID'
|
||||
read_name_status=$(request source-read-name "$admin_config" GET "/tables/name/$source_fqn")
|
||||
require_equal "$read_name_status" 200 'table read by FQN'
|
||||
missing_status=$(request missing-table "$admin_config" GET "/tables/name/$service_name.poc_database.poc_schema.must_not_exist")
|
||||
require_equal "$missing_status" 404 'missing entity read'
|
||||
|
||||
page1_status=$(request tables-page-1 "$admin_config" GET "/tables?database=$database_fqn&limit=1")
|
||||
require_equal "$page1_status" 200 'table page 1'
|
||||
page1_count=$(jq -r '.data | length' "$evidence_dir/tables-page-1.json")
|
||||
require_equal "$page1_count" 1 'table page 1 count'
|
||||
after=$(jq -r '.paging.after' "$evidence_dir/tables-page-1.json")
|
||||
page2_status=$(request tables-page-2 "$admin_config" GET "/tables?database=$database_fqn&limit=1&after=$after")
|
||||
require_equal "$page2_status" 200 'table page 2'
|
||||
page2_count=$(jq -r '.data | length' "$evidence_dir/tables-page-2.json")
|
||||
require_equal "$page2_count" 1 'table page 2 count'
|
||||
|
||||
lineage_body="$evidence_dir/lineage-input.json"
|
||||
jq -nc --arg from "$source_id" --arg to "$target_id" '{edge:{fromEntity:{id:$from,type:"table"},toEntity:{id:$to,type:"table"},description:"M1 POC lineage edge",lineageDetails:{sqlQuery:"INSERT INTO target_table SELECT * FROM source_table"}}}' >"$lineage_body"
|
||||
lineage_status=$(request lineage-create "$admin_config" PUT '/lineage' "$lineage_body")
|
||||
if [[ "$lineage_status" != 200 && "$lineage_status" != 201 ]]; then
|
||||
echo "FAIL: lineage creation HTTP $lineage_status" >&2
|
||||
exit 1
|
||||
fi
|
||||
lineage_read_status=$(request lineage-read "$admin_config" GET "/lineage/table/$source_id?upstreamDepth=1&downstreamDepth=1")
|
||||
require_equal "$lineage_read_status" 200 'lineage readback'
|
||||
lineage_edges=$(jq -r '.downstreamEdges | length' "$evidence_dir/lineage-read.json")
|
||||
require_equal "$lineage_edges" 1 'lineage downstream edge count'
|
||||
|
||||
audit_status=$(request audit-read "$admin_config" GET '/audit/logs?limit=100')
|
||||
require_equal "$audit_status" 200 'audit readback'
|
||||
jq --arg prefix "$service_name" '{data:[.data[] | select(.entityFQN | startswith($prefix))]}' "$evidence_dir/audit-read.json" >"$evidence_dir/audit-read-relevant.json"
|
||||
audit_records=$(jq -r '.data | length' "$evidence_dir/audit-read-relevant.json")
|
||||
if (( audit_records < 5 )); then
|
||||
echo "FAIL: expected service/database/schema/two-table audit records, got $audit_records" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set +e
|
||||
curl -sS --max-time 0.001 --config "$admin_config" "$base_url/swagger.json" \
|
||||
>"$evidence_dir/client-cancel-output.txt" 2>"$evidence_dir/client-cancel-stderr.txt"
|
||||
cancel_exit=$?
|
||||
set -e
|
||||
require_equal "$cancel_exit" 28 'client-side cancellation timeout'
|
||||
printf 'curl_exit=%s\nsemantic=client aborted a large synchronous response; OpenMetadata CRUD has no asynchronous cancel handle\n' "$cancel_exit" >"$evidence_dir/client-cancel-result.txt"
|
||||
|
||||
docker compose -p "$project" -f "$compose_file" restart server >"$evidence_dir/server-restart-output.txt" 2>&1
|
||||
wait_server_healthy recovery
|
||||
login admin-recovery admin@open-metadata.org "$local_dir/admin-password.secret"
|
||||
recovery_config="$local_dir/runtime-admin-recovery-curl.conf"
|
||||
recovery_table_status=$(request recovery-table "$recovery_config" GET "/tables/$source_id")
|
||||
require_equal "$recovery_table_status" 200 'table recovery read'
|
||||
recovery_lineage_status=$(request recovery-lineage "$recovery_config" GET "/lineage/table/$source_id?upstreamDepth=1&downstreamDepth=1")
|
||||
require_equal "$recovery_lineage_status" 200 'lineage recovery read'
|
||||
recovery_edges=$(jq -r '.downstreamEdges | length' "$evidence_dir/recovery-lineage.json")
|
||||
require_equal "$recovery_edges" 1 'recovered lineage edge count'
|
||||
|
||||
docker logs aixun-datagov-poc-openmetadata-server >"$evidence_dir/server.log" 2>&1
|
||||
cat >"$evidence_dir/result.txt" <<EOF
|
||||
service_name=$service_name
|
||||
service_id=$service_id
|
||||
source_table_id=$source_id
|
||||
source_table_fqn=$source_fqn
|
||||
target_table_id=$target_id
|
||||
target_table_fqn=$target_fqn
|
||||
page1_count=$page1_count
|
||||
page2_count=$page2_count
|
||||
lineage_edges=$lineage_edges
|
||||
client_cancel_exit=$cancel_exit
|
||||
recovery_edges=$recovery_edges
|
||||
EOF
|
||||
echo 'PASS_WITH_LIMITATION: OpenMetadata hierarchy CRUD/read/list pagination/lineage/deny/timeout/restart recovery completed; synchronous CRUD has no server-side cancel handle'
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
||||
exec "$script_dir/common/scan-current-secrets.sh" "$@"
|
||||
@@ -0,0 +1,2 @@
|
||||
/local/
|
||||
*.secret
|
||||
@@ -0,0 +1,20 @@
|
||||
FROM bellsoft/liberica-openjdk-rocky:21.0.12-cds@sha256:b8493dbedf98eb152731f75ef52b9e6cd2fecc0f54684d5a5d7abd7703139490
|
||||
|
||||
ARG SEATUNNEL_VERSION=2.3.13
|
||||
ENV SEATUNNEL_HOME=/opt/seatunnel \
|
||||
JAVA_HOME=/usr/lib/jvm/jdk-21.0.12.1-bellsoft-x86_64
|
||||
|
||||
COPY local/artifacts/apache-seatunnel-2.3.13-bin.tar.gz /tmp/apache-seatunnel-2.3.13-bin.tar.gz
|
||||
RUN microdnf -y install curl procps-ng shadow-utils && \
|
||||
microdnf clean all && \
|
||||
tar -xzf /tmp/apache-seatunnel-2.3.13-bin.tar.gz -C /opt && \
|
||||
mv "/opt/apache-seatunnel-${SEATUNNEL_VERSION}" "$SEATUNNEL_HOME" && \
|
||||
rm -f /tmp/apache-seatunnel-2.3.13-bin.tar.gz && \
|
||||
(id seatunnel >/dev/null 2>&1 || useradd --no-create-home --shell /sbin/nologin --uid 1001 seatunnel) && \
|
||||
install -d -o seatunnel -g seatunnel /opt/aixun-poc /tmp/seatunnel && \
|
||||
chown -R seatunnel:seatunnel "$SEATUNNEL_HOME"
|
||||
|
||||
COPY --chmod=0555 start-seatunnel.sh /opt/aixun-poc/start-seatunnel.sh
|
||||
USER seatunnel
|
||||
WORKDIR /opt/seatunnel
|
||||
ENTRYPOINT ["/opt/aixun-poc/start-seatunnel.sh"]
|
||||
@@ -0,0 +1,47 @@
|
||||
services:
|
||||
engine:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: aixun-datagov/poc-seatunnel:2.3.13-auth-1
|
||||
container_name: aixun-datagov-poc-seatunnel-engine
|
||||
restart: unless-stopped
|
||||
secrets:
|
||||
- seatunnel_basic_username
|
||||
- seatunnel_basic_password
|
||||
ports:
|
||||
- "127.0.0.1:31080:8080"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS -u \"$$(cat /run/secrets/seatunnel_basic_username):$$(cat /run/secrets/seatunnel_basic_password)\" http://127.0.0.1:8080/overview >/dev/null"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 60
|
||||
start_period: 30s
|
||||
volumes:
|
||||
- seatunnel_data:/tmp/seatunnel
|
||||
networks:
|
||||
- seatunnel_net
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
com.aixun.poc: POC-AUTH-001
|
||||
|
||||
secrets:
|
||||
seatunnel_basic_username:
|
||||
file: ./local/seatunnel-basic-username.secret
|
||||
seatunnel_basic_password:
|
||||
file: ./local/seatunnel-basic-password.secret
|
||||
|
||||
networks:
|
||||
seatunnel_net:
|
||||
name: aixun-datagov-poc-seatunnel-net
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
|
||||
volumes:
|
||||
seatunnel_data:
|
||||
name: aixun-datagov-poc-seatunnel-data
|
||||
labels:
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.scope: poc
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
|
||||
artifact_dir="$script_dir/local/artifacts"
|
||||
artifact="$artifact_dir/apache-seatunnel-2.3.13-bin.tar.gz"
|
||||
expected_sha512=499fc1926a7a6f771b1e4034b6d6a43af028984741ec7745a9f50505a267d7d6b35b164a56be957cb1b0b56afc34e68b917289025244cd86c49d48583cc617e7
|
||||
mkdir -p "$artifact_dir"
|
||||
|
||||
if [[ ! -f "$artifact" ]]; then
|
||||
curl -fL --retry 5 --retry-delay 2 \
|
||||
-o "$artifact" \
|
||||
https://mirrors.huaweicloud.com/apache/seatunnel/2.3.13/apache-seatunnel-2.3.13-bin.tar.gz
|
||||
fi
|
||||
|
||||
actual_sha512=$(shasum -a 512 "$artifact" | awk '{print $1}')
|
||||
if [[ "$actual_sha512" != "$expected_sha512" ]]; then
|
||||
echo "FAIL: SeaTunnel artifact SHA-512 mismatch" >&2
|
||||
exit 65
|
||||
fi
|
||||
echo "PASS: Apache SeaTunnel 2.3.13 artifact matches the ASF SHA-512"
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
|
||||
local_dir="$script_dir/local"
|
||||
mkdir -p "$local_dir"
|
||||
umask 077
|
||||
|
||||
if [[ ! -s "$local_dir/seatunnel-basic-username.secret" ]]; then
|
||||
printf 'poc_seatunnel_service\n' >"$local_dir/seatunnel-basic-username.secret"
|
||||
fi
|
||||
if [[ ! -s "$local_dir/seatunnel-basic-password.secret" ]]; then
|
||||
openssl rand -hex 24 >"$local_dir/seatunnel-basic-password.secret"
|
||||
fi
|
||||
chmod 0600 "$local_dir"/*.secret
|
||||
echo 'PASS: SeaTunnel local secretRefs are present with mode 0600'
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"env": {
|
||||
"job.name": "aixun-poc-batch-success",
|
||||
"job.mode": "BATCH",
|
||||
"parallelism": 1
|
||||
},
|
||||
"source": [
|
||||
{
|
||||
"plugin_name": "FakeSource",
|
||||
"plugin_output": "fake",
|
||||
"row.num": 100,
|
||||
"schema": {
|
||||
"fields": {
|
||||
"id": "int",
|
||||
"name": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"transform": [],
|
||||
"sink": [
|
||||
{
|
||||
"plugin_name": "Console",
|
||||
"plugin_input": ["fake"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"env": {
|
||||
"job.name": "aixun-poc-invalid-plugin",
|
||||
"job.mode": "BATCH"
|
||||
},
|
||||
"source": [
|
||||
{
|
||||
"plugin_name": "ThisConnectorMustNotExist",
|
||||
"plugin_output": "invalid"
|
||||
}
|
||||
],
|
||||
"transform": [],
|
||||
"sink": [
|
||||
{
|
||||
"plugin_name": "Console",
|
||||
"plugin_input": ["invalid"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"env": {
|
||||
"job.name": "aixun-poc-pending-cancel",
|
||||
"job.mode": "BATCH",
|
||||
"tag_filter": {
|
||||
"poc_worker": "must-not-exist"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
{
|
||||
"plugin_name": "FakeSource",
|
||||
"plugin_output": "fake",
|
||||
"row.num": 10,
|
||||
"schema": {
|
||||
"fields": {
|
||||
"id": "int"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"transform": [],
|
||||
"sink": [
|
||||
{
|
||||
"plugin_name": "Console",
|
||||
"plugin_input": ["fake"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"env": {
|
||||
"job.name": "aixun-poc-running-cancel",
|
||||
"job.mode": "BATCH",
|
||||
"parallelism": 1
|
||||
},
|
||||
"source": [
|
||||
{
|
||||
"plugin_name": "FakeSource",
|
||||
"plugin_output": "fake",
|
||||
"row.num": 100000000,
|
||||
"split.num": 1000000,
|
||||
"split.read-interval": 1000,
|
||||
"schema": {
|
||||
"fields": {
|
||||
"id": "int"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"transform": [],
|
||||
"sink": [
|
||||
{
|
||||
"plugin_name": "Console",
|
||||
"plugin_input": ["fake"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
script_dir="$repo_root/script/datagov/poc/seatunnel"
|
||||
local_dir="$script_dir/local"
|
||||
evidence_dir="$repo_root/evidence/M1/POC-AUTH-001/seatunnel"
|
||||
compose_file="$script_dir/docker-compose.yml"
|
||||
project=aixun-datagov-poc-seatunnel
|
||||
mkdir -p "$evidence_dir"
|
||||
|
||||
request() {
|
||||
username_file=$1
|
||||
password_file=$2
|
||||
output_file=$3
|
||||
curl -sS --max-time 10 -o "$output_file" -w '%{http_code}' \
|
||||
--user "$(<"$username_file"):$(<"$password_file")" \
|
||||
http://127.0.0.1:31080/overview
|
||||
}
|
||||
|
||||
correct_status=$(request "$local_dir/seatunnel-basic-username.secret" "$local_dir/seatunnel-basic-password.secret" "$evidence_dir/correct-output.json")
|
||||
[[ "$correct_status" == 200 ]]
|
||||
printf 'http_status=%s\n' "$correct_status" >"$evidence_dir/correct-result.txt"
|
||||
|
||||
no_auth_status=$(curl -sS --max-time 10 -o "$evidence_dir/no-auth-output.txt" -w '%{http_code}' http://127.0.0.1:31080/overview)
|
||||
[[ "$no_auth_status" == 401 ]]
|
||||
printf 'http_status=%s\n' "$no_auth_status" >"$evidence_dir/no-auth-result.txt"
|
||||
|
||||
wrong_status=$(curl -sS --max-time 10 -o "$evidence_dir/wrong-auth-output.txt" -w '%{http_code}' --user 'invalid-service:invalid-credential' http://127.0.0.1:31080/overview)
|
||||
[[ "$wrong_status" == 401 ]]
|
||||
printf 'http_status=%s\n' "$wrong_status" >"$evidence_dir/wrong-auth-result.txt"
|
||||
|
||||
# A correctly authenticated principal reaches a state-changing endpoint too;
|
||||
# a non-401/403 response proves Basic Auth has no action-level authorization.
|
||||
mutation_status=$(curl -sS --max-time 10 -o "$evidence_dir/authenticated-mutation-output.txt" -w '%{http_code}' \
|
||||
--user "$(<"$local_dir/seatunnel-basic-username.secret"):$(<"$local_dir/seatunnel-basic-password.secret")" \
|
||||
-H 'Content-Type: application/json' -X POST --data '{"invalid":"contract-probe"}' \
|
||||
http://127.0.0.1:31080/submit-job)
|
||||
if [[ "$mutation_status" == 401 || "$mutation_status" == 403 ]]; then
|
||||
echo 'FAIL: authenticated principal unexpectedly failed at the authentication layer' >&2
|
||||
exit 1
|
||||
fi
|
||||
printf 'http_status=%s\nconclusion=authenticated principal is not restricted by action\n' "$mutation_status" >"$evidence_dir/action-scope-result.txt"
|
||||
|
||||
old_username="$local_dir/seatunnel-basic-username.before-rotation.secret"
|
||||
old_password="$local_dir/seatunnel-basic-password.before-rotation.secret"
|
||||
cp "$local_dir/seatunnel-basic-username.secret" "$old_username"
|
||||
cp "$local_dir/seatunnel-basic-password.secret" "$old_password"
|
||||
chmod 0600 "$old_username" "$old_password"
|
||||
printf 'poc_seatunnel_rotated\n' >"$local_dir/seatunnel-basic-username.secret"
|
||||
openssl rand -hex 24 >"$local_dir/seatunnel-basic-password.secret"
|
||||
chmod 0600 "$local_dir/seatunnel-basic-username.secret" "$local_dir/seatunnel-basic-password.secret"
|
||||
docker compose -p "$project" -f "$compose_file" up -d --no-deps --force-recreate engine >"$evidence_dir/rotation-recreate.txt" 2>&1
|
||||
for _ in $(seq 1 90); do
|
||||
state=$(docker inspect -f '{{.State.Health.Status}}' aixun-datagov-poc-seatunnel-engine 2>/dev/null || true)
|
||||
[[ "$state" == healthy ]] && break
|
||||
sleep 2
|
||||
done
|
||||
[[ "$state" == healthy ]]
|
||||
|
||||
new_status=$(request "$local_dir/seatunnel-basic-username.secret" "$local_dir/seatunnel-basic-password.secret" "$evidence_dir/rotation-new-output.json")
|
||||
old_status=$(request "$old_username" "$old_password" "$evidence_dir/rotation-old-output.txt")
|
||||
[[ "$new_status" == 200 ]]
|
||||
[[ "$old_status" == 401 ]]
|
||||
printf 'new_http_status=%s\nold_http_status=%s\n' "$new_status" "$old_status" >"$evidence_dir/rotation-result.txt"
|
||||
rm -f "$old_username" "$old_password"
|
||||
|
||||
docker logs aixun-datagov-poc-seatunnel-engine >"$evidence_dir/container.log" 2>&1
|
||||
echo 'PASS_WITH_LIMITATION: Basic Auth rejects missing, wrong, and rotated credentials, but exposes one global principal with no action-level RBAC, expiry, or sufficient per-principal audit' >"$evidence_dir/result.txt"
|
||||
echo 'PASS: SeaTunnel authentication contract completed with product limitations recorded'
|
||||
@@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
script_dir="$repo_root/script/datagov/poc/seatunnel"
|
||||
local_dir="$script_dir/local"
|
||||
evidence_dir="$repo_root/evidence/M1/POC-VERSION-001/seatunnel-runtime"
|
||||
compose_file="$script_dir/docker-compose.yml"
|
||||
project=aixun-datagov-poc-seatunnel
|
||||
base_url=http://127.0.0.1:31080
|
||||
mkdir -p "$evidence_dir"
|
||||
|
||||
require_equal() {
|
||||
actual=$1
|
||||
expected=$2
|
||||
label=$3
|
||||
if [[ "$actual" != "$expected" ]]; then
|
||||
printf 'FAIL: %s expected %s, got %s\n' "$label" "$expected" "$actual" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
netrc_file="$local_dir/runtime.netrc"
|
||||
umask 077
|
||||
printf 'machine 127.0.0.1 login %s password %s\n' \
|
||||
"$(<"$local_dir/seatunnel-basic-username.secret")" \
|
||||
"$(<"$local_dir/seatunnel-basic-password.secret")" >"$netrc_file"
|
||||
chmod 0600 "$netrc_file"
|
||||
|
||||
api() {
|
||||
method=$1
|
||||
endpoint=$2
|
||||
output=$3
|
||||
body=${4:-}
|
||||
args=(--silent --show-error --max-time 15 --netrc-file "$netrc_file" -o "$output" -w '%{http_code}' -X "$method")
|
||||
if [[ -n "$body" ]]; then
|
||||
args+=(-H 'Content-Type: application/json' --data-binary "@$body")
|
||||
fi
|
||||
curl "${args[@]}" "$base_url$endpoint"
|
||||
}
|
||||
|
||||
poll_status() {
|
||||
job_id=$1
|
||||
expected=$2
|
||||
output=$3
|
||||
for attempt in $(seq 1 120); do
|
||||
status=$(api GET "/job-info/$job_id" "$output")
|
||||
if [[ "$status" == 200 ]]; then
|
||||
actual=$(jq -r '.jobStatus // empty' "$output")
|
||||
if [[ "$actual" == "$expected" ]]; then
|
||||
printf 'attempt=%s\njob_status=%s\n' "$attempt" "$actual"
|
||||
return 0
|
||||
fi
|
||||
if [[ "$actual" == FAILED || "$actual" == CANCELED || "$actual" == FINISHED ]]; then
|
||||
printf 'unexpected terminal status: %s\n' "$actual" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "timed out waiting for $expected" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
poll_finished() {
|
||||
job_id=$1
|
||||
expected=$2
|
||||
output=$3
|
||||
for attempt in $(seq 1 120); do
|
||||
status=$(api GET "/finished-jobs/$expected?page=1&rows=100" "$output")
|
||||
if [[ "$status" == 200 ]] && jq -e --arg id "$job_id" --arg expected "$expected" '.data[] | select((.jobId | tostring) == $id and .jobStatus == $expected)' "$output" >/dev/null; then
|
||||
printf 'attempt=%s\njob_status=%s\n' "$attempt" "$expected"
|
||||
return 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "timed out waiting for finished status $expected" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
success_status=$(api POST '/submit-job?jobName=aixun-poc-batch-success' "$evidence_dir/success-submit.json" "$script_dir/jobs/batch-success.json")
|
||||
require_equal "$success_status" 200 'success submission HTTP status'
|
||||
success_id=$(jq -r '.jobId' "$evidence_dir/success-submit.json")
|
||||
if ! [[ "$success_id" =~ ^[0-9]+$ ]]; then
|
||||
echo 'FAIL: success submission did not return a numeric job ID' >&2
|
||||
exit 1
|
||||
fi
|
||||
poll_status "$success_id" FINISHED "$evidence_dir/success-job-info.json" >"$evidence_dir/success-poll.txt"
|
||||
logs_status=$(api GET "/logs/$success_id" "$evidence_dir/success-logs.html")
|
||||
printf 'http_status=%s\n' "$logs_status" >"$evidence_dir/success-logs-status.txt"
|
||||
require_equal "$logs_status" 200 'success job log HTTP status'
|
||||
|
||||
invalid_status=$(api POST '/submit-job?jobName=aixun-poc-invalid-plugin' "$evidence_dir/invalid-submit.json" "$script_dir/jobs/invalid-plugin.json")
|
||||
printf 'http_status=%s\n' "$invalid_status" >"$evidence_dir/invalid-result.txt"
|
||||
if [[ "$invalid_status" == 200 ]]; then
|
||||
invalid_id=$(jq -r '.jobId' "$evidence_dir/invalid-submit.json")
|
||||
poll_status "$invalid_id" FAILED "$evidence_dir/invalid-job-info.json" >"$evidence_dir/invalid-poll.txt"
|
||||
elif [[ "$invalid_status" -lt 400 ]]; then
|
||||
echo "invalid connector was not rejected: HTTP $invalid_status" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cancel_submit_status=$(api POST '/submit-job?jobName=aixun-poc-running-cancel' "$evidence_dir/cancel-submit.json" "$script_dir/jobs/running-cancel.json")
|
||||
require_equal "$cancel_submit_status" 200 'cancel probe submission HTTP status'
|
||||
cancel_id=$(jq -r '.jobId' "$evidence_dir/cancel-submit.json")
|
||||
for attempt in $(seq 1 30); do
|
||||
api GET "/job-info/$cancel_id" "$evidence_dir/cancel-before.json" >/dev/null
|
||||
before_status=$(jq -r '.jobStatus // empty' "$evidence_dir/cancel-before.json")
|
||||
[[ "$before_status" == RUNNING ]] && break
|
||||
sleep 1
|
||||
done
|
||||
require_equal "$before_status" RUNNING 'cancel probe precondition'
|
||||
stop_status=$(api POST '/stop-job' "$evidence_dir/cancel-response.json" <(printf '{"jobId":%s,"isStopWithSavePoint":false}\n' "$cancel_id"))
|
||||
require_equal "$stop_status" 200 'stop job HTTP status'
|
||||
poll_status "$cancel_id" CANCELED "$evidence_dir/cancel-after.json" >"$evidence_dir/cancel-poll.txt"
|
||||
|
||||
set +e
|
||||
curl --silent --show-error --max-time 0.001 --netrc-file "$netrc_file" \
|
||||
"$base_url/logs/$success_id" >"$evidence_dir/client-timeout-output.txt" 2>"$evidence_dir/client-timeout-stderr.txt"
|
||||
timeout_exit=$?
|
||||
set -e
|
||||
require_equal "$timeout_exit" 28 'caller timeout exit code'
|
||||
printf 'curl_exit=%s\nconclusion=caller timeout is observable and normalized as retryable transport timeout\n' "$timeout_exit" >"$evidence_dir/client-timeout-result.txt"
|
||||
|
||||
restart_started=$(date +%s)
|
||||
docker compose -p "$project" -f "$compose_file" restart engine >"$evidence_dir/restart-output.txt" 2>&1
|
||||
for attempt in $(seq 1 90); do
|
||||
state=$(docker inspect -f '{{.State.Health.Status}}' aixun-datagov-poc-seatunnel-engine 2>/dev/null || true)
|
||||
[[ "$state" == healthy ]] && break
|
||||
sleep 2
|
||||
done
|
||||
restart_finished=$(date +%s)
|
||||
require_equal "$state" healthy 'engine health after restart'
|
||||
printf 'restart_elapsed_seconds=%s\nstate=%s\n' "$((restart_finished-restart_started))" "$state" >"$evidence_dir/restart-timing.txt"
|
||||
|
||||
old_status=$(api GET "/job-info/$success_id" "$evidence_dir/post-restart-old-job.json")
|
||||
old_job_status=$(jq -r '.jobStatus // "NOT_RETAINED_IN_JOB_DETAIL"' "$evidence_dir/post-restart-old-job.json")
|
||||
printf 'http_status=%s\njob_status=%s\nconclusion=finished job detail is not retained across this single-node engine restart\n' "$old_status" "$old_job_status" >"$evidence_dir/post-restart-old-job-result.txt"
|
||||
retry_status=$(api POST '/submit-job?jobName=aixun-poc-retry-after-restart' "$evidence_dir/retry-submit.json" "$script_dir/jobs/batch-success.json")
|
||||
require_equal "$retry_status" 200 'retry submission HTTP status'
|
||||
retry_id=$(jq -r '.jobId' "$evidence_dir/retry-submit.json")
|
||||
poll_status "$retry_id" FINISHED "$evidence_dir/retry-job-info.json" >"$evidence_dir/retry-poll.txt"
|
||||
|
||||
docker logs aixun-datagov-poc-seatunnel-engine >"$evidence_dir/container.log" 2>&1
|
||||
printf 'success_job_id=%s\nfailed_submit_http=%s\ncancel_job_id=%s\npre_cancel_status=%s\ntimeout_exit=%s\nretry_job_id=%s\n' \
|
||||
"$success_id" "$invalid_status" "$cancel_id" "$before_status" "$timeout_exit" "$retry_id" >"$evidence_dir/result.txt"
|
||||
echo 'PASS: SeaTunnel submit/status/log/failure/cancel/timeout/restart/retry contract completed'
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
for secret_file in /run/secrets/seatunnel_basic_username /run/secrets/seatunnel_basic_password; do
|
||||
if [[ ! -r "$secret_file" ]]; then
|
||||
echo 'required secretRef is unavailable' >&2
|
||||
exit 70
|
||||
fi
|
||||
done
|
||||
|
||||
basic_username=$(< /run/secrets/seatunnel_basic_username)
|
||||
basic_password=$(< /run/secrets/seatunnel_basic_password)
|
||||
runtime_dir=/tmp/aixun-datagov-poc-seatunnel-config
|
||||
install -d -m 0700 "$runtime_dir"
|
||||
|
||||
cat >"$runtime_dir/seatunnel.yaml" <<EOF
|
||||
seatunnel:
|
||||
engine:
|
||||
classloader-cache-mode: true
|
||||
history-job-expire-minutes: 60
|
||||
backup-count: 1
|
||||
queue-type: blockingqueue
|
||||
print-execution-info-interval: 60
|
||||
print-job-metrics-info-interval: 60
|
||||
slot-service:
|
||||
dynamic-slot: true
|
||||
checkpoint:
|
||||
interval: 10000
|
||||
timeout: 60000
|
||||
storage:
|
||||
type: hdfs
|
||||
max-retained: 3
|
||||
plugin-config:
|
||||
namespace: /tmp/seatunnel/checkpoint_snapshot
|
||||
storage.type: hdfs
|
||||
fs.defaultFS: file:///tmp/
|
||||
telemetry:
|
||||
metric:
|
||||
enabled: false
|
||||
logs:
|
||||
scheduled-deletion-enable: true
|
||||
http:
|
||||
enable-http: true
|
||||
port: 8080
|
||||
enable-dynamic-port: false
|
||||
enable-basic-auth: true
|
||||
basic-auth-username: "${basic_username}"
|
||||
basic-auth-password: "${basic_password}"
|
||||
EOF
|
||||
chmod 0600 "$runtime_dir/seatunnel.yaml"
|
||||
|
||||
sed 's/cluster-name: seatunnel/cluster-name: aixun-datagov-poc-seatunnel/' \
|
||||
"$SEATUNNEL_HOME/config/hazelcast.yaml" >"$runtime_dir/hazelcast.yaml"
|
||||
chmod 0600 "$runtime_dir/hazelcast.yaml"
|
||||
export SEATUNNEL_CONFIG="$runtime_dir/seatunnel.yaml"
|
||||
export HAZELCAST_CONFIG="$runtime_dir/hazelcast.yaml"
|
||||
export JAVA_OPTS="${JAVA_OPTS:-} -Xms512m -Xmx1024m"
|
||||
unset basic_username basic_password
|
||||
|
||||
exec "$SEATUNNEL_HOME/bin/seatunnel-cluster.sh"
|
||||
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
<title>AiXun DataGov UI Controls POC</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "@aixun-datagov/poc-ui-controls",
|
||||
"private": true,
|
||||
"version": "0.0.0-poc",
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@10.34.5",
|
||||
"engines": {
|
||||
"node": ">=20.19.0",
|
||||
"pnpm": ">=10.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite --host 127.0.0.1 --port 36130",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"preview": "vite preview --host 127.0.0.1 --port 36130 --strictPort"
|
||||
},
|
||||
"dependencies": {
|
||||
"echarts": "6.1.0",
|
||||
"monaco-editor": "0.56.0",
|
||||
"vue": "3.5.40"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "6.0.5",
|
||||
"typescript": "5.9.3",
|
||||
"vite": "8.1.5",
|
||||
"vue-tsc": "3.2.5"
|
||||
}
|
||||
}
|
||||
+835
@@ -0,0 +1,835 @@
|
||||
lockfileVersion: '9.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
echarts:
|
||||
specifier: 6.1.0
|
||||
version: 6.1.0
|
||||
monaco-editor:
|
||||
specifier: 0.56.0
|
||||
version: 0.56.0
|
||||
vue:
|
||||
specifier: 3.5.40
|
||||
version: 3.5.40(typescript@5.9.3)
|
||||
devDependencies:
|
||||
'@vitejs/plugin-vue':
|
||||
specifier: 6.0.5
|
||||
version: 6.0.5(vite@8.1.5)(vue@3.5.40(typescript@5.9.3))
|
||||
typescript:
|
||||
specifier: 5.9.3
|
||||
version: 5.9.3
|
||||
vite:
|
||||
specifier: 8.1.5
|
||||
version: 8.1.5
|
||||
vue-tsc:
|
||||
specifier: 3.2.5
|
||||
version: 3.2.5(typescript@5.9.3)
|
||||
|
||||
packages:
|
||||
|
||||
'@babel/helper-string-parser@7.29.7':
|
||||
resolution: {integrity: sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@babel/helper-validator-identifier@7.29.7':
|
||||
resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@babel/parser@7.29.8':
|
||||
resolution: {integrity: sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
hasBin: true
|
||||
|
||||
'@babel/types@7.29.8':
|
||||
resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@emnapi/core@1.11.1':
|
||||
resolution: {integrity: sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==}
|
||||
|
||||
'@emnapi/runtime@1.11.1':
|
||||
resolution: {integrity: sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==}
|
||||
|
||||
'@emnapi/wasi-threads@1.2.2':
|
||||
resolution: {integrity: sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==}
|
||||
|
||||
'@jridgewell/sourcemap-codec@1.5.5':
|
||||
resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==}
|
||||
|
||||
'@napi-rs/wasm-runtime@1.2.3':
|
||||
resolution: {integrity: sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0}
|
||||
peerDependencies:
|
||||
'@emnapi/core': ^1.7.1 || ^2.0.0-alpha.4
|
||||
'@emnapi/runtime': ^1.7.1 || ^2.0.0-alpha.4
|
||||
|
||||
'@oxc-project/types@0.139.0':
|
||||
resolution: {integrity: sha512-r9gHphtCs+1M7J0pw6Sn/hh/Wpa/iQrOOkrNAlVLF/gHq+/CJmHIWKKUUhdWjcD6CIa8idarspCsASiXCXvFUw==}
|
||||
|
||||
'@rolldown/binding-android-arm64@1.1.5':
|
||||
resolution: {integrity: sha512-lZg8fqIv2v7FF237bwMgzGZEJvGL79/s5knJ/i6FmsGF4XXlzccZ4jb+TrFIxtSSxFtIpdsgrPZeMk1I9AFcyQ==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
|
||||
'@rolldown/binding-darwin-arm64@1.1.5':
|
||||
resolution: {integrity: sha512-51Bnx9pNiMRKSUNtBfySkNJ9vMU9Hh3I1ozDd6gyPPYzaXCfnptUcEZxXGYFn+ul2dtcMUiqGR1Yai2K10uoTw==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@rolldown/binding-darwin-x64@1.1.5':
|
||||
resolution: {integrity: sha512-Tm+gbfC0aHu1tBA/JvKQh32S0K6YgCHkiAF4/W6xX0K0RmNuc94VeK419dJoE65R5aRxmo+noZQSWrAMF6yb6g==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@rolldown/binding-freebsd-x64@1.1.5':
|
||||
resolution: {integrity: sha512-JMzDKCCXq93YccG5gz3hvOs1oXRKAf0XYpfOS88e+wZrC8Iugj6j68867vrYZkvpDDpKn/KoKORThmchMpF6TA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@rolldown/binding-linux-arm-gnueabihf@1.1.5':
|
||||
resolution: {integrity: sha512-uML21j2K5TfPGutKxub+M+nLjZIrWjXQ5Grx4lCe/nimTj9B4L63zHpjXLl4y0L3mcm2htEQIb06oCG/szerNw==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@rolldown/binding-linux-arm64-gnu@1.1.5':
|
||||
resolution: {integrity: sha512-navSiuTMogvnQoZoM/v+l3ZWo50/NTwSHSzheABx/RCnmUPaKwq9qSo4Br2OYRs21+Fz8uFqITZM3H4opOB0/Q==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rolldown/binding-linux-arm64-musl@1.1.5':
|
||||
resolution: {integrity: sha512-lAryqH7IteztmCXQXk0etKj4wBQ7Gx5S6LjKhsgp9zb8I5bsuvU/2llH1hDQcjsFeqIsovMVN339/8pUDDBXxA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rolldown/binding-linux-ppc64-gnu@1.1.5':
|
||||
resolution: {integrity: sha512-fsK/sNBnxzBlL4O1JNrZakVQxPspqpED5dLtNsZS9oOKmtSpdNIzxH2kkol5HYTWJN47sE20ztMJPxfZ89qGOg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rolldown/binding-linux-s390x-gnu@1.1.5':
|
||||
resolution: {integrity: sha512-gLYb4BIadlfTOYT5gO503n8zQjXflgzpD0FcyKh0Mzx3rqCZKnHoJWV9xe1KXUJ5lx2JfcSHr/mhzS0PC/McAA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rolldown/binding-linux-x64-gnu@1.1.5':
|
||||
resolution: {integrity: sha512-FjcpEKUyJygHgs1o50VYNvkt5+7Le/VEdYt0AkRpkL33MnyQfwr8l5mXwMmfmTbyMPr5vJLC+8/Gd9gXnwU1QQ==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rolldown/binding-linux-x64-musl@1.1.5':
|
||||
resolution: {integrity: sha512-Me+PfPI2TMeOQk0gYWfLQZtTktrmzbr8cDboqX83XKc7UrgAi55gF+2dUkWdxd19n55Essp2yeca+O9N5rBxHg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rolldown/binding-openharmony-arm64@1.1.5':
|
||||
resolution: {integrity: sha512-yc5WrLzXks6zCQfn9Oxr8pORKyl/pF+QjHmW/Qx3qu0oyrrNC+y2JLTU1E2rcWYAmzlnqngWXHQjy51VzW70Vw==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [openharmony]
|
||||
|
||||
'@rolldown/binding-wasm32-wasi@1.1.5':
|
||||
resolution: {integrity: sha512-VbQGPX2b4r48TAMIM2cjgluIM1HYutm4pcTEJsle7iEP7sB1dFqtPLBVbdLAZCxy1txCcPxf4QFf4v8uvltPqA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [wasm32]
|
||||
|
||||
'@rolldown/binding-win32-arm64-msvc@1.1.5':
|
||||
resolution: {integrity: sha512-gHv82k63z4qpV5+Q1y/12KrK0ltWBukVDI8nZcbT7Tt/ZlOIVwppazneq0F93oDxTo3IgAMEDIoQh3E2n6mVsw==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@rolldown/binding-win32-x64-msvc@1.1.5':
|
||||
resolution: {integrity: sha512-tTZuDBPw85tEN5PQi1pnEBzDy0Z49HtScLAbD5t6hyeU92A95pRWaSMw1GZZi/RwgSgUIl0xrSlXIT/9QzvYSA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@rolldown/pluginutils@1.0.0-rc.2':
|
||||
resolution: {integrity: sha512-izyXV/v+cHiRfozX62W9htOAvwMo4/bXKDrQ+vom1L1qRuexPock/7VZDAhnpHCLNejd3NJ6hiab+tO0D44Rgw==}
|
||||
|
||||
'@rolldown/pluginutils@1.0.1':
|
||||
resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
|
||||
|
||||
'@tybys/wasm-util@0.10.3':
|
||||
resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==}
|
||||
|
||||
'@types/trusted-types@2.0.7':
|
||||
resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==}
|
||||
|
||||
'@vitejs/plugin-vue@6.0.5':
|
||||
resolution: {integrity: sha512-bL3AxKuQySfk1iGcBsQnoRVexTPJq0Z/ixFVM8OhVJAP6ZXXXLtM7NFKWhLl30Kg7uTBqIaPXbh+nuQCuBDedg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
peerDependencies:
|
||||
vite: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||
vue: ^3.2.25
|
||||
|
||||
'@volar/language-core@2.4.28':
|
||||
resolution: {integrity: sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ==}
|
||||
|
||||
'@volar/source-map@2.4.28':
|
||||
resolution: {integrity: sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ==}
|
||||
|
||||
'@volar/typescript@2.4.28':
|
||||
resolution: {integrity: sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw==}
|
||||
|
||||
'@vue/compiler-core@3.5.40':
|
||||
resolution: {integrity: sha512-39E8IgOhTbVDnoJFMKc2DvYnypcZwUqgUhQkccva/0m6FUwtIKSGV7n1hpVmYcFaoRAwf9pBcwnKlCEsN63ZEQ==}
|
||||
|
||||
'@vue/compiler-core@3.5.41':
|
||||
resolution: {integrity: sha512-q0Xtv/F9w2YO/7htQhtiL+Ev2WCJbe5N2hc+XfgyKkEKqWpSxknmT8QOuGdEKNdjPq0c3F7rNpFkTo3Kfrm7pg==}
|
||||
|
||||
'@vue/compiler-dom@3.5.40':
|
||||
resolution: {integrity: sha512-pwkx4vqlqOspFstrcmzwkKLePVMD3PT65imRzLhanU2V1Fj4K13g6OXjanOyzw3aTAuRk84BOmY8f3rEHqPaVA==}
|
||||
|
||||
'@vue/compiler-dom@3.5.41':
|
||||
resolution: {integrity: sha512-oKacVfNglLvGjnS6BXOlGL7EyG2h8X03pqXCjzotRZUaXGjbrTJUnVAQjrCqUnS+lyu31nwQjZY/d817GmCnfw==}
|
||||
|
||||
'@vue/compiler-sfc@3.5.40':
|
||||
resolution: {integrity: sha512-gIf497P4kpuALcvs5n3AEg1Vdn0pSY4XbjASIfHNYF1/MP3T2Mf2STERTubysBxCRxzJGJYtF/O7vwJrxFB3Vw==}
|
||||
|
||||
'@vue/compiler-ssr@3.5.40':
|
||||
resolution: {integrity: sha512-rrE5xiXG663+vHCHa3J9p2z5OcBRjXmoqenprJxAFQxg5pSshzeBiCE6pu46axapRJ2Adk0YDA2BRZVjiHXnhg==}
|
||||
|
||||
'@vue/language-core@3.2.5':
|
||||
resolution: {integrity: sha512-d3OIxN/+KRedeM5wQ6H6NIpwS3P5gC9nmyaHgBk+rO6dIsjY+tOh4UlPpiZbAh3YtLdCGEX4M16RmsBqPmJV+g==}
|
||||
|
||||
'@vue/reactivity@3.5.40':
|
||||
resolution: {integrity: sha512-B7ot9UlUZOi1zbq61/LvE88ZLTV8IlajTdiZTAEiDQgrnIMIZoPr9kGw0Zw46ObW62O9+H/Be3kMbfb7kYPQZA==}
|
||||
|
||||
'@vue/runtime-core@3.5.40':
|
||||
resolution: {integrity: sha512-KAZLweuZ6uUJPK1PMSQPgBU5gCjgrrfjUhSglmU9NhH+Zjepa8cnwSydPWDWHDwOgY4g3VcZ+PljbiHlURNCbw==}
|
||||
|
||||
'@vue/runtime-dom@3.5.40':
|
||||
resolution: {integrity: sha512-ZfrX8ssZQds900L9pr8AuK05ddnMsR4MPMZr8cPN9GoqoPWcXLhjvvbIA2SMv+7a97sJ1vv9pj/zxK0Cq/eEFQ==}
|
||||
|
||||
'@vue/server-renderer@3.5.40':
|
||||
resolution: {integrity: sha512-XNJym9WpevhTVt1HuwOrCRJ5Q+9z4BjTMrDtjTrvx74SmUll8spNTw6whWJa9mEkO4PKn5TihI/bm/8ds2QVJw==}
|
||||
|
||||
'@vue/shared@3.5.40':
|
||||
resolution: {integrity: sha512-WxnBtruIqOoV3rA4jeKDWzrYI5h7Cp4+pjwDi8kWGHz+IslhiN+wguLVVhtv2l8VoU02rzDCVfDjgCl1lNpZVg==}
|
||||
|
||||
'@vue/shared@3.5.41':
|
||||
resolution: {integrity: sha512-IOnwSCma8j+9xJT6b8H0dEYidC80NsYmNMlZxRsukYcSoGaDBohog5hDxzeUXdFeGWFA++vWvxqOmrr96VlqMA==}
|
||||
|
||||
alien-signals@3.2.1:
|
||||
resolution: {integrity: sha512-I8FjmltrfnDFoZedi5CG8DghVYNhzb/Ijluz7tCSJH0xpd0484Kowhbb1XDYOxfJpU1p5wnM2X54dA+IfGyD1g==}
|
||||
|
||||
csstype@3.2.3:
|
||||
resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}
|
||||
|
||||
detect-libc@2.1.2:
|
||||
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
dompurify@3.4.8:
|
||||
resolution: {integrity: sha512-yb1cEmaOum7wFvOCSQxyfgVlv5D47Rc30iZWoMpbDIWTnJ6grDDQyu2KFJzB2k7u0pMuJcQ1zphH//fFnw2tjQ==}
|
||||
|
||||
echarts@6.1.0:
|
||||
resolution: {integrity: sha512-q0yaFPggC9FUdsWH4blavRWFmxdrIodbkoKNAjJudAI6CA9gNPxHtV2RcZNEepZVlk4yvBYkOkbk6HIVpIyHZA==}
|
||||
|
||||
entities@7.0.1:
|
||||
resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==}
|
||||
engines: {node: '>=0.12'}
|
||||
|
||||
estree-walker@2.0.2:
|
||||
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
|
||||
|
||||
fdir@6.5.0:
|
||||
resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
peerDependencies:
|
||||
picomatch: ^3 || ^4
|
||||
peerDependenciesMeta:
|
||||
picomatch:
|
||||
optional: true
|
||||
|
||||
fsevents@2.3.3:
|
||||
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
|
||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||
os: [darwin]
|
||||
|
||||
lightningcss-android-arm64@1.33.0:
|
||||
resolution: {integrity: sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
|
||||
lightningcss-darwin-arm64@1.33.0:
|
||||
resolution: {integrity: sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
lightningcss-darwin-x64@1.33.0:
|
||||
resolution: {integrity: sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
lightningcss-freebsd-x64@1.33.0:
|
||||
resolution: {integrity: sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
lightningcss-linux-arm-gnueabihf@1.33.0:
|
||||
resolution: {integrity: sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
lightningcss-linux-arm64-gnu@1.33.0:
|
||||
resolution: {integrity: sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
lightningcss-linux-arm64-musl@1.33.0:
|
||||
resolution: {integrity: sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
lightningcss-linux-x64-gnu@1.33.0:
|
||||
resolution: {integrity: sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
lightningcss-linux-x64-musl@1.33.0:
|
||||
resolution: {integrity: sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
lightningcss-win32-arm64-msvc@1.33.0:
|
||||
resolution: {integrity: sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
lightningcss-win32-x64-msvc@1.33.0:
|
||||
resolution: {integrity: sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
lightningcss@1.33.0:
|
||||
resolution: {integrity: sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
|
||||
magic-string@0.30.21:
|
||||
resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
|
||||
|
||||
marked@14.0.0:
|
||||
resolution: {integrity: sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ==}
|
||||
engines: {node: '>= 18'}
|
||||
hasBin: true
|
||||
|
||||
monaco-editor@0.56.0:
|
||||
resolution: {integrity: sha512-sXboRm3BeBeLm938eaiyLMe0OxzfXIlZvbv4ir/jVgQy1zDhWjgmny0WoN45fuDKhCCQsYMbBJrv/A6jd8aCUg==}
|
||||
|
||||
muggle-string@0.4.1:
|
||||
resolution: {integrity: sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==}
|
||||
|
||||
nanoid@3.3.18:
|
||||
resolution: {integrity: sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==}
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
hasBin: true
|
||||
|
||||
path-browserify@1.0.1:
|
||||
resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==}
|
||||
|
||||
picocolors@1.1.1:
|
||||
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
|
||||
|
||||
picomatch@4.0.5:
|
||||
resolution: {integrity: sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
postcss@8.5.26:
|
||||
resolution: {integrity: sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
|
||||
rolldown@1.1.5:
|
||||
resolution: {integrity: sha512-t9z29cJjXf/vxQ8dyhCSpt6H6aSwHTk8cT5I3iy6SMXuFpk5mB6PL6XfC8PCwrPTx93udwKUm9HRteAlTGBLiA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
hasBin: true
|
||||
|
||||
source-map-js@1.2.1:
|
||||
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
tinyglobby@0.2.17:
|
||||
resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
|
||||
tslib@2.3.0:
|
||||
resolution: {integrity: sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==}
|
||||
|
||||
tslib@2.8.1:
|
||||
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
|
||||
|
||||
typescript@5.9.3:
|
||||
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
|
||||
engines: {node: '>=14.17'}
|
||||
hasBin: true
|
||||
|
||||
vite@8.1.5:
|
||||
resolution: {integrity: sha512-7ULLwsCdYx/nRyrpiEwvqb5TFHrMVZyBt+rg/OAXT7rgj/z+DtTDyKFeLAdDkubDVDKD8jOsndmy7m55XcfUsw==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
'@types/node': ^20.19.0 || >=22.12.0
|
||||
'@vitejs/devtools': ^0.3.0
|
||||
esbuild: ^0.27.0 || ^0.28.0
|
||||
jiti: '>=1.21.0'
|
||||
less: ^4.0.0
|
||||
sass: ^1.70.0
|
||||
sass-embedded: ^1.70.0
|
||||
stylus: '>=0.54.8'
|
||||
sugarss: ^5.0.0
|
||||
terser: ^5.16.0
|
||||
tsx: ^4.8.1
|
||||
yaml: ^2.4.2
|
||||
peerDependenciesMeta:
|
||||
'@types/node':
|
||||
optional: true
|
||||
'@vitejs/devtools':
|
||||
optional: true
|
||||
esbuild:
|
||||
optional: true
|
||||
jiti:
|
||||
optional: true
|
||||
less:
|
||||
optional: true
|
||||
sass:
|
||||
optional: true
|
||||
sass-embedded:
|
||||
optional: true
|
||||
stylus:
|
||||
optional: true
|
||||
sugarss:
|
||||
optional: true
|
||||
terser:
|
||||
optional: true
|
||||
tsx:
|
||||
optional: true
|
||||
yaml:
|
||||
optional: true
|
||||
|
||||
vscode-uri@3.1.0:
|
||||
resolution: {integrity: sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==}
|
||||
|
||||
vue-tsc@3.2.5:
|
||||
resolution: {integrity: sha512-/htfTCMluQ+P2FISGAooul8kO4JMheOTCbCy4M6dYnYYjqLe3BExZudAua6MSIKSFYQtFOYAll7XobYwcpokGA==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
typescript: '>=5.0.0'
|
||||
|
||||
vue@3.5.40:
|
||||
resolution: {integrity: sha512-+8PJ4SJXdn/cHGImF4CKdxlWHIN5Dkt7DoufRREM6h6uVCx2m7QxgcEQmmzyOK8A9mcafg7sFbJFYsdFVubTig==}
|
||||
peerDependencies:
|
||||
typescript: '*'
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
zrender@6.1.0:
|
||||
resolution: {integrity: sha512-oEGMDB6pOP2S6OwRR4PdVv610zrjnA3Bh+JnSG12fYJlBKjtNAoEb5fSUoCOOINlH96I2fU38/A2UpRKs67xYQ==}
|
||||
|
||||
snapshots:
|
||||
|
||||
'@babel/helper-string-parser@7.29.7': {}
|
||||
|
||||
'@babel/helper-validator-identifier@7.29.7': {}
|
||||
|
||||
'@babel/parser@7.29.8':
|
||||
dependencies:
|
||||
'@babel/types': 7.29.8
|
||||
|
||||
'@babel/types@7.29.8':
|
||||
dependencies:
|
||||
'@babel/helper-string-parser': 7.29.7
|
||||
'@babel/helper-validator-identifier': 7.29.7
|
||||
|
||||
'@emnapi/core@1.11.1':
|
||||
dependencies:
|
||||
'@emnapi/wasi-threads': 1.2.2
|
||||
tslib: 2.8.1
|
||||
optional: true
|
||||
|
||||
'@emnapi/runtime@1.11.1':
|
||||
dependencies:
|
||||
tslib: 2.8.1
|
||||
optional: true
|
||||
|
||||
'@emnapi/wasi-threads@1.2.2':
|
||||
dependencies:
|
||||
tslib: 2.8.1
|
||||
optional: true
|
||||
|
||||
'@jridgewell/sourcemap-codec@1.5.5': {}
|
||||
|
||||
'@napi-rs/wasm-runtime@1.2.3(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)':
|
||||
dependencies:
|
||||
'@emnapi/core': 1.11.1
|
||||
'@emnapi/runtime': 1.11.1
|
||||
'@tybys/wasm-util': 0.10.3
|
||||
optional: true
|
||||
|
||||
'@oxc-project/types@0.139.0': {}
|
||||
|
||||
'@rolldown/binding-android-arm64@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-darwin-arm64@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-darwin-x64@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-freebsd-x64@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-linux-arm-gnueabihf@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-linux-arm64-gnu@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-linux-arm64-musl@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-linux-ppc64-gnu@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-linux-s390x-gnu@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-linux-x64-gnu@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-linux-x64-musl@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-openharmony-arm64@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-wasm32-wasi@1.1.5':
|
||||
dependencies:
|
||||
'@emnapi/core': 1.11.1
|
||||
'@emnapi/runtime': 1.11.1
|
||||
'@napi-rs/wasm-runtime': 1.2.3(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-win32-arm64-msvc@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/binding-win32-x64-msvc@1.1.5':
|
||||
optional: true
|
||||
|
||||
'@rolldown/pluginutils@1.0.0-rc.2': {}
|
||||
|
||||
'@rolldown/pluginutils@1.0.1': {}
|
||||
|
||||
'@tybys/wasm-util@0.10.3':
|
||||
dependencies:
|
||||
tslib: 2.8.1
|
||||
optional: true
|
||||
|
||||
'@types/trusted-types@2.0.7':
|
||||
optional: true
|
||||
|
||||
'@vitejs/plugin-vue@6.0.5(vite@8.1.5)(vue@3.5.40(typescript@5.9.3))':
|
||||
dependencies:
|
||||
'@rolldown/pluginutils': 1.0.0-rc.2
|
||||
vite: 8.1.5
|
||||
vue: 3.5.40(typescript@5.9.3)
|
||||
|
||||
'@volar/language-core@2.4.28':
|
||||
dependencies:
|
||||
'@volar/source-map': 2.4.28
|
||||
|
||||
'@volar/source-map@2.4.28': {}
|
||||
|
||||
'@volar/typescript@2.4.28':
|
||||
dependencies:
|
||||
'@volar/language-core': 2.4.28
|
||||
path-browserify: 1.0.1
|
||||
vscode-uri: 3.1.0
|
||||
|
||||
'@vue/compiler-core@3.5.40':
|
||||
dependencies:
|
||||
'@babel/parser': 7.29.8
|
||||
'@vue/shared': 3.5.40
|
||||
entities: 7.0.1
|
||||
estree-walker: 2.0.2
|
||||
source-map-js: 1.2.1
|
||||
|
||||
'@vue/compiler-core@3.5.41':
|
||||
dependencies:
|
||||
'@babel/parser': 7.29.8
|
||||
'@vue/shared': 3.5.41
|
||||
entities: 7.0.1
|
||||
estree-walker: 2.0.2
|
||||
source-map-js: 1.2.1
|
||||
|
||||
'@vue/compiler-dom@3.5.40':
|
||||
dependencies:
|
||||
'@vue/compiler-core': 3.5.40
|
||||
'@vue/shared': 3.5.40
|
||||
|
||||
'@vue/compiler-dom@3.5.41':
|
||||
dependencies:
|
||||
'@vue/compiler-core': 3.5.41
|
||||
'@vue/shared': 3.5.41
|
||||
|
||||
'@vue/compiler-sfc@3.5.40':
|
||||
dependencies:
|
||||
'@babel/parser': 7.29.8
|
||||
'@vue/compiler-core': 3.5.40
|
||||
'@vue/compiler-dom': 3.5.40
|
||||
'@vue/compiler-ssr': 3.5.40
|
||||
'@vue/shared': 3.5.40
|
||||
estree-walker: 2.0.2
|
||||
magic-string: 0.30.21
|
||||
postcss: 8.5.26
|
||||
source-map-js: 1.2.1
|
||||
|
||||
'@vue/compiler-ssr@3.5.40':
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.40
|
||||
'@vue/shared': 3.5.40
|
||||
|
||||
'@vue/language-core@3.2.5':
|
||||
dependencies:
|
||||
'@volar/language-core': 2.4.28
|
||||
'@vue/compiler-dom': 3.5.41
|
||||
'@vue/shared': 3.5.41
|
||||
alien-signals: 3.2.1
|
||||
muggle-string: 0.4.1
|
||||
path-browserify: 1.0.1
|
||||
picomatch: 4.0.5
|
||||
|
||||
'@vue/reactivity@3.5.40':
|
||||
dependencies:
|
||||
'@vue/shared': 3.5.40
|
||||
|
||||
'@vue/runtime-core@3.5.40':
|
||||
dependencies:
|
||||
'@vue/reactivity': 3.5.40
|
||||
'@vue/shared': 3.5.40
|
||||
|
||||
'@vue/runtime-dom@3.5.40':
|
||||
dependencies:
|
||||
'@vue/reactivity': 3.5.40
|
||||
'@vue/runtime-core': 3.5.40
|
||||
'@vue/shared': 3.5.40
|
||||
csstype: 3.2.3
|
||||
|
||||
'@vue/server-renderer@3.5.40':
|
||||
dependencies:
|
||||
'@vue/compiler-ssr': 3.5.40
|
||||
'@vue/runtime-dom': 3.5.40
|
||||
'@vue/shared': 3.5.40
|
||||
|
||||
'@vue/shared@3.5.40': {}
|
||||
|
||||
'@vue/shared@3.5.41': {}
|
||||
|
||||
alien-signals@3.2.1: {}
|
||||
|
||||
csstype@3.2.3: {}
|
||||
|
||||
detect-libc@2.1.2: {}
|
||||
|
||||
dompurify@3.4.8:
|
||||
optionalDependencies:
|
||||
'@types/trusted-types': 2.0.7
|
||||
|
||||
echarts@6.1.0:
|
||||
dependencies:
|
||||
tslib: 2.3.0
|
||||
zrender: 6.1.0
|
||||
|
||||
entities@7.0.1: {}
|
||||
|
||||
estree-walker@2.0.2: {}
|
||||
|
||||
fdir@6.5.0(picomatch@4.0.5):
|
||||
optionalDependencies:
|
||||
picomatch: 4.0.5
|
||||
|
||||
fsevents@2.3.3:
|
||||
optional: true
|
||||
|
||||
lightningcss-android-arm64@1.33.0:
|
||||
optional: true
|
||||
|
||||
lightningcss-darwin-arm64@1.33.0:
|
||||
optional: true
|
||||
|
||||
lightningcss-darwin-x64@1.33.0:
|
||||
optional: true
|
||||
|
||||
lightningcss-freebsd-x64@1.33.0:
|
||||
optional: true
|
||||
|
||||
lightningcss-linux-arm-gnueabihf@1.33.0:
|
||||
optional: true
|
||||
|
||||
lightningcss-linux-arm64-gnu@1.33.0:
|
||||
optional: true
|
||||
|
||||
lightningcss-linux-arm64-musl@1.33.0:
|
||||
optional: true
|
||||
|
||||
lightningcss-linux-x64-gnu@1.33.0:
|
||||
optional: true
|
||||
|
||||
lightningcss-linux-x64-musl@1.33.0:
|
||||
optional: true
|
||||
|
||||
lightningcss-win32-arm64-msvc@1.33.0:
|
||||
optional: true
|
||||
|
||||
lightningcss-win32-x64-msvc@1.33.0:
|
||||
optional: true
|
||||
|
||||
lightningcss@1.33.0:
|
||||
dependencies:
|
||||
detect-libc: 2.1.2
|
||||
optionalDependencies:
|
||||
lightningcss-android-arm64: 1.33.0
|
||||
lightningcss-darwin-arm64: 1.33.0
|
||||
lightningcss-darwin-x64: 1.33.0
|
||||
lightningcss-freebsd-x64: 1.33.0
|
||||
lightningcss-linux-arm-gnueabihf: 1.33.0
|
||||
lightningcss-linux-arm64-gnu: 1.33.0
|
||||
lightningcss-linux-arm64-musl: 1.33.0
|
||||
lightningcss-linux-x64-gnu: 1.33.0
|
||||
lightningcss-linux-x64-musl: 1.33.0
|
||||
lightningcss-win32-arm64-msvc: 1.33.0
|
||||
lightningcss-win32-x64-msvc: 1.33.0
|
||||
|
||||
magic-string@0.30.21:
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
|
||||
marked@14.0.0: {}
|
||||
|
||||
monaco-editor@0.56.0:
|
||||
dependencies:
|
||||
dompurify: 3.4.8
|
||||
marked: 14.0.0
|
||||
|
||||
muggle-string@0.4.1: {}
|
||||
|
||||
nanoid@3.3.18: {}
|
||||
|
||||
path-browserify@1.0.1: {}
|
||||
|
||||
picocolors@1.1.1: {}
|
||||
|
||||
picomatch@4.0.5: {}
|
||||
|
||||
postcss@8.5.26:
|
||||
dependencies:
|
||||
nanoid: 3.3.18
|
||||
picocolors: 1.1.1
|
||||
source-map-js: 1.2.1
|
||||
|
||||
rolldown@1.1.5:
|
||||
dependencies:
|
||||
'@oxc-project/types': 0.139.0
|
||||
'@rolldown/pluginutils': 1.0.1
|
||||
optionalDependencies:
|
||||
'@rolldown/binding-android-arm64': 1.1.5
|
||||
'@rolldown/binding-darwin-arm64': 1.1.5
|
||||
'@rolldown/binding-darwin-x64': 1.1.5
|
||||
'@rolldown/binding-freebsd-x64': 1.1.5
|
||||
'@rolldown/binding-linux-arm-gnueabihf': 1.1.5
|
||||
'@rolldown/binding-linux-arm64-gnu': 1.1.5
|
||||
'@rolldown/binding-linux-arm64-musl': 1.1.5
|
||||
'@rolldown/binding-linux-ppc64-gnu': 1.1.5
|
||||
'@rolldown/binding-linux-s390x-gnu': 1.1.5
|
||||
'@rolldown/binding-linux-x64-gnu': 1.1.5
|
||||
'@rolldown/binding-linux-x64-musl': 1.1.5
|
||||
'@rolldown/binding-openharmony-arm64': 1.1.5
|
||||
'@rolldown/binding-wasm32-wasi': 1.1.5
|
||||
'@rolldown/binding-win32-arm64-msvc': 1.1.5
|
||||
'@rolldown/binding-win32-x64-msvc': 1.1.5
|
||||
|
||||
source-map-js@1.2.1: {}
|
||||
|
||||
tinyglobby@0.2.17:
|
||||
dependencies:
|
||||
fdir: 6.5.0(picomatch@4.0.5)
|
||||
picomatch: 4.0.5
|
||||
|
||||
tslib@2.3.0: {}
|
||||
|
||||
tslib@2.8.1:
|
||||
optional: true
|
||||
|
||||
typescript@5.9.3: {}
|
||||
|
||||
vite@8.1.5:
|
||||
dependencies:
|
||||
lightningcss: 1.33.0
|
||||
picomatch: 4.0.5
|
||||
postcss: 8.5.26
|
||||
rolldown: 1.1.5
|
||||
tinyglobby: 0.2.17
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.3
|
||||
|
||||
vscode-uri@3.1.0: {}
|
||||
|
||||
vue-tsc@3.2.5(typescript@5.9.3):
|
||||
dependencies:
|
||||
'@volar/typescript': 2.4.28
|
||||
'@vue/language-core': 3.2.5
|
||||
typescript: 5.9.3
|
||||
|
||||
vue@3.5.40(typescript@5.9.3):
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.40
|
||||
'@vue/compiler-sfc': 3.5.40
|
||||
'@vue/runtime-dom': 3.5.40
|
||||
'@vue/server-renderer': 3.5.40
|
||||
'@vue/shared': 3.5.40
|
||||
optionalDependencies:
|
||||
typescript: 5.9.3
|
||||
|
||||
zrender@6.1.0:
|
||||
dependencies:
|
||||
tslib: 2.3.0
|
||||
@@ -0,0 +1,63 @@
|
||||
<script setup lang="ts">
|
||||
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import * as monaco from 'monaco-editor/editor/editor.api.js'
|
||||
import 'monaco-editor/languages/definitions/sql/register.js'
|
||||
import EditorWorker from 'monaco-editor/editor/editor.worker.js?worker'
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
getWorker: () => new EditorWorker(),
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: string
|
||||
readOnly: boolean
|
||||
theme: 'vs' | 'vs-dark'
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: string]
|
||||
ready: [editor: monaco.editor.IStandaloneCodeEditor]
|
||||
run: []
|
||||
save: []
|
||||
}>()
|
||||
|
||||
const host = ref<HTMLElement>()
|
||||
let editor: monaco.editor.IStandaloneCodeEditor | undefined
|
||||
let model: monaco.editor.ITextModel | undefined
|
||||
|
||||
onMounted(() => {
|
||||
model = monaco.editor.createModel(props.modelValue, 'sql')
|
||||
editor = monaco.editor.create(host.value!, {
|
||||
model,
|
||||
theme: props.theme,
|
||||
readOnly: props.readOnly,
|
||||
automaticLayout: true,
|
||||
minimap: { enabled: true },
|
||||
fontSize: 14,
|
||||
lineHeight: 22,
|
||||
renderWhitespace: 'selection',
|
||||
scrollBeyondLastLine: false,
|
||||
wordWrap: 'off',
|
||||
ariaLabel: 'SQL 编辑器',
|
||||
})
|
||||
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter, () => emit('run'))
|
||||
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, () => emit('save'))
|
||||
editor.onDidChangeModelContent(() => emit('update:modelValue', model!.getValue()))
|
||||
emit('ready', editor)
|
||||
})
|
||||
|
||||
watch(() => props.readOnly, (value) => editor?.updateOptions({ readOnly: value }))
|
||||
watch(() => props.theme, (value) => monaco.editor.setTheme(value))
|
||||
watch(() => props.modelValue, (value) => {
|
||||
if (model && model.getValue() !== value) model.setValue(value)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
editor?.dispose()
|
||||
model?.dispose()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div ref="host" class="code-editor" data-testid="sql-editor" />
|
||||
</template>
|
||||
@@ -0,0 +1,162 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import type * as Monaco from 'monaco-editor'
|
||||
import { use } from 'echarts/core'
|
||||
import { GraphChart } from 'echarts/charts'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import { TitleComponent, TooltipComponent } from 'echarts/components'
|
||||
import * as echarts from 'echarts/core'
|
||||
import AixunCodeEditor from './AixunCodeEditor.vue'
|
||||
|
||||
use([GraphChart, CanvasRenderer, TitleComponent, TooltipComponent])
|
||||
|
||||
const seedSql = [
|
||||
'-- POC-UI-001 large SQL sample: 5,000 projections',
|
||||
'WITH source_rows AS (',
|
||||
...Array.from({ length: 5000 }, (_, index) =>
|
||||
` SELECT ${index + 1} AS id, 'value-${String(index + 1).padStart(5, '0')}' AS payload${index === 4999 ? '' : ' UNION ALL'}`,
|
||||
),
|
||||
')',
|
||||
'SELECT id, payload FROM source_rows ORDER BY id;',
|
||||
].join('\n')
|
||||
|
||||
const sql = ref(seedSql)
|
||||
const readOnly = ref(false)
|
||||
const dark = ref(false)
|
||||
const runCount = ref(0)
|
||||
const saveCount = ref(0)
|
||||
const lastAction = ref('未触发')
|
||||
const chartHost = ref<HTMLElement>()
|
||||
let editor: Monaco.editor.IStandaloneCodeEditor | undefined
|
||||
let chart: echarts.ECharts | undefined
|
||||
|
||||
const theme = computed(() => dark.value ? 'vs-dark' as const : 'vs' as const)
|
||||
const metrics = computed(() => ({
|
||||
lines: sql.value.split('\n').length,
|
||||
chars: sql.value.length,
|
||||
readOnly: readOnly.value,
|
||||
theme: dark.value ? 'dark' : 'light',
|
||||
runCount: runCount.value,
|
||||
saveCount: saveCount.value,
|
||||
lastAction: lastAction.value,
|
||||
}))
|
||||
|
||||
function onReady(value: Monaco.editor.IStandaloneCodeEditor) {
|
||||
editor = value
|
||||
editor.setPosition({ lineNumber: 5002, column: 1 })
|
||||
}
|
||||
|
||||
function runSql() {
|
||||
runCount.value += 1
|
||||
lastAction.value = 'Ctrl/Cmd+Enter 运行'
|
||||
}
|
||||
|
||||
function saveSql() {
|
||||
saveCount.value += 1
|
||||
lastAction.value = 'Ctrl/Cmd+S 保存'
|
||||
}
|
||||
|
||||
function toggleReadonly() {
|
||||
readOnly.value = !readOnly.value
|
||||
lastAction.value = readOnly.value ? '只读已启用' : '编辑已启用'
|
||||
nextTick(() => editor?.focus())
|
||||
}
|
||||
|
||||
function toggleTheme() {
|
||||
dark.value = !dark.value
|
||||
document.documentElement.dataset.theme = dark.value ? 'dark' : 'light'
|
||||
lastAction.value = dark.value ? '深色主题' : '浅色主题'
|
||||
chart?.setOption({
|
||||
textStyle: { color: dark.value ? '#dce6f2' : '#28394d' },
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
chart = echarts.init(chartHost.value!, undefined, { renderer: 'canvas' })
|
||||
chart.setOption({
|
||||
tooltip: {},
|
||||
series: [{
|
||||
type: 'graph',
|
||||
layout: 'force',
|
||||
roam: true,
|
||||
force: { repulsion: 260, edgeLength: 150 },
|
||||
label: { show: true, color: '#19324a', fontWeight: 600 },
|
||||
edgeSymbol: ['none', 'arrow'],
|
||||
edgeSymbolSize: 8,
|
||||
data: [
|
||||
{ name: 'ODS 订单', symbolSize: 68, itemStyle: { color: '#3b82f6' } },
|
||||
{ name: 'DWD 明细', symbolSize: 76, itemStyle: { color: '#14b8a6' } },
|
||||
{ name: 'DWS 汇总', symbolSize: 68, itemStyle: { color: '#f59e0b' } },
|
||||
{ name: 'API 产品', symbolSize: 62, itemStyle: { color: '#8b5cf6' } },
|
||||
],
|
||||
links: [
|
||||
{ source: 'ODS 订单', target: 'DWD 明细' },
|
||||
{ source: 'DWD 明细', target: 'DWS 汇总' },
|
||||
{ source: 'DWS 汇总', target: 'API 产品' },
|
||||
],
|
||||
}],
|
||||
})
|
||||
window.addEventListener('resize', () => chart?.resize())
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => chart?.dispose())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="shell">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<p class="eyebrow">POC-UI-001 · 实际控件验证</p>
|
||||
<h1>SQL 开发与血缘图控件基线</h1>
|
||||
<p>Monaco 负责长 SQL 与快捷键,ECharts 负责可缩放血缘图;本页不连接生产数据。</p>
|
||||
</div>
|
||||
<div class="status-pill" data-testid="render-status">控件已装载</div>
|
||||
</header>
|
||||
|
||||
<section class="toolbar" aria-label="编辑器工具栏">
|
||||
<button data-testid="readonly-toggle" @click="toggleReadonly">
|
||||
{{ readOnly ? '退出只读' : '启用只读' }}
|
||||
</button>
|
||||
<button data-testid="theme-toggle" @click="toggleTheme">
|
||||
{{ dark ? '切换浅色' : '切换深色' }}
|
||||
</button>
|
||||
<button class="primary" data-testid="run-button" @click="runSql">运行 SQL</button>
|
||||
<span>快捷键:Ctrl/Cmd+Enter 运行 · Ctrl/Cmd+S 保存</span>
|
||||
</section>
|
||||
|
||||
<section class="workspace">
|
||||
<article class="panel editor-panel">
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
<span class="panel-kicker">Monaco Editor</span>
|
||||
<h2>长 SQL 编辑器</h2>
|
||||
</div>
|
||||
<code data-testid="metrics">{{ JSON.stringify(metrics) }}</code>
|
||||
</div>
|
||||
<AixunCodeEditor
|
||||
v-model="sql"
|
||||
:read-only="readOnly"
|
||||
:theme="theme"
|
||||
@ready="onReady"
|
||||
@run="runSql"
|
||||
@save="saveSql"
|
||||
/>
|
||||
</article>
|
||||
|
||||
<article class="panel graph-panel">
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
<span class="panel-kicker">ECharts Graph</span>
|
||||
<h2>数据血缘预览</h2>
|
||||
</div>
|
||||
<span class="legend">4 节点 · 3 条边</span>
|
||||
</div>
|
||||
<div ref="chartHost" class="lineage-chart" data-testid="lineage-chart" aria-label="数据血缘图" />
|
||||
<div class="decision-note">
|
||||
<strong>封装边界</strong>
|
||||
<span>业务页面只依赖 `AixunCodeEditor` 的值、只读、主题和快捷键事件;不直接散落 Monaco API。</span>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
</main>
|
||||
</template>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module 'monaco-editor/editor/editor.api.js' {
|
||||
export * from 'monaco-editor'
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import './style.css'
|
||||
|
||||
createApp(App).mount('#app')
|
||||
@@ -0,0 +1,65 @@
|
||||
:root {
|
||||
font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
|
||||
color: #1a2b3c;
|
||||
background: #eef4f8;
|
||||
font-synthesis: none;
|
||||
}
|
||||
|
||||
:root[data-theme='dark'] {
|
||||
color: #dce6f2;
|
||||
background: #0e1822;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; min-width: 320px; min-height: 100vh; }
|
||||
button { font: inherit; }
|
||||
|
||||
.shell { min-height: 100vh; padding: 28px 32px; background: radial-gradient(circle at 85% 0%, rgba(41, 148, 205, .18), transparent 32%); }
|
||||
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
|
||||
.page-header h1 { margin: 4px 0 8px; font-size: clamp(26px, 2.4vw, 40px); line-height: 1.15; }
|
||||
.page-header p { margin: 0; color: #5b7185; }
|
||||
.eyebrow { color: #087f8c !important; font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
|
||||
.status-pill { flex: 0 0 auto; padding: 8px 13px; border: 1px solid #a8dce0; border-radius: 999px; color: #087f8c; background: #ecfeff; font-size: 13px; font-weight: 700; }
|
||||
.toolbar { display: flex; align-items: center; gap: 10px; min-height: 56px; margin-bottom: 16px; padding: 10px 12px; border: 1px solid #d4e1ea; border-radius: 12px; background: rgba(255,255,255,.86); box-shadow: 0 10px 28px rgba(42,65,86,.08); }
|
||||
.toolbar button { padding: 8px 13px; border: 1px solid #bfd0dc; border-radius: 8px; color: #243b51; background: white; cursor: pointer; }
|
||||
.toolbar .primary { color: white; border-color: #087f8c; background: #087f8c; }
|
||||
.toolbar span { margin-left: auto; color: #64788b; font-size: 12px; }
|
||||
.workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(360px, .75fr); gap: 16px; min-height: calc(100vh - 205px); }
|
||||
.panel { min-width: 0; overflow: hidden; border: 1px solid #d4e1ea; border-radius: 14px; background: rgba(255,255,255,.94); box-shadow: 0 14px 35px rgba(42,65,86,.09); }
|
||||
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; padding: 14px 16px; border-bottom: 1px solid #e4edf3; }
|
||||
.panel-heading h2 { margin: 3px 0 0; font-size: 18px; }
|
||||
.panel-kicker { color: #087f8c; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
|
||||
.panel-heading code { max-width: 58%; overflow: hidden; color: #5b7185; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.code-editor { height: calc(100vh - 294px); min-height: 410px; }
|
||||
.lineage-chart { height: calc(100vh - 370px); min-height: 340px; }
|
||||
.legend { color: #5b7185; font-size: 12px; }
|
||||
.decision-note { display: grid; gap: 5px; margin: 0 16px 16px; padding: 14px; border-left: 3px solid #0f9aa8; background: #edfafa; color: #476075; font-size: 13px; line-height: 1.5; }
|
||||
.decision-note strong { color: #17646c; }
|
||||
|
||||
:root[data-theme='dark'] .shell { background: radial-gradient(circle at 85% 0%, rgba(48, 155, 197, .22), transparent 34%); }
|
||||
:root[data-theme='dark'] .panel,
|
||||
:root[data-theme='dark'] .toolbar { border-color: #2a4054; background: rgba(20,34,47,.96); box-shadow: 0 14px 35px rgba(0,0,0,.25); }
|
||||
:root[data-theme='dark'] .page-header p,
|
||||
:root[data-theme='dark'] .toolbar span,
|
||||
:root[data-theme='dark'] .panel-heading code,
|
||||
:root[data-theme='dark'] .legend { color: #93a7bb; }
|
||||
:root[data-theme='dark'] .toolbar button { color: #dce6f2; border-color: #435c71; background: #1f3447; }
|
||||
:root[data-theme='dark'] .toolbar .primary { border-color: #18a6b2; background: #137f89; }
|
||||
:root[data-theme='dark'] .panel-heading { border-color: #2a4054; }
|
||||
:root[data-theme='dark'] .decision-note { background: #132f36; color: #afc8d2; }
|
||||
:root[data-theme='dark'] .decision-note strong { color: #6ed9df; }
|
||||
|
||||
@media (max-width: 1500px) {
|
||||
.shell { padding: 20px; }
|
||||
.workspace { grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); min-height: calc(100vh - 185px); }
|
||||
.code-editor { height: calc(100vh - 274px); min-height: 360px; }
|
||||
.lineage-chart { height: calc(100vh - 350px); min-height: 285px; }
|
||||
}
|
||||
|
||||
@media (max-width: 980px) {
|
||||
.page-header { flex-direction: column; }
|
||||
.toolbar { align-items: flex-start; flex-wrap: wrap; }
|
||||
.toolbar span { width: 100%; margin-left: 0; }
|
||||
.workspace { grid-template-columns: 1fr; }
|
||||
.code-editor, .lineage-chart { height: 460px; }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"skipLibCheck": true,
|
||||
"types": ["vite/client"]
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.vue"]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
build: {
|
||||
sourcemap: true,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
if (id.includes('/monaco-editor/')) return 'monaco'
|
||||
if (id.includes('/echarts/') || id.includes('/zrender/')) return 'echarts'
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
||||
exec "$script_dir/common/verify-final.sh" "$@"
|
||||
在新工单中引用
屏蔽一个用户