Initial project source
这个提交包含在:
@@ -0,0 +1,103 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly SECRET_DIR="${SCRIPT_DIR}/local/secrets"
|
||||
readonly EVIDENCE_DIR="${1:?evidence directory required}"
|
||||
readonly BASE_URL="http://127.0.0.1:32145/dolphinscheduler"
|
||||
readonly TMP_DIR="$(mktemp -d)"
|
||||
trap 'rm -rf "${TMP_DIR}"' EXIT
|
||||
mkdir -p "${EVIDENCE_DIR}"
|
||||
|
||||
sanitize() {
|
||||
jq '{code,success,failed,msg,data:(if (.data|type)=="object" then (.data|del(.sessionId,.token,.password,.userPassword)) else .data end)}' "$1" >"$2"
|
||||
}
|
||||
|
||||
# Bind first-install confirmation to the owned container and protected persistent store.
|
||||
scheduler_id="$(docker inspect aixun-datagov-m2-dolphinscheduler --format '{{json .}}' | jq -er '
|
||||
select(.Name == "/aixun-datagov-m2-dolphinscheduler" and .State.Running == true
|
||||
and .Config.Labels["com.aixun.project"] == "aixun-datagov"
|
||||
and .Config.Labels["com.docker.compose.project"] == "aixun-datagov-local"
|
||||
and .Config.Labels["com.docker.compose.service"] == "m2-dolphinscheduler"
|
||||
and .Config.Cmd == ["/bin/bash", "/opt/aixun-datagov/dolphinscheduler-remote-start.sh"]
|
||||
and any(.NetworkSettings.Ports["12345/tcp"][]?; .HostIp == "127.0.0.1" and .HostPort == "32145")
|
||||
and any(.Mounts[]; .Type == "volume" and .Name == "aixun-datagov-local-m2-dolphinscheduler-data"
|
||||
and .Destination == "/var/lib/aixun-datagov/dolphinscheduler" and .RW == true)
|
||||
and any(.Mounts[]; .Type == "bind" and .Destination == "/opt/aixun-datagov/dolphinscheduler-remote-start.sh"
|
||||
and .RW == false)) | .Id')"
|
||||
readonly scheduler_id
|
||||
|
||||
cookie="${TMP_DIR}/admin.cookie"
|
||||
raw="${TMP_DIR}/response.json"
|
||||
curl -fsS -c "${cookie}" -X POST "${BASE_URL}/login" \
|
||||
--data-urlencode userName=admin --data-urlencode userPassword=dolphinscheduler123 >"${raw}"
|
||||
sanitize "${raw}" "${EVIDENCE_DIR}/bootstrap-login.json"
|
||||
jq -e '.code == 0 and .success == true' "${raw}" >/dev/null
|
||||
|
||||
docker exec "${scheduler_id}" /bin/bash -c '
|
||||
set -euo pipefail
|
||||
umask 077
|
||||
store=/var/lib/aixun-datagov/dolphinscheduler
|
||||
[[ -s "$store/database.mv.db" && -f "$store/init-started" ]] || {
|
||||
echo "Persistent scheduler initialisation evidence is missing; refusing confirmation" >&2
|
||||
exit 78
|
||||
}
|
||||
if [[ ! -f "$store/initialized-3.4.2" ]]; then
|
||||
(set -o noclobber; : > "$store/initialized-3.4.2")
|
||||
fi
|
||||
'
|
||||
|
||||
curl -fsS -b "${cookie}" -X POST "${BASE_URL}/users/update" \
|
||||
--data-urlencode id=1 --data-urlencode userName=admin \
|
||||
--data-urlencode "userPassword@${SECRET_DIR}/dolphinscheduler-admin-password" \
|
||||
--data-urlencode email=admin@invalid.example --data-urlencode tenantId=-1 \
|
||||
--data-urlencode state=1 --data-urlencode timeZone=Asia/Shanghai >"${raw}"
|
||||
sanitize "${raw}" "${EVIDENCE_DIR}/admin-password-rotation.json"
|
||||
jq -e '.code == 0 and .success == true' "${raw}" >/dev/null
|
||||
|
||||
rm -f "${cookie}"
|
||||
curl -fsS -c "${cookie}" -X POST "${BASE_URL}/login" \
|
||||
--data-urlencode userName=admin \
|
||||
--data-urlencode "userPassword@${SECRET_DIR}/dolphinscheduler-admin-password" >"${raw}"
|
||||
jq -e '.code == 0 and .success == true' "${raw}" >/dev/null
|
||||
|
||||
curl -fsS -b "${cookie}" -X POST "${BASE_URL}/tenants" \
|
||||
--data-urlencode tenantCode=aixun_m2 --data-urlencode queueId=1 \
|
||||
--data-urlencode description=M2-GOLDEN-001 >"${raw}"
|
||||
sanitize "${raw}" "${EVIDENCE_DIR}/tenant-create.json"
|
||||
jq -e '.code == 0 and .success == true' "${raw}" >/dev/null
|
||||
tenant_id="$(jq -r '.data.id' "${raw}")"
|
||||
|
||||
curl -fsS -b "${cookie}" -X POST "${BASE_URL}/users/create" \
|
||||
--data-urlencode userName=aixun_m2_scheduler_svc \
|
||||
--data-urlencode "userPassword@${SECRET_DIR}/dolphinscheduler-service-password" \
|
||||
--data-urlencode "tenantId=${tenant_id}" --data-urlencode email=aixun-m2-scheduler@invalid.example \
|
||||
--data-urlencode phone= --data-urlencode state=1 >"${raw}"
|
||||
sanitize "${raw}" "${EVIDENCE_DIR}/service-user-create.json"
|
||||
jq -e '.code == 0 and .success == true and .data.userType == "GENERAL_USER"' "${raw}" >/dev/null
|
||||
user_id="$(jq -r '.data.id' "${raw}")"
|
||||
|
||||
future="$(date -v+1y '+%Y-%m-%d %H:%M:%S')"
|
||||
curl -fsS -b "${cookie}" -X POST "${BASE_URL}/access-tokens" \
|
||||
--data-urlencode "userId=${user_id}" --data-urlencode "expireTime=${future}" \
|
||||
--data-urlencode "token@${SECRET_DIR}/dolphinscheduler-token" >"${raw}"
|
||||
sanitize "${raw}" "${EVIDENCE_DIR}/service-token-create.json"
|
||||
jq -e '.code == 0 and .success == true' "${raw}" >/dev/null
|
||||
|
||||
service_cookie="${TMP_DIR}/service.cookie"
|
||||
curl -fsS -c "${service_cookie}" -X POST "${BASE_URL}/login" \
|
||||
--data-urlencode userName=aixun_m2_scheduler_svc \
|
||||
--data-urlencode "userPassword@${SECRET_DIR}/dolphinscheduler-service-password" >"${raw}"
|
||||
jq -e '.code == 0 and .success == true' "${raw}" >/dev/null
|
||||
curl -fsS -b "${service_cookie}" -X POST "${BASE_URL}/projects" \
|
||||
--data-urlencode projectName=aixun_m2_golden_project \
|
||||
--data-urlencode description=M2-GOLDEN-001 >"${raw}"
|
||||
sanitize "${raw}" "${EVIDENCE_DIR}/project-create.json"
|
||||
jq -e '.code == 0 and .success == true' "${raw}" >/dev/null
|
||||
|
||||
token_status="$(curl -sS -o "${TMP_DIR}/token-read.json" -w '%{http_code}' \
|
||||
-H "token: $(<"${SECRET_DIR}/dolphinscheduler-token")" \
|
||||
"${BASE_URL}/projects/$(jq -r '.data.code' "${raw}")")"
|
||||
[[ "${token_status}" == "200" ]] || { echo 'DolphinScheduler service token readback failed' >&2; exit 1; }
|
||||
jq '{code,success,msg,data:{code:.data.code,name:.data.name}}' "${TMP_DIR}/token-read.json" >"${EVIDENCE_DIR}/service-token-project-readback.json"
|
||||
echo 'PASS: DolphinScheduler bootstrap credential rotated; GENERAL_USER token owns only the M2 project.' >"${EVIDENCE_DIR}/result.txt"
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly SECRET_DIR="${SCRIPT_DIR}/local/secrets"
|
||||
readonly EVIDENCE_DIR="${1:?evidence directory required}"
|
||||
readonly TMP_DIR="$(mktemp -d)"
|
||||
trap 'rm -rf "${TMP_DIR}"' EXIT
|
||||
mkdir -p "${EVIDENCE_DIR}"
|
||||
|
||||
root_password="$(<"${SECRET_DIR}/doris-root-password")"
|
||||
loader_password="$(<"${SECRET_DIR}/doris-loader-password")"
|
||||
query_password="$(<"${SECRET_DIR}/doris-query-password")"
|
||||
denied_password="$(<"${SECRET_DIR}/doris-denied-password")"
|
||||
sql="${TMP_DIR}/bootstrap.sql"
|
||||
cat >"${sql}" <<EOF
|
||||
ALTER USER 'root'@'%' IDENTIFIED BY '${root_password}';
|
||||
CREATE DATABASE IF NOT EXISTS aixun_m2;
|
||||
CREATE TABLE IF NOT EXISTS aixun_m2.m2_orders (
|
||||
record_id BIGINT NOT NULL, batch_no VARCHAR(64) NOT NULL, order_no VARCHAR(128) NULL,
|
||||
customer_code VARCHAR(128) NULL, amount DECIMAL(18,2) NULL, event_time DATETIME NULL,
|
||||
quality_flag VARCHAR(32) NOT NULL, scope_code VARCHAR(16) NOT NULL DEFAULT 'M2',
|
||||
internal_note VARCHAR(64) NULL
|
||||
) UNIQUE KEY(record_id, batch_no) DISTRIBUTED BY HASH(record_id) BUCKETS 1 PROPERTIES('replication_num'='1');
|
||||
CREATE USER IF NOT EXISTS 'aixun_m2_doris_loader'@'%' IDENTIFIED BY '${loader_password}';
|
||||
ALTER USER 'aixun_m2_doris_loader'@'%' IDENTIFIED BY '${loader_password}';
|
||||
CREATE USER IF NOT EXISTS 'aixun_m2_doris_query'@'%' IDENTIFIED BY '${query_password}';
|
||||
ALTER USER 'aixun_m2_doris_query'@'%' IDENTIFIED BY '${query_password}';
|
||||
CREATE USER IF NOT EXISTS 'aixun_m2_doris_denied'@'%' IDENTIFIED BY '${denied_password}';
|
||||
ALTER USER 'aixun_m2_doris_denied'@'%' IDENTIFIED BY '${denied_password}';
|
||||
GRANT SELECT_PRIV,LOAD_PRIV,ALTER_PRIV,CREATE_PRIV ON internal.aixun_m2.* TO 'aixun_m2_doris_loader'@'%';
|
||||
GRANT SELECT_PRIV(record_id,batch_no,order_no,customer_code,amount,event_time,quality_flag,scope_code) ON internal.aixun_m2.m2_orders TO 'aixun_m2_doris_query'@'%';
|
||||
CREATE ROW POLICY IF NOT EXISTS aixun_m2_query_scope ON aixun_m2.m2_orders AS RESTRICTIVE TO aixun_m2_doris_query USING (scope_code = 'M2');
|
||||
CREATE WORKLOAD GROUP IF NOT EXISTS aixun_m2_bounded_query PROPERTIES (
|
||||
'max_concurrency'='2','max_queue_size'='4','queue_timeout'='2000','max_memory_percent'='10%'
|
||||
);
|
||||
GRANT USAGE_PRIV ON WORKLOAD GROUP aixun_m2_bounded_query TO 'aixun_m2_doris_query'@'%';
|
||||
SET PROPERTY FOR 'aixun_m2_doris_query' 'default_workload_group'='aixun_m2_bounded_query';
|
||||
SET PROPERTY FOR 'aixun_m2_doris_query' 'query_timeout'='5';
|
||||
SHOW GRANTS FOR 'aixun_m2_doris_query'@'%';
|
||||
SHOW ROW POLICY;
|
||||
EOF
|
||||
chmod 0600 "${sql}"
|
||||
|
||||
set +e
|
||||
docker exec -i aixun-datagov-m2-doris-fe \
|
||||
mysql --protocol=TCP -h127.0.0.1 -P9030 -uroot \
|
||||
<"${sql}" >"${EVIDENCE_DIR}/bootstrap-readback.raw.tsv" 2>"${TMP_DIR}/bootstrap-root.stderr"
|
||||
bootstrap_status=$?
|
||||
set -e
|
||||
if (( bootstrap_status != 0 )); then
|
||||
docker exec -i -e MYSQL_PWD="${root_password}" aixun-datagov-m2-doris-fe \
|
||||
mysql --protocol=TCP -h127.0.0.1 -P9030 -uroot \
|
||||
<"${sql}" >"${EVIDENCE_DIR}/bootstrap-readback.raw.tsv"
|
||||
fi
|
||||
sed -E "s/(IDENTIFIED BY|PASSWORD)[^[:space:]]*/\\1 [REDACTED]/Ig" \
|
||||
"${EVIDENCE_DIR}/bootstrap-readback.raw.tsv" >"${EVIDENCE_DIR}/bootstrap-readback.tsv"
|
||||
rm -f "${EVIDENCE_DIR}/bootstrap-readback.raw.tsv"
|
||||
|
||||
docker exec -e MYSQL_PWD="${query_password}" aixun-datagov-m2-doris-fe \
|
||||
mysql --protocol=TCP -h127.0.0.1 -P9030 -uaixun_m2_doris_query \
|
||||
-e 'SELECT COUNT(*) AS approved_rows FROM aixun_m2.m2_orders' >"${EVIDENCE_DIR}/query-user-allow.tsv"
|
||||
set +e
|
||||
docker exec -e MYSQL_PWD="${denied_password}" aixun-datagov-m2-doris-fe \
|
||||
mysql --protocol=TCP -h127.0.0.1 -P9030 -uaixun_m2_doris_denied \
|
||||
-e 'SELECT COUNT(*) FROM aixun_m2.m2_orders' >"${EVIDENCE_DIR}/denied-user.tsv" 2>"${EVIDENCE_DIR}/denied-user.stderr"
|
||||
denied_status=$?
|
||||
set -e
|
||||
printf 'exit_code=%s\n' "${denied_status}" >>"${EVIDENCE_DIR}/denied-user.tsv"
|
||||
(( denied_status != 0 )) || { echo 'Doris denied account unexpectedly queried the table' >&2; exit 1; }
|
||||
unset root_password loader_password query_password denied_password
|
||||
echo 'PASS: Doris loader/query/denied identities, column grant, row policy and workload group read back.' >"${EVIDENCE_DIR}/result.txt"
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly SECRET_DIR="${SCRIPT_DIR}/local/secrets"
|
||||
readonly EVIDENCE_DIR="${1:?evidence directory required}"
|
||||
mkdir -p "${EVIDENCE_DIR}"
|
||||
|
||||
docker exec \
|
||||
-e M2_USER=aixun_m2_hive_admin \
|
||||
-e M2_PASSWORD_PATH=/run/secrets/hive_auth_admin_password \
|
||||
aixun-datagov-m2-hive 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 "$M2_USER" -p "$(cat "$M2_PASSWORD_PATH")" \
|
||||
-e "SET ROLE admin;
|
||||
CREATE DATABASE IF NOT EXISTS aixun_m2;
|
||||
CREATE TABLE IF NOT EXISTS aixun_m2.m2_orders_valid (
|
||||
record_id BIGINT, order_no STRING, customer_code STRING, amount DECIMAL(18,2),
|
||||
event_time TIMESTAMP, quality_flag STRING
|
||||
) PARTITIONED BY (batch_no STRING) STORED AS ORC;
|
||||
CREATE TABLE IF NOT EXISTS aixun_m2.m2_orders_quarantine (
|
||||
record_id BIGINT, order_no STRING, customer_code STRING, amount DECIMAL(18,2),
|
||||
event_time TIMESTAMP, quality_flag STRING
|
||||
) PARTITIONED BY (batch_no STRING) STORED AS ORC;
|
||||
REVOKE ALL ON DATABASE aixun_m2 FROM USER aixun_m2_hive_loader;
|
||||
GRANT SELECT, INSERT ON TABLE aixun_m2.m2_orders_valid TO USER aixun_m2_hive_loader;
|
||||
GRANT SELECT, INSERT ON TABLE aixun_m2.m2_orders_quarantine TO USER aixun_m2_hive_loader;
|
||||
SHOW GRANT USER aixun_m2_hive_loader ON TABLE aixun_m2.m2_orders_valid;
|
||||
SHOW GRANT USER aixun_m2_hive_loader ON TABLE aixun_m2.m2_orders_quarantine"
|
||||
' >"${EVIDENCE_DIR}/loader-grant-readback.tsv" 2>"${EVIDENCE_DIR}/loader-grant-readback.stderr"
|
||||
|
||||
set +e
|
||||
docker exec \
|
||||
-e M2_USER=aixun_m2_hive_denied \
|
||||
-e M2_PASSWORD_PATH=/run/secrets/hive_auth_denied_password \
|
||||
aixun-datagov-m2-hive 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 "$M2_USER" -p "$(cat "$M2_PASSWORD_PATH")" \
|
||||
-e "SELECT * FROM aixun_m2.must_not_exist"
|
||||
' >"${EVIDENCE_DIR}/denied-user.tsv" 2>"${EVIDENCE_DIR}/denied-user.stderr"
|
||||
denied_status=$?
|
||||
set -e
|
||||
printf 'exit_code=%s\n' "${denied_status}" >>"${EVIDENCE_DIR}/denied-user.tsv"
|
||||
(( denied_status != 0 )) || { echo 'Hive denied account unexpectedly accessed M2 database' >&2; exit 1; }
|
||||
echo 'PASS: Hive tables are admin-owned; loader has table SELECT/INSERT only; denied identity has no approved-table access.' >"${EVIDENCE_DIR}/result.txt"
|
||||
+191
@@ -0,0 +1,191 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly SECRET_DIR="${SCRIPT_DIR}/local/secrets"
|
||||
readonly EVIDENCE_DIR="${1:?evidence directory required}"
|
||||
readonly BASE_URL="http://127.0.0.1:33185/api/v1"
|
||||
readonly TMP_DIR="$(mktemp -d)"
|
||||
trap 'rm -rf "${TMP_DIR}"' EXIT
|
||||
mkdir -p "${EVIDENCE_DIR}"
|
||||
umask 077
|
||||
|
||||
login() {
|
||||
local email="$1"
|
||||
local password_file="$2"
|
||||
local response_file="$3"
|
||||
local encoded
|
||||
encoded="$(openssl base64 -A -in "${password_file}")"
|
||||
jq -nc --arg email "${email}" --arg password "${encoded}" \
|
||||
'{email:$email,password:$password}' \
|
||||
| curl -sS -o "${response_file}" -w '%{http_code}' \
|
||||
-H 'Content-Type: application/json' --data-binary @- "${BASE_URL}/users/login"
|
||||
unset encoded
|
||||
}
|
||||
|
||||
write_curl_config() {
|
||||
local response_file="$1"
|
||||
local config_file="$2"
|
||||
jq -r '.accessToken' "${response_file}" >"${TMP_DIR}/access-token"
|
||||
printf 'silent\nshow-error\nheader = "Authorization: Bearer %s"\n' \
|
||||
"$(<"${TMP_DIR}/access-token")" >"${config_file}"
|
||||
chmod 0600 "${config_file}"
|
||||
}
|
||||
|
||||
bootstrap_password="${TMP_DIR}/bootstrap-password"
|
||||
printf '%s' admin >"${bootstrap_password}"
|
||||
admin_response="${TMP_DIR}/admin-login.json"
|
||||
admin_login_status="$(login admin@open-metadata.org "${bootstrap_password}" "${admin_response}")"
|
||||
|
||||
if [[ "${admin_login_status}" == 200 ]]; then
|
||||
write_curl_config "${admin_response}" "${TMP_DIR}/bootstrap-admin.curl"
|
||||
old_password="$(<"${bootstrap_password}")"
|
||||
new_password="$(<"${SECRET_DIR}/om-admin-password")"
|
||||
change_status="$(jq -nc \
|
||||
--arg old "${old_password}" --arg new "${new_password}" \
|
||||
'{username:"admin@open-metadata.org",oldPassword:$old,newPassword:$new,confirmPassword:$new,requestType:"SELF"}' \
|
||||
| curl --config "${TMP_DIR}/bootstrap-admin.curl" -sS -o "${TMP_DIR}/change-password.json" -w '%{http_code}' \
|
||||
-X PUT -H 'Content-Type: application/json' --data-binary @- "${BASE_URL}/users/changePassword")"
|
||||
unset old_password new_password
|
||||
if [[ "${change_status}" != 200 ]]; then
|
||||
jq --argjson http "${change_status}" '{http:$http,error:(.message // .error // .)}' \
|
||||
"${TMP_DIR}/change-password.json" >"${EVIDENCE_DIR}/admin-password-rotation-error.json"
|
||||
echo "OpenMetadata administrator password rotation failed with HTTP ${change_status}" >&2
|
||||
exit 1
|
||||
fi
|
||||
jq -nc --argjson http "${change_status}" '{http:$http,outcome:"bootstrap administrator password rotated"}' \
|
||||
>"${EVIDENCE_DIR}/admin-password-rotation.json"
|
||||
else
|
||||
current_status="$(login admin@open-metadata.org "${SECRET_DIR}/om-admin-password" "${admin_response}")"
|
||||
[[ "${current_status}" == 200 ]] || { echo 'OpenMetadata administrator login failed for bootstrap and current secretRef' >&2; exit 1; }
|
||||
jq -nc --argjson http "${current_status}" '{http:$http,outcome:"current administrator secretRef accepted"}' \
|
||||
>"${EVIDENCE_DIR}/admin-password-rotation.json"
|
||||
fi
|
||||
|
||||
current_admin_status="$(login admin@open-metadata.org "${SECRET_DIR}/om-admin-password" "${admin_response}")"
|
||||
[[ "${current_admin_status}" == 200 ]] || { echo 'OpenMetadata rotated administrator login failed' >&2; exit 1; }
|
||||
write_curl_config "${admin_response}" "${TMP_DIR}/admin.curl"
|
||||
jq -nc --argjson http "${current_admin_status}" '{http:$http,tokenType:"Bearer",outcome:"rotated administrator login accepted"}' \
|
||||
>"${EVIDENCE_DIR}/admin-login.json"
|
||||
|
||||
curl --config "${TMP_DIR}/admin.curl" -fsS "${BASE_URL}/roles/name/DataSteward" >"${TMP_DIR}/role.json"
|
||||
role_id="$(jq -r '.id' "${TMP_DIR}/role.json")"
|
||||
|
||||
writer_policy_status="$(jq -nc '{
|
||||
name:"M2GoldenMetadataWriterPolicy",
|
||||
displayName:"M2 Golden Metadata Writer Policy",
|
||||
description:"M2-GOLDEN-001 least-privilege metadata ingestion and official connection verification",
|
||||
enabled:true,
|
||||
rules:[{
|
||||
name:"M2GoldenMetadataWriterRule-Allow",
|
||||
description:"Allow the formal M2 adapter to create and update only the required metadata hierarchy",
|
||||
effect:"allow",
|
||||
operations:["Create","EditAll","ViewAll"],
|
||||
resources:["databaseService","database","databaseSchema","table"]
|
||||
},{
|
||||
name:"M2MetadataIngestionWorkflowRule-Allow",
|
||||
description:"Allow the formal adapter to create an official test-connection workflow",
|
||||
effect:"allow",
|
||||
operations:["Create"],
|
||||
resources:["workflow"]
|
||||
},{
|
||||
name:"M2MetadataIngestionPipelineRule-Allow",
|
||||
description:"Allow the formal adapter to create, update and read its ingestion pipeline",
|
||||
effect:"allow",
|
||||
operations:["Create","EditAll","ViewAll"],
|
||||
resources:["ingestionPipeline"]
|
||||
}]
|
||||
}' | curl --config "${TMP_DIR}/admin.curl" -sS -o "${TMP_DIR}/writer-policy.json" -w '%{http_code}' \
|
||||
-X PUT -H 'Content-Type: application/json' --data-binary @- "${BASE_URL}/policies")"
|
||||
[[ "${writer_policy_status}" == 200 || "${writer_policy_status}" == 201 ]] || {
|
||||
echo "OpenMetadata M2 writer policy upsert failed with HTTP ${writer_policy_status}" >&2
|
||||
exit 1
|
||||
}
|
||||
writer_policy_id="$(jq -r '.id' "${TMP_DIR}/writer-policy.json")"
|
||||
jq --argjson http "${writer_policy_status}" \
|
||||
'{http:$http,id,name,displayName,provider,rules:[.rules[]|{name,effect,operations,resources}]}' \
|
||||
"${TMP_DIR}/writer-policy.json" >"${EVIDENCE_DIR}/service-writer-policy.json"
|
||||
|
||||
writer_role_status="$(jq -nc --arg policy "M2GoldenMetadataWriterPolicy" '{
|
||||
name:"M2GoldenMetadataWriter",
|
||||
displayName:"M2 Golden Metadata Writer",
|
||||
description:"M2-GOLDEN-001 formal adapter role without delete or administrator operations",
|
||||
policies:[$policy]
|
||||
}' | curl --config "${TMP_DIR}/admin.curl" -sS -o "${TMP_DIR}/writer-role.json" -w '%{http_code}' \
|
||||
-X PUT -H 'Content-Type: application/json' --data-binary @- "${BASE_URL}/roles")"
|
||||
[[ "${writer_role_status}" == 200 || "${writer_role_status}" == 201 ]] || {
|
||||
echo "OpenMetadata M2 writer role upsert failed with HTTP ${writer_role_status}" >&2
|
||||
exit 1
|
||||
}
|
||||
writer_role_id="$(jq -r '.id' "${TMP_DIR}/writer-role.json")"
|
||||
jq --argjson policyHttp "${writer_policy_status}" --argjson roleHttp "${writer_role_status}" \
|
||||
--slurpfile steward "${TMP_DIR}/role.json" \
|
||||
'{policyHttp:$policyHttp,roleHttp:$roleHttp,steward:($steward[0]|{id,name,displayName,provider}),writer:{id,name,displayName,provider,policies}}' \
|
||||
"${TMP_DIR}/writer-role.json" >"${EVIDENCE_DIR}/service-role.json"
|
||||
|
||||
service_name=aixun_m2_ingestion_svc
|
||||
service_email=aixun_m2_ingestion_svc@invalid.example
|
||||
user_status="$(curl --config "${TMP_DIR}/admin.curl" -sS -o "${TMP_DIR}/service-user.json" -w '%{http_code}' \
|
||||
"${BASE_URL}/users/name/${service_name}?fields=roles")"
|
||||
if [[ "${user_status}" == 404 ]]; then
|
||||
service_password="$(<"${SECRET_DIR}/om-service-password")"
|
||||
user_status="$(jq -nc --arg role "${role_id}" --arg writerRole "${writer_role_id}" --arg password "${service_password}" \
|
||||
--arg name "${service_name}" --arg email "${service_email}" \
|
||||
'{name:$name,email:$email,displayName:"AiXun M2 metadata service",description:"M2-GOLDEN-001 OpenMetadata adapter identity",isAdmin:false,isBot:false,roles:[$role,$writerRole],createPasswordType:"ADMIN_CREATE",password:$password,confirmPassword:$password}' \
|
||||
| curl --config "${TMP_DIR}/admin.curl" -sS -o "${TMP_DIR}/service-user.json" -w '%{http_code}' \
|
||||
-X POST -H 'Content-Type: application/json' --data-binary @- "${BASE_URL}/users")"
|
||||
unset service_password
|
||||
[[ "${user_status}" == 200 || "${user_status}" == 201 ]] || { echo "OpenMetadata service user creation failed with HTTP ${user_status}" >&2; exit 1; }
|
||||
elif [[ "${user_status}" != 200 ]]; then
|
||||
echo "OpenMetadata service user lookup failed with HTTP ${user_status}" >&2
|
||||
exit 1
|
||||
fi
|
||||
service_id="$(jq -r '.id' "${TMP_DIR}/service-user.json")"
|
||||
roles_current="$(jq --arg steward "${role_id}" --arg writer "${writer_role_id}" \
|
||||
'[.roles[].id] | contains([$steward,$writer])' "${TMP_DIR}/service-user.json")"
|
||||
if [[ "${roles_current}" != true ]]; then
|
||||
patch_status="$(jq -nc --arg steward "${role_id}" --arg writer "${writer_role_id}" \
|
||||
'[{op:"replace",path:"/roles",value:[{id:$steward,type:"role"},{id:$writer,type:"role"}]}]' \
|
||||
| curl --config "${TMP_DIR}/admin.curl" -sS -o "${TMP_DIR}/service-user-patched.json" -w '%{http_code}' \
|
||||
-X PATCH -H 'Content-Type: application/json-patch+json' --data-binary @- "${BASE_URL}/users/${service_id}")"
|
||||
[[ "${patch_status}" == 200 ]] || {
|
||||
echo "OpenMetadata service user least-privilege role patch failed with HTTP ${patch_status}" >&2
|
||||
exit 1
|
||||
}
|
||||
mv "${TMP_DIR}/service-user-patched.json" "${TMP_DIR}/service-user.json"
|
||||
user_status="${patch_status}"
|
||||
fi
|
||||
jq --argjson http "${user_status}" '{http:$http,id,name,email,isAdmin,isBot,roles:[(.roles // [])[]|{id,name,type}]}' \
|
||||
"${TMP_DIR}/service-user.json" >"${EVIDENCE_DIR}/service-user-readback.json"
|
||||
|
||||
service_login="${TMP_DIR}/service-login.json"
|
||||
service_login_status="$(login "${service_email}" "${SECRET_DIR}/om-service-password" "${service_login}")"
|
||||
if [[ "${service_login_status}" == 200 ]]; then
|
||||
write_curl_config "${service_login}" "${TMP_DIR}/service.curl"
|
||||
token_status="$(jq -nc --arg id "${service_id}" '{id:$id,JWTTokenExpiry:"30"}' \
|
||||
| curl --config "${TMP_DIR}/service.curl" -sS -o "${TMP_DIR}/service-token.json" -w '%{http_code}' \
|
||||
-X POST -H 'Content-Type: application/json' --data-binary @- "${BASE_URL}/users/generateToken")"
|
||||
[[ "${token_status}" == 200 ]] || { echo "OpenMetadata service token generation failed with HTTP ${token_status}" >&2; exit 1; }
|
||||
jq -r '.JWTToken' "${TMP_DIR}/service-token.json" >"${SECRET_DIR}/openmetadata-token"
|
||||
chmod 0600 "${SECRET_DIR}/openmetadata-token"
|
||||
jq --argjson http "${token_status}" '{http:$http,JWTTokenExpiry,JWTTokenExpiresAt,tokenPersistedBy:"secretRef"}' \
|
||||
"${TMP_DIR}/service-token.json" >"${EVIDENCE_DIR}/service-token.json"
|
||||
else
|
||||
existing_token_status="$(curl -sS -o "${TMP_DIR}/existing-token.json" -w '%{http_code}' \
|
||||
-H "Authorization: Bearer $(<"${SECRET_DIR}/openmetadata-token")" "${BASE_URL}/users/loggedInUser")"
|
||||
[[ "${existing_token_status}" == 200 ]] || { echo 'OpenMetadata service password is token-only and the persisted JWT is invalid' >&2; exit 1; }
|
||||
fi
|
||||
|
||||
no_auth_status="$(curl -sS -o "${TMP_DIR}/no-auth.json" -w '%{http_code}' "${BASE_URL}/tables?limit=1")"
|
||||
[[ "${no_auth_status}" == 401 ]] || { echo "OpenMetadata unauthenticated table request returned ${no_auth_status}" >&2; exit 1; }
|
||||
jq -nc --argjson http "${no_auth_status}" '{http:$http,outcome:"unauthenticated metadata read rejected"}' \
|
||||
>"${EVIDENCE_DIR}/unauthenticated-deny.json"
|
||||
|
||||
service_read_status="$(curl -sS -o "${TMP_DIR}/service-self.json" -w '%{http_code}' \
|
||||
-H "Authorization: Bearer $(<"${SECRET_DIR}/openmetadata-token")" "${BASE_URL}/users/loggedInUser?fields=roles")"
|
||||
[[ "${service_read_status}" == 200 ]] || { echo "OpenMetadata generated service token readback failed with HTTP ${service_read_status}" >&2; exit 1; }
|
||||
jq --argjson http "${service_read_status}" '{http:$http,id,name,email,isAdmin,isBot,roles:[(.roles // [])[]|{id,name,type}]}' \
|
||||
"${TMP_DIR}/service-self.json" >"${EVIDENCE_DIR}/service-token-readback.json"
|
||||
|
||||
echo 'PASS: OpenMetadata bootstrap administrator rotated; DataSteward plus M2 least-privilege writer service identity and 30-day JWT secretRef read back; unauthenticated access denied.' \
|
||||
>"${EVIDENCE_DIR}/result.txt"
|
||||
@@ -0,0 +1,645 @@
|
||||
name: aixun-datagov-local
|
||||
|
||||
x-m2-labels: &m2-labels
|
||||
com.aixun.project: aixun-datagov
|
||||
com.aixun.environment: local
|
||||
com.aixun.scope: m2
|
||||
com.aixun.task: M2-GOLDEN-001
|
||||
|
||||
x-openmetadata-environment: &openmetadata-environment
|
||||
OPENMETADATA_CLUSTER_NAME: aixun-datagov-m2-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,aixun_m2_ingestion_svc]"
|
||||
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://m2-openmetadata: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-m2-openmetadata
|
||||
JWT_KEY_ID: aixun-datagov-m2-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: om-mysql
|
||||
DB_PORT: "3306"
|
||||
OM_DATABASE: aixun_m2_openmetadata
|
||||
ELASTICSEARCH_HOST: om-elasticsearch
|
||||
ELASTICSEARCH_PORT: "9200"
|
||||
ELASTICSEARCH_SCHEME: http
|
||||
SEARCH_TYPE: elasticsearch
|
||||
ELASTICSEARCH_CONNECTION_TIMEOUT_SECS: "5"
|
||||
ELASTICSEARCH_SOCKET_TIMEOUT_SECS: "60"
|
||||
OPENMETADATA_HEAP_OPTS: -Xmx1536M -Xms1024M
|
||||
PIPELINE_SERVICE_CLIENT_ENABLED: "true"
|
||||
PIPELINE_SERVICE_CLIENT_CLASS_NAME: org.openmetadata.service.clients.pipeline.airflow.AirflowRESTClient
|
||||
PIPELINE_SERVICE_CLIENT_ENDPOINT: http://m2-om-ingestion:8080
|
||||
PIPELINE_SERVICE_CLIENT_HEALTH_CHECK_INTERVAL: "60"
|
||||
PIPELINE_SERVICE_CLIENT_VERIFY_SSL: no-ssl
|
||||
PIPELINE_SERVICE_CLIENT_SSL_CERT_PATH: ""
|
||||
PIPELINE_SERVICE_CLIENT_SECRETS_MANAGER_LOADER: noop
|
||||
PIPELINE_SERVICE_IP_INFO_ENABLED: "false"
|
||||
SERVER_HOST_API_URL: http://m2-openmetadata:8585/api
|
||||
AIRFLOW_USERNAME: aixun_m2_airflow_admin
|
||||
AIRFLOW_TIMEOUT: "30"
|
||||
SECRET_MANAGER: db
|
||||
WEB_CONF_FRAME_OPTION_ENABLED: "true"
|
||||
WEB_CONF_FRAME_OPTION: DENY
|
||||
WEB_CONF_CONTENT_TYPE_OPTIONS_ENABLED: "true"
|
||||
WEB_CONF_XSS_CSP_ENABLED: "true"
|
||||
WEB_CONF_XSS_CSP_POLICY: "default-src 'self'; frame-ancestors 'none'"
|
||||
|
||||
services:
|
||||
integration:
|
||||
profiles: [app]
|
||||
environment:
|
||||
AIXUN_DATAGOV_M2_ENABLED: "true"
|
||||
|
||||
m2-source-mysql:
|
||||
image: mysql:8.4.9@sha256:c36050afdca850f23cef85703f84c7531a5ae155a11b5ee1c60acb09937c4084
|
||||
container_name: aixun-datagov-m2-source-mysql
|
||||
hostname: m2-source-mysql
|
||||
labels: *m2-labels
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/source_mysql_root_password
|
||||
MYSQL_DATABASE: aixun_m2_source
|
||||
MYSQL_USER: aixun_m2_ingestion
|
||||
MYSQL_PASSWORD_FILE: /run/secrets/source_password
|
||||
command: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]
|
||||
ports:
|
||||
- "127.0.0.1:30307:3306"
|
||||
volumes:
|
||||
- m2-source-mysql-data:/var/lib/mysql
|
||||
- ./m2/source/01-init-golden.sql:/docker-entrypoint-initdb.d/01-init-golden.sql:ro
|
||||
secrets:
|
||||
- source_mysql_root_password
|
||||
- source_password
|
||||
networks:
|
||||
m2-integration:
|
||||
ipv4_address: 172.29.0.20
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "MYSQL_PWD=$$(cat /run/secrets/source_password) mysqladmin ping -h 127.0.0.1 -u aixun_m2_ingestion --silent"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 60
|
||||
restart: unless-stopped
|
||||
|
||||
m2-seatunnel:
|
||||
build:
|
||||
context: ./m2/seatunnel
|
||||
dockerfile: Dockerfile
|
||||
image: aixun-datagov/seatunnel:2.3.13-ingestion-kingbase-20261104
|
||||
container_name: aixun-datagov-m2-seatunnel
|
||||
hostname: m2-seatunnel
|
||||
labels: *m2-labels
|
||||
ports:
|
||||
- "127.0.0.1:31180:8080"
|
||||
secrets:
|
||||
- seatunnel_username
|
||||
- seatunnel_password
|
||||
- hive_s3_access_key
|
||||
- hive_s3_secret_key
|
||||
volumes:
|
||||
- m2-seatunnel-checkpoints:/tmp/seatunnel
|
||||
- file-ingestion-data:/var/lib/aixun-datagov/ingestion:ro
|
||||
networks:
|
||||
m2-integration:
|
||||
ipv4_address: 172.29.0.4
|
||||
m2-hive-private: {}
|
||||
depends_on:
|
||||
m2-source-mysql:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS -u \"$$(cat /run/secrets/seatunnel_username):$$(cat /run/secrets/seatunnel_password)\" http://127.0.0.1:8080/overview >/dev/null"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 90
|
||||
start_period: 20s
|
||||
restart: unless-stopped
|
||||
|
||||
m2-dolphinscheduler:
|
||||
build:
|
||||
context: ./m2/dolphinscheduler
|
||||
dockerfile: Dockerfile
|
||||
image: aixun-datagov/dolphinscheduler:3.4.2-m2-1
|
||||
container_name: aixun-datagov-m2-dolphinscheduler
|
||||
hostname: m2-dolphinscheduler
|
||||
labels: *m2-labels
|
||||
command: ["/bin/bash", "/opt/aixun-datagov/dolphinscheduler-remote-start.sh"]
|
||||
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:32145:12345"
|
||||
- "127.0.0.1:32133:25333"
|
||||
secrets:
|
||||
- source: ds_callback_curl
|
||||
target: /run/secrets/aixun-datagov/m2/ds-callback-curl.conf
|
||||
volumes:
|
||||
- m2-dolphinscheduler-logs:/opt/dolphinscheduler/logs
|
||||
- m2-dolphinscheduler-data:/var/lib/aixun-datagov/dolphinscheduler
|
||||
- ./remote/dolphinscheduler-start.sh:/opt/aixun-datagov/dolphinscheduler-remote-start.sh:ro
|
||||
networks:
|
||||
m2-integration:
|
||||
ipv4_address: 172.29.0.5
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:12345/dolphinscheduler/actuator/health"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 90
|
||||
start_period: 30s
|
||||
restart: unless-stopped
|
||||
|
||||
m2-hive-mysql:
|
||||
image: mysql:8.0.45@sha256:4af1f8815716546f5b12410f7621f37f93db8dd11a184706ef59111930b8c2ff
|
||||
container_name: aixun-datagov-m2-hive-mysql
|
||||
hostname: hive-mysql
|
||||
labels: *m2-labels
|
||||
environment:
|
||||
MYSQL_DATABASE: aixun_m2_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:34106:3306"
|
||||
volumes:
|
||||
- m2-hive-mysql-data:/var/lib/mysql
|
||||
networks:
|
||||
- m2-hive-private
|
||||
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: 60
|
||||
restart: unless-stopped
|
||||
|
||||
m2-hive-minio:
|
||||
image: minio/minio:RELEASE.2025-04-22T22-12-26Z@sha256:a1ea29fa28355559ef137d71fc570e508a214ec84ff8083e39bc5428980b015e
|
||||
container_name: aixun-datagov-m2-hive-minio
|
||||
hostname: hive-minio
|
||||
labels: *m2-labels
|
||||
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:34101:9000"
|
||||
- "127.0.0.1:34102:9001"
|
||||
volumes:
|
||||
- m2-hive-minio-data:/data
|
||||
networks:
|
||||
- m2-hive-private
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:9000/minio/health/live"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 60
|
||||
restart: unless-stopped
|
||||
|
||||
m2-hive-minio-bootstrap:
|
||||
image: minio/mc:RELEASE.2025-04-16T18-13-26Z@sha256:aead63c77f9db9107f1696fb08ecb0faeda23729cde94b0f663edf4fe09728e3
|
||||
container_name: aixun-datagov-m2-hive-minio-bootstrap
|
||||
labels: *m2-labels
|
||||
entrypoint: ["/opt/aixun-m2/minio-bootstrap.sh"]
|
||||
depends_on:
|
||||
m2-hive-minio:
|
||||
condition: service_healthy
|
||||
secrets:
|
||||
- minio_root_user
|
||||
- minio_root_password
|
||||
- hive_s3_access_key
|
||||
- hive_s3_secret_key
|
||||
volumes:
|
||||
- ./m2/hive/minio-bootstrap.sh:/opt/aixun-m2/minio-bootstrap.sh:ro
|
||||
- ./m2/hive/hive-bucket-policy.json:/opt/aixun-m2/hive-bucket-policy.json:ro
|
||||
networks:
|
||||
- m2-hive-private
|
||||
healthcheck:
|
||||
test: ["CMD", "test", "-f", "/tmp/bootstrap-ready"]
|
||||
interval: 3s
|
||||
timeout: 2s
|
||||
retries: 30
|
||||
restart: unless-stopped
|
||||
|
||||
m2-hive-metastore:
|
||||
build:
|
||||
context: ./m2/hive
|
||||
dockerfile: Dockerfile
|
||||
image: aixun-datagov/hive:4.2.0-m2-1
|
||||
container_name: aixun-datagov-m2-hive-metastore
|
||||
hostname: hive-metastore
|
||||
labels: *m2-labels
|
||||
environment:
|
||||
SERVICE_NAME: metastore
|
||||
DB_DRIVER: mysql
|
||||
HIVE_VER: 4.2.0
|
||||
IS_RESUME: "false"
|
||||
secrets: &hive-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_loader_username
|
||||
- hive_auth_loader_password
|
||||
- hive_auth_loader_expiry_epoch
|
||||
- hive_auth_denied_username
|
||||
- hive_auth_denied_password
|
||||
- hive_auth_denied_expiry_epoch
|
||||
ports:
|
||||
- "127.0.0.1:34183:9083"
|
||||
networks:
|
||||
- m2-hive-private
|
||||
- m2-integration
|
||||
depends_on:
|
||||
m2-hive-mysql:
|
||||
condition: service_healthy
|
||||
m2-hive-minio-bootstrap:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "bash -c '</dev/tcp/127.0.0.1/9083'"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 60
|
||||
start_period: 30s
|
||||
restart: unless-stopped
|
||||
|
||||
m2-hive:
|
||||
image: aixun-datagov/hive:4.2.0-m2-1
|
||||
container_name: aixun-datagov-m2-hive
|
||||
hostname: m2-hive
|
||||
labels: *m2-labels
|
||||
environment:
|
||||
SERVICE_NAME: hiveserver2
|
||||
DB_DRIVER: mysql
|
||||
HIVE_VER: 4.2.0
|
||||
IS_RESUME: "true"
|
||||
secrets: *hive-secrets
|
||||
ports:
|
||||
- "127.0.0.1:34100:10000"
|
||||
- "127.0.0.1:34103:10002"
|
||||
networks:
|
||||
- m2-hive-private
|
||||
- m2-integration
|
||||
depends_on:
|
||||
m2-hive-metastore:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "bash -c '</dev/tcp/127.0.0.1/10000'"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 60
|
||||
start_period: 30s
|
||||
restart: unless-stopped
|
||||
|
||||
m2-doris-fe:
|
||||
image: apache/doris:fe-4.0.8@sha256:390413325a93d9121768bda153ccaa3c7a8da4aa0fd2a466406cddc14a6399b2
|
||||
container_name: aixun-datagov-m2-doris-fe
|
||||
hostname: m2-doris-fe
|
||||
labels: *m2-labels
|
||||
environment:
|
||||
FE_SERVERS: fe1:172.27.41.2:9010
|
||||
FE_ID: "1"
|
||||
PREFER_HOST_MODE: ip
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "127.0.0.1:35130:8030"
|
||||
- "127.0.0.1:35190:9030"
|
||||
volumes:
|
||||
- m2-doris-fe-meta:/opt/apache-doris/fe/doris-meta
|
||||
- m2-doris-fe-log:/opt/apache-doris/fe/log
|
||||
networks:
|
||||
m2-doris-private:
|
||||
ipv4_address: 172.27.41.2
|
||||
m2-integration:
|
||||
ipv4_address: 172.29.0.3
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:8030/api/bootstrap >/dev/null"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 120
|
||||
start_period: 30s
|
||||
ulimits:
|
||||
nofile: {soft: 1000000, hard: 1000000}
|
||||
restart: unless-stopped
|
||||
|
||||
m2-doris-be:
|
||||
image: apache/doris:be-4.0.8@sha256:d911ae3826491598be4e383cba83011a266091b8fdc6c34c036280220cc4fea9
|
||||
container_name: aixun-datagov-m2-doris-be
|
||||
hostname: m2-doris-be
|
||||
labels: *m2-labels
|
||||
entrypoint: ["/bin/bash", "/opt/aixun-datagov/start-doris-be.sh"]
|
||||
environment:
|
||||
FE_SERVERS: fe1:172.27.41.2:9010
|
||||
BE_ADDR: 172.27.41.3:9050
|
||||
PREFER_HOST_MODE: ip
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "127.0.0.1:35140:8040"
|
||||
secrets:
|
||||
- doris_root_password
|
||||
volumes:
|
||||
- m2-doris-be-storage:/opt/apache-doris/be/storage
|
||||
- m2-doris-be-log:/opt/apache-doris/be/log
|
||||
- ./m2/doris/start-be.sh:/opt/aixun-datagov/start-doris-be.sh:ro
|
||||
networks:
|
||||
m2-doris-private:
|
||||
ipv4_address: 172.27.41.3
|
||||
depends_on:
|
||||
m2-doris-fe:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:8040/api/health >/dev/null"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 120
|
||||
start_period: 45s
|
||||
ulimits:
|
||||
nofile: {soft: 1000000, hard: 1000000}
|
||||
restart: unless-stopped
|
||||
|
||||
m2-om-mysql:
|
||||
profiles: [legacy-metadata-recovery]
|
||||
image: openmetadata/db:1.13.4@sha256:414f0fbc3fbc9b2de69d291a0ef2f82d0bf6bac67f8aa0bb851aeaa108f7c4f9
|
||||
container_name: aixun-datagov-m2-om-mysql
|
||||
hostname: om-mysql
|
||||
labels: *m2-labels
|
||||
entrypoint: ["/opt/aixun-m2/mysql-wrapper.sh"]
|
||||
command: ["mysqld", "--sort_buffer_size=10M"]
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: /run/secrets/om_mysql_root_password
|
||||
MYSQL_DATABASE: aixun_m2_openmetadata
|
||||
MYSQL_USER: openmetadata_user
|
||||
secrets:
|
||||
- om_mysql_root_password
|
||||
- om_mysql_app_password
|
||||
ports:
|
||||
- "127.0.0.1:33106:3306"
|
||||
volumes:
|
||||
- ./m2/openmetadata/mysql-wrapper.sh:/opt/aixun-m2/mysql-wrapper.sh:ro
|
||||
- m2-om-mysql-data:/var/lib/mysql
|
||||
networks:
|
||||
- m2-om-private
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "/healthcheck.sh"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 60
|
||||
restart: unless-stopped
|
||||
|
||||
m2-om-airflow-mysql:
|
||||
profiles: [legacy-metadata-recovery]
|
||||
image: openmetadata/db:1.13.4@sha256:414f0fbc3fbc9b2de69d291a0ef2f82d0bf6bac67f8aa0bb851aeaa108f7c4f9
|
||||
container_name: aixun-datagov-m2-om-airflow-mysql
|
||||
hostname: om-airflow-mysql
|
||||
labels: *m2-labels
|
||||
entrypoint: ["/opt/aixun-m2/airflow-mysql-wrapper.sh"]
|
||||
command: ["mysqld", "--sort_buffer_size=10M"]
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: /run/secrets/om_airflow_db_password
|
||||
MYSQL_DATABASE: aixun_m2_airflow
|
||||
MYSQL_USER: aixun_m2_airflow
|
||||
secrets:
|
||||
- om_airflow_db_password
|
||||
volumes:
|
||||
- ./m2/openmetadata/airflow-mysql-wrapper.sh:/opt/aixun-m2/airflow-mysql-wrapper.sh:ro
|
||||
- m2-om-airflow-mysql-data:/var/lib/mysql
|
||||
networks:
|
||||
- m2-om-private
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "/healthcheck.sh"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 60
|
||||
restart: unless-stopped
|
||||
|
||||
m2-om-elasticsearch:
|
||||
profiles: [legacy-metadata-recovery]
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:9.3.0@sha256:4f6bdcb742e892539c6ac49b0dd3e4e182e90218546e8c6a22db378c344acb60
|
||||
container_name: aixun-datagov-m2-om-elasticsearch
|
||||
hostname: om-elasticsearch
|
||||
labels: *m2-labels
|
||||
environment:
|
||||
discovery.type: single-node
|
||||
ES_JAVA_OPTS: -Xms1024m -Xmx1024m
|
||||
xpack.security.enabled: "false"
|
||||
ports:
|
||||
- "127.0.0.1:33192:9200"
|
||||
- "127.0.0.1:33193:9300"
|
||||
volumes:
|
||||
- m2-om-elasticsearch-data:/usr/share/elasticsearch/data
|
||||
networks:
|
||||
- m2-om-private
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:9200/_cluster/health | grep -qE '\"status\":\"(green|yellow)\"'"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 60
|
||||
restart: unless-stopped
|
||||
|
||||
m2-om-migrate:
|
||||
profiles: [legacy-metadata-recovery]
|
||||
image: openmetadata/server:1.13.4@sha256:99b48e01b941efb6ace3c742fdf074fb173734739b4c57c50ee4959f49d527f8
|
||||
container_name: aixun-datagov-m2-om-migrate
|
||||
labels: *m2-labels
|
||||
entrypoint: ["/opt/aixun-m2/openmetadata-wrapper.sh"]
|
||||
command: ["./bootstrap/openmetadata-ops.sh", "migrate"]
|
||||
environment:
|
||||
<<: *openmetadata-environment
|
||||
PIPELINE_SERVICE_CLIENT_ENABLED: "false"
|
||||
secrets:
|
||||
- om_mysql_app_password
|
||||
- om_jwt_private
|
||||
- om_jwt_public
|
||||
volumes:
|
||||
- ./m2/openmetadata/openmetadata-wrapper.sh:/opt/aixun-m2/openmetadata-wrapper.sh:ro
|
||||
networks:
|
||||
- m2-om-private
|
||||
depends_on:
|
||||
m2-om-mysql:
|
||||
condition: service_healthy
|
||||
m2-om-elasticsearch:
|
||||
condition: service_healthy
|
||||
restart: "no"
|
||||
|
||||
m2-om-ingestion:
|
||||
profiles: [legacy-metadata-recovery]
|
||||
image: aixun-datagov/m2-om-ingestion@sha256:3e25a862539d5b23ccf5320bce100cd443bd8e0b49feec3176d81e359eef0131
|
||||
container_name: aixun-datagov-m2-om-ingestion
|
||||
hostname: m2-om-ingestion
|
||||
labels: *m2-labels
|
||||
entrypoint: ["/opt/aixun-m2/ingestion-wrapper.sh"]
|
||||
command: ["/opt/airflow/ingestion_dependency.sh"]
|
||||
environment:
|
||||
AIRFLOW__API__AUTH_BACKENDS: airflow.api.auth.backend.basic_auth,airflow.api.auth.backend.session
|
||||
AIRFLOW__CORE__EXECUTOR: LocalExecutor
|
||||
AIRFLOW__CORE__SIMPLE_AUTH_MANAGER_USERS: aixun_m2_airflow_admin:admin
|
||||
AIRFLOW__CORE__SIMPLE_AUTH_MANAGER_ALL_ADMINS: "false"
|
||||
AIRFLOW__OPENMETADATA_AIRFLOW_APIS__DAG_GENERATED_CONFIGS: /opt/airflow/dag_generated_configs
|
||||
DB_HOST: om-airflow-mysql
|
||||
DB_PORT: "3306"
|
||||
AIRFLOW_DB: aixun_m2_airflow
|
||||
DB_SCHEME: mysql+mysqldb
|
||||
DB_USER: aixun_m2_airflow
|
||||
DB_PROPERTIES: ""
|
||||
AIRFLOW_ADMIN_USER: aixun_m2_airflow_admin
|
||||
AIRFLOW__API__BASE_URL: http://m2-om-ingestion:8080
|
||||
AIRFLOW__API__ENABLE_CSRF: "True"
|
||||
secrets:
|
||||
- om_airflow_db_password
|
||||
- om_airflow_admin_password
|
||||
- om_airflow_fernet_key
|
||||
- om_airflow_api_secret_key
|
||||
- om_airflow_jwt_secret
|
||||
expose:
|
||||
- "8080"
|
||||
volumes:
|
||||
- ./m2/openmetadata/ingestion-wrapper.sh:/opt/aixun-m2/ingestion-wrapper.sh:ro
|
||||
- m2-om-ingestion-dag-configs:/opt/airflow/dag_generated_configs
|
||||
- m2-om-ingestion-dags:/opt/airflow/dags
|
||||
- m2-om-ingestion-logs:/opt/airflow/logs
|
||||
- m2-om-ingestion-tmp:/tmp
|
||||
networks:
|
||||
- m2-om-private
|
||||
depends_on:
|
||||
m2-om-airflow-mysql:
|
||||
condition: service_healthy
|
||||
m2-openmetadata:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8080/api/v2/monitor/health"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 90
|
||||
start_period: 60s
|
||||
restart: unless-stopped
|
||||
|
||||
m2-openmetadata:
|
||||
profiles: [legacy-metadata-recovery]
|
||||
image: openmetadata/server:1.13.4@sha256:99b48e01b941efb6ace3c742fdf074fb173734739b4c57c50ee4959f49d527f8
|
||||
container_name: aixun-datagov-m2-openmetadata
|
||||
hostname: m2-openmetadata
|
||||
labels: *m2-labels
|
||||
entrypoint: ["/opt/aixun-m2/openmetadata-wrapper.sh"]
|
||||
command: ["/openmetadata-start.sh"]
|
||||
environment: *openmetadata-environment
|
||||
secrets:
|
||||
- om_mysql_app_password
|
||||
- om_jwt_private
|
||||
- om_jwt_public
|
||||
- om_airflow_admin_password
|
||||
ports:
|
||||
- "127.0.0.1:33185:8585"
|
||||
- "127.0.0.1:33186:8586"
|
||||
volumes:
|
||||
- ./m2/openmetadata/openmetadata-wrapper.sh:/opt/aixun-m2/openmetadata-wrapper.sh:ro
|
||||
networks:
|
||||
- m2-om-private
|
||||
- m2-integration
|
||||
depends_on:
|
||||
m2-om-mysql:
|
||||
condition: service_healthy
|
||||
m2-om-elasticsearch:
|
||||
condition: service_healthy
|
||||
m2-om-migrate:
|
||||
condition: service_completed_successfully
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:8586/healthcheck"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 90
|
||||
start_period: 30s
|
||||
restart: unless-stopped
|
||||
|
||||
secrets:
|
||||
source_mysql_root_password: {file: ./m2/local/secrets/source-mysql-root-password}
|
||||
source_password: {file: ./m2/local/secrets/source-password}
|
||||
seatunnel_username: {file: ./m2/local/secrets/seatunnel-username}
|
||||
seatunnel_password: {file: ./m2/local/secrets/seatunnel-password}
|
||||
ds_callback_curl: {file: ./m2/local/secrets/ds-callback-curl.conf}
|
||||
hive_mysql_root_password: {file: ./m2/local/secrets/hive-mysql-root-password}
|
||||
hive_mysql_password: {file: ./m2/local/secrets/hive-mysql-password}
|
||||
minio_root_user: {file: ./m2/local/secrets/minio-root-user}
|
||||
minio_root_password: {file: ./m2/local/secrets/minio-root-password}
|
||||
hive_s3_access_key: {file: ./m2/local/secrets/hive-s3-access-key}
|
||||
hive_s3_secret_key: {file: ./m2/local/secrets/hive-s3-secret-key}
|
||||
hive_auth_admin_username: {file: ./m2/local/secrets/hive-auth-admin-username}
|
||||
hive_auth_admin_password: {file: ./m2/local/secrets/hive-auth-admin-password}
|
||||
hive_auth_admin_expiry_epoch: {file: ./m2/local/secrets/hive-auth-admin-expiry-epoch}
|
||||
hive_auth_loader_username: {file: ./m2/local/secrets/hive-auth-loader-username}
|
||||
hive_auth_loader_password: {file: ./m2/local/secrets/hive-loader-password}
|
||||
hive_auth_loader_expiry_epoch: {file: ./m2/local/secrets/hive-auth-loader-expiry-epoch}
|
||||
hive_auth_denied_username: {file: ./m2/local/secrets/hive-auth-denied-username}
|
||||
hive_auth_denied_password: {file: ./m2/local/secrets/hive-auth-denied-password}
|
||||
hive_auth_denied_expiry_epoch: {file: ./m2/local/secrets/hive-auth-denied-expiry-epoch}
|
||||
doris_root_password: {file: ./m2/local/secrets/doris-root-password}
|
||||
om_mysql_root_password: {file: ./m2/local/secrets/om-mysql-root-password}
|
||||
om_mysql_app_password: {file: ./m2/local/secrets/om-mysql-app-password}
|
||||
om_jwt_private: {file: ./m2/local/secrets/om-jwt-private.der}
|
||||
om_jwt_public: {file: ./m2/local/secrets/om-jwt-public.der}
|
||||
om_airflow_db_password: {file: ./m2/local/secrets/om-airflow-db-password}
|
||||
om_airflow_admin_password: {file: ./m2/local/secrets/om-airflow-admin-password}
|
||||
om_airflow_fernet_key: {file: ./m2/local/secrets/om-airflow-fernet-key}
|
||||
om_airflow_api_secret_key: {file: ./m2/local/secrets/om-airflow-api-secret-key}
|
||||
om_airflow_jwt_secret: {file: ./m2/local/secrets/om-airflow-jwt-secret}
|
||||
|
||||
networks:
|
||||
m2-integration:
|
||||
name: aixun-datagov-local-m2-integration
|
||||
labels: *m2-labels
|
||||
m2-hive-private:
|
||||
name: aixun-datagov-local-m2-hive-private
|
||||
labels: *m2-labels
|
||||
m2-doris-private:
|
||||
name: aixun-datagov-local-m2-doris-private
|
||||
labels: *m2-labels
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.27.41.0/24
|
||||
m2-om-private:
|
||||
name: aixun-datagov-local-m2-om-private
|
||||
labels: *m2-labels
|
||||
|
||||
volumes:
|
||||
m2-source-mysql-data: {name: aixun-datagov-local-m2-source-mysql-data, labels: *m2-labels}
|
||||
m2-seatunnel-checkpoints: {name: aixun-datagov-local-m2-seatunnel-checkpoints, labels: *m2-labels}
|
||||
m2-dolphinscheduler-logs: {name: aixun-datagov-local-m2-dolphinscheduler-logs, labels: *m2-labels}
|
||||
m2-dolphinscheduler-data: {name: aixun-datagov-local-m2-dolphinscheduler-data, labels: *m2-labels}
|
||||
m2-hive-mysql-data: {name: aixun-datagov-local-m2-hive-mysql-data, labels: *m2-labels}
|
||||
m2-hive-minio-data: {name: aixun-datagov-local-m2-hive-minio-data, labels: *m2-labels}
|
||||
m2-doris-fe-meta: {name: aixun-datagov-local-m2-doris-fe-meta, labels: *m2-labels}
|
||||
m2-doris-fe-log: {name: aixun-datagov-local-m2-doris-fe-log, labels: *m2-labels}
|
||||
m2-doris-be-storage: {name: aixun-datagov-local-m2-doris-be-storage, labels: *m2-labels}
|
||||
m2-doris-be-log: {name: aixun-datagov-local-m2-doris-be-log, labels: *m2-labels}
|
||||
m2-om-mysql-data: {name: aixun-datagov-local-m2-om-mysql-data, labels: *m2-labels}
|
||||
m2-om-elasticsearch-data: {name: aixun-datagov-local-m2-om-elasticsearch-data, labels: *m2-labels}
|
||||
m2-om-airflow-mysql-data: {name: aixun-datagov-local-m2-om-airflow-mysql-data, labels: *m2-labels}
|
||||
m2-om-ingestion-dag-configs: {name: aixun-datagov-local-m2-om-ingestion-dag-configs, labels: *m2-labels}
|
||||
m2-om-ingestion-dags: {name: aixun-datagov-local-m2-om-ingestion-dags, labels: *m2-labels}
|
||||
m2-om-ingestion-logs: {name: aixun-datagov-local-m2-om-ingestion-logs, labels: *m2-labels}
|
||||
m2-om-ingestion-tmp: {name: aixun-datagov-local-m2-om-ingestion-tmp, labels: *m2-labels}
|
||||
@@ -0,0 +1,4 @@
|
||||
FROM aixun-datagov/poc-dolphinscheduler:3.4.2-pstree-1
|
||||
LABEL com.aixun.component="dolphinscheduler" \
|
||||
com.aixun.version="3.4.2" \
|
||||
com.aixun.milestone="M2"
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
set +x
|
||||
|
||||
readonly SECRET_FILE=/run/secrets/doris_root_password
|
||||
readonly CLIENT_CONFIG=/root/.my.cnf
|
||||
|
||||
[[ -r "${SECRET_FILE}" ]] || {
|
||||
echo 'Doris BE readiness secretRef is unavailable' >&2
|
||||
exit 70
|
||||
}
|
||||
|
||||
root_password="$(<"${SECRET_FILE}")"
|
||||
[[ -n "${root_password}" && "${root_password}" != *$'\n'* && "${root_password}" != *$'\r'* ]] || {
|
||||
echo 'Doris BE readiness secretRef is invalid' >&2
|
||||
exit 71
|
||||
}
|
||||
|
||||
umask 077
|
||||
printf '[client]\nuser=root\npassword=%s\n' "${root_password}" >"${CLIENT_CONFIG}"
|
||||
chmod 0600 "${CLIENT_CONFIG}"
|
||||
unset root_password
|
||||
|
||||
exec /bin/bash /usr/local/bin/entry_point.sh
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly ARTIFACT_DIR="${SCRIPT_DIR}/seatunnel/local/artifacts"
|
||||
mkdir -p "${ARTIFACT_DIR}"
|
||||
chmod 0700 "${SCRIPT_DIR}/seatunnel/local" "${ARTIFACT_DIR}"
|
||||
|
||||
fetch() {
|
||||
local target="$1"
|
||||
local sha256="$2"
|
||||
local url="$3"
|
||||
if [[ ! -s "${target}" ]]; then
|
||||
curl -fsSL --retry 3 --output "${target}" "${url}"
|
||||
fi
|
||||
actual="$(shasum -a 256 "${target}" | awk '{print $1}')"
|
||||
[[ "${actual}" == "${sha256}" ]] || { echo "artifact checksum mismatch: $(basename "${target}")" >&2; exit 1; }
|
||||
}
|
||||
|
||||
fetch "${ARTIFACT_DIR}/connector-jdbc-2.3.13.jar" \
|
||||
d6be827cc6a529791f985a114fa65f032dde229b2c4b4f0b6ad1ae9328770d2e \
|
||||
https://repo1.maven.org/maven2/org/apache/seatunnel/connector-jdbc/2.3.13/connector-jdbc-2.3.13.jar
|
||||
fetch "${ARTIFACT_DIR}/connector-http-base-2.3.13.jar" \
|
||||
3ed4a53bfff002a96bbf437bae02b03579b7e2c10c1be953bea7b8968d494a5e \
|
||||
https://repo1.maven.org/maven2/org/apache/seatunnel/connector-http-base/2.3.13/connector-http-base-2.3.13.jar
|
||||
fetch "${ARTIFACT_DIR}/connector-file-local-2.3.13.jar" \
|
||||
cb3b5f403bfdb33cb381716accf823b0dd50621f46325d8704d987ee2c95b3da \
|
||||
https://repo1.maven.org/maven2/org/apache/seatunnel/connector-file-local/2.3.13/connector-file-local-2.3.13.jar
|
||||
fetch "${ARTIFACT_DIR}/connector-hive-2.3.13.jar" \
|
||||
ced310834082e0d05cb32ed8f29ed887ea4fb46617aceffdd01e5d87451125fe \
|
||||
https://repo.maven.apache.org/maven2/org/apache/seatunnel/connector-hive/2.3.13/connector-hive-2.3.13.jar
|
||||
fetch "${ARTIFACT_DIR}/mysql-connector-j-9.5.0.jar" \
|
||||
f2ca3dfaf00d4aa311470db7ea3051962944ba0cb60005a2f75467549c39f425 \
|
||||
https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/9.5.0/mysql-connector-j-9.5.0.jar
|
||||
fetch "${ARTIFACT_DIR}/postgresql-42.7.13.jar" \
|
||||
6e0e4cc2d8cae902084f8a2b18728b073a6fd9d1f87c9d8bff8f298c18185b93 \
|
||||
https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.13/postgresql-42.7.13.jar
|
||||
fetch "${ARTIFACT_DIR}/mariadb-java-client-3.5.10.jar" \
|
||||
919b8c1c771d9ee3465811462f242c9543ab401e140c64988ddbf1d8abcb18b2 \
|
||||
https://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/3.5.10/mariadb-java-client-3.5.10.jar
|
||||
fetch "${ARTIFACT_DIR}/hive-jdbc-4.2.0-standalone.jar" \
|
||||
c89c6224df9d465ddf96060bc3e289522f1f6e64b01a28e01f94413edeb3d43a \
|
||||
https://repo1.maven.org/maven2/org/apache/hive/hive-jdbc/4.2.0/hive-jdbc-4.2.0-standalone.jar
|
||||
fetch "${ARTIFACT_DIR}/hive-exec-3.1.3.jar" \
|
||||
de86f70a73d05070c01f902ed1293b5dfbc4c0fb4d2232d9e218dc7d13ff8d6a \
|
||||
https://repo.maven.apache.org/maven2/org/apache/hive/hive-exec/3.1.3/hive-exec-3.1.3.jar
|
||||
fetch "${ARTIFACT_DIR}/libfb303-0.9.3.jar" \
|
||||
23fc397a42181b17bb7d0fada2213735ed8db38cfbf038d12b9c00ea7419e11b \
|
||||
https://repo.maven.apache.org/maven2/org/apache/thrift/libfb303/0.9.3/libfb303-0.9.3.jar
|
||||
fetch "${ARTIFACT_DIR}/DmJdbcDriver18-8.1.3.62.jar" \
|
||||
327bade775f4f15b97618bc9736a4625def52701cf53f5ef5ad72580797e6e45 \
|
||||
https://repo.maven.apache.org/maven2/com/dameng/DmJdbcDriver18/8.1.3.62/DmJdbcDriver18-8.1.3.62.jar
|
||||
fetch "${ARTIFACT_DIR}/mssql-jdbc-13.4.0.jre11.jar" \
|
||||
e36f5237c1267983e5b88dc2169f6b9d7e50eceec6dc1ca31018e3877e14af66 \
|
||||
https://repo.maven.apache.org/maven2/com/microsoft/sqlserver/mssql-jdbc/13.4.0.jre11/mssql-jdbc-13.4.0.jre11.jar
|
||||
|
||||
fetch "${ARTIFACT_DIR}/ojdbc11-23.26.2.0.0.jar" \
|
||||
dbc0ff940bc056d5d9b8f42c0946ded4ebbc08c25cecf6ec1e521b2c8216956b \
|
||||
https://repo.maven.apache.org/maven2/com/oracle/database/jdbc/ojdbc11/23.26.2.0.0/ojdbc11-23.26.2.0.0.jar
|
||||
|
||||
fetch "${ARTIFACT_DIR}/kingbase8-9.0.1.jre7.jar" \
|
||||
fea8c73c69b593910c11675e3bc76e8b120678c00e33966650d7e130cf748199 \
|
||||
https://repo.maven.apache.org/maven2/cn/com/kingbase/kingbase8/9.0.1.jre7/kingbase8-9.0.1.jre7.jar
|
||||
|
||||
echo 'PASS: DataGov SeaTunnel connector artifacts match reviewed SHA-256 values.'
|
||||
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly LOCAL_DIR="${SCRIPT_DIR}/local"
|
||||
readonly SECRET_DIR="${LOCAL_DIR}/secrets"
|
||||
mkdir -p "${SECRET_DIR}" "${SCRIPT_DIR}/seatunnel/local/artifacts"
|
||||
chmod 0700 "${LOCAL_DIR}" "${SECRET_DIR}" "${SCRIPT_DIR}/seatunnel/local" "${SCRIPT_DIR}/seatunnel/local/artifacts"
|
||||
umask 077
|
||||
|
||||
random_hex() {
|
||||
openssl rand -hex "${1:-24}"
|
||||
}
|
||||
|
||||
write_if_missing() {
|
||||
local target="$1"
|
||||
local value="$2"
|
||||
if [[ ! -s "${target}" ]]; then
|
||||
printf '%s' "${value}" >"${target}"
|
||||
fi
|
||||
chmod 0600 "${target}"
|
||||
}
|
||||
|
||||
write_dolphinscheduler_password() {
|
||||
local target="$1"
|
||||
if [[ ! -s "${target}" || "$(wc -c <"${target}" | tr -d ' ')" -gt 20 ]]; then
|
||||
printf 'Aa1!%s' "$(random_hex 8)" >"${target}"
|
||||
fi
|
||||
chmod 0600 "${target}"
|
||||
}
|
||||
|
||||
write_if_missing "${SECRET_DIR}/source-mysql-root-password" "$(random_hex 24)"
|
||||
write_if_missing "${SECRET_DIR}/source-password" "$(random_hex 24)"
|
||||
write_if_missing "${SECRET_DIR}/seatunnel-username" "aixun_m2_seatunnel"
|
||||
write_if_missing "${SECRET_DIR}/seatunnel-password" "$(random_hex 24)"
|
||||
write_if_missing "${SECRET_DIR}/callback-token" "$(random_hex 32)"
|
||||
write_dolphinscheduler_password "${SECRET_DIR}/dolphinscheduler-admin-password"
|
||||
write_dolphinscheduler_password "${SECRET_DIR}/dolphinscheduler-service-password"
|
||||
write_if_missing "${SECRET_DIR}/dolphinscheduler-token" "$(random_hex 32)"
|
||||
|
||||
write_if_missing "${SECRET_DIR}/hive-mysql-root-password" "$(random_hex 24)"
|
||||
write_if_missing "${SECRET_DIR}/hive-mysql-password" "$(random_hex 24)"
|
||||
write_if_missing "${SECRET_DIR}/minio-root-user" "aixun_m2_minio_root"
|
||||
write_if_missing "${SECRET_DIR}/minio-root-password" "$(random_hex 24)"
|
||||
write_if_missing "${SECRET_DIR}/hive-s3-access-key" "aixunm2hiveaccess"
|
||||
write_if_missing "${SECRET_DIR}/hive-s3-secret-key" "$(random_hex 24)"
|
||||
expiry_epoch="$(( $(date +%s) + 31536000 ))"
|
||||
for principal in admin loader denied; do
|
||||
write_if_missing "${SECRET_DIR}/hive-auth-${principal}-expiry-epoch" "${expiry_epoch}"
|
||||
done
|
||||
write_if_missing "${SECRET_DIR}/hive-auth-admin-username" "aixun_m2_hive_admin"
|
||||
write_if_missing "${SECRET_DIR}/hive-auth-admin-password" "Aa1!$(random_hex 12)"
|
||||
write_if_missing "${SECRET_DIR}/hive-auth-loader-username" "aixun_m2_hive_loader"
|
||||
write_if_missing "${SECRET_DIR}/hive-loader-password" "Aa1!$(random_hex 12)"
|
||||
write_if_missing "${SECRET_DIR}/hive-auth-denied-username" "aixun_m2_hive_denied"
|
||||
write_if_missing "${SECRET_DIR}/hive-auth-denied-password" "Aa1!$(random_hex 12)"
|
||||
|
||||
write_if_missing "${SECRET_DIR}/doris-root-password" "Aa1!$(random_hex 12)"
|
||||
write_if_missing "${SECRET_DIR}/doris-loader-password" "Aa1!$(random_hex 12)"
|
||||
write_if_missing "${SECRET_DIR}/doris-query-password" "Aa1!$(random_hex 12)"
|
||||
write_if_missing "${SECRET_DIR}/doris-denied-password" "Aa1!$(random_hex 12)"
|
||||
|
||||
write_if_missing "${SECRET_DIR}/om-mysql-root-password" "$(random_hex 24)"
|
||||
write_if_missing "${SECRET_DIR}/om-mysql-app-password" "$(random_hex 24)"
|
||||
write_if_missing "${SECRET_DIR}/om-admin-password" "Aa1!$(random_hex 12)"
|
||||
write_if_missing "${SECRET_DIR}/om-service-password" "Aa1!$(random_hex 12)"
|
||||
write_if_missing "${SECRET_DIR}/openmetadata-token" "$(random_hex 32)"
|
||||
write_if_missing "${SECRET_DIR}/om-airflow-db-password" "$(random_hex 24)"
|
||||
write_if_missing "${SECRET_DIR}/om-airflow-admin-password" "Aa1!$(random_hex 12)"
|
||||
write_if_missing "${SECRET_DIR}/om-airflow-fernet-key" "$(openssl rand -base64 32 | tr '+/' '-_' | tr -d '\n')"
|
||||
write_if_missing "${SECRET_DIR}/om-airflow-api-secret-key" "$(random_hex 32)"
|
||||
write_if_missing "${SECRET_DIR}/om-airflow-jwt-secret" "$(random_hex 32)"
|
||||
|
||||
if [[ ! -s "${SECRET_DIR}/om-jwt-private.der" || ! -s "${SECRET_DIR}/om-jwt-public.der" ]]; then
|
||||
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 2>/dev/null \
|
||||
| openssl pkcs8 -topk8 -nocrypt -outform DER -out "${SECRET_DIR}/om-jwt-private.der"
|
||||
openssl pkey -inform DER -in "${SECRET_DIR}/om-jwt-private.der" -pubout -outform DER \
|
||||
-out "${SECRET_DIR}/om-jwt-public.der"
|
||||
fi
|
||||
chmod 0600 "${SECRET_DIR}/om-jwt-private.der" "${SECRET_DIR}/om-jwt-public.der"
|
||||
|
||||
printf 'silent\nshow-error\nheader = "X-Aixun-Callback-Token: %s"\n' \
|
||||
"$(<"${SECRET_DIR}/callback-token")" >"${SECRET_DIR}/ds-callback-curl.conf"
|
||||
chmod 0600 "${SECRET_DIR}/ds-callback-curl.conf"
|
||||
|
||||
echo 'PASS: M2 formal secretRefs generated as ignored mode-0600 files; values were not printed.'
|
||||
@@ -0,0 +1,14 @@
|
||||
FROM aixun-datagov/poc-hive:4.2.0-authz-1
|
||||
|
||||
USER root
|
||||
COPY --chmod=0555 start-hive.sh /opt/aixun-m2/start-hive.sh
|
||||
COPY --chmod=0555 hive-entrypoint.sh /opt/aixun-m2/hive-entrypoint.sh
|
||||
COPY HiveSecretAuthenticator.java /tmp/HiveSecretAuthenticator.java
|
||||
RUN rm -f /opt/hive/lib/aixun-datagov-hive-auth-poc.jar && \
|
||||
install -d /tmp/hive-auth-classes /opt/aixun-m2 && \
|
||||
javac -cp '/opt/hive/lib/*' -d /tmp/hive-auth-classes /tmp/HiveSecretAuthenticator.java && \
|
||||
jar --create --file /opt/hive/lib/aixun-datagov-hive-auth-m2.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-m2.jar
|
||||
USER hive
|
||||
ENTRYPOINT ["/opt/aixun-m2/start-hive.sh"]
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.aixunkeji.datagov.m2;
|
||||
|
||||
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;
|
||||
|
||||
/** M2-only HiveServer2 authenticator backed by read-only formal secretRefs. */
|
||||
public final class HiveSecretAuthenticator implements PasswdAuthenticationProvider {
|
||||
private static final Path SECRET_ROOT = Path.of("/run/secrets");
|
||||
private static final String[] PRINCIPALS = {"admin", "loader", "denied"};
|
||||
|
||||
@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"));
|
||||
if (MessageDigest.isEqual(expectedUser.getBytes(StandardCharsets.UTF_8), user.getBytes(StandardCharsets.UTF_8)) &&
|
||||
MessageDigest.isEqual(expectedPassword.getBytes(StandardCharsets.UTF_8), password.getBytes(StandardCharsets.UTF_8)) &&
|
||||
System.currentTimeMillis() / 1000L < expiresAt) {
|
||||
return;
|
||||
}
|
||||
} catch (IOException | NumberFormatException exception) {
|
||||
throw new AuthenticationException("Hive M2 authentication backend unavailable");
|
||||
}
|
||||
}
|
||||
throw new AuthenticationException("Invalid or expired Hive M2 credential");
|
||||
}
|
||||
|
||||
private static String read(String name) throws IOException {
|
||||
return Files.readString(SECRET_ROOT.resolve(name), StandardCharsets.UTF_8).trim();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:ListBucket", "s3:GetBucketLocation"],
|
||||
"Resource": ["arn:aws:s3:::aixun-datagov-m2-hive"]
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"],
|
||||
"Resource": ["arn:aws:s3:::aixun-datagov-m2-hive/*"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
: "${DB_DRIVER:=derby}"
|
||||
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 [[ "${IS_RESUME:-false}" == "false" ]]; then
|
||||
"${HIVE_HOME}/bin/schematool" -dbType "${DB_DRIVER}" -initOrUpgradeSchema
|
||||
fi
|
||||
if [[ "${SERVICE_NAME:-}" == "hiveserver2" ]]; then
|
||||
export HADOOP_CLASSPATH="${TEZ_HOME}/*:${TEZ_HOME}/lib/*:${HADOOP_CLASSPATH:-}"
|
||||
exec "${HIVE_HOME}/bin/hive" --skiphadoopversion --skiphbasecp --service hiveserver2
|
||||
fi
|
||||
if [[ "${SERVICE_NAME:-}" == "metastore" ]]; then
|
||||
export METASTORE_PORT="${METASTORE_PORT:-9083}"
|
||||
exec "${HIVE_HOME}/bin/hive" --skiphadoopversion --skiphbasecp --service metastore
|
||||
fi
|
||||
echo 'unsupported Hive service' >&2
|
||||
exit 64
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
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 m2 http://hive-minio:9000 "$root_user" "$root_password" >/dev/null 2>&1
|
||||
mc mb --ignore-existing m2/aixun-datagov-m2-hive >/dev/null 2>&1
|
||||
mc admin policy create m2 aixun-datagov-m2-hive-rw /opt/aixun-m2/hive-bucket-policy.json >/dev/null 2>&1 || \
|
||||
mc admin policy info m2 aixun-datagov-m2-hive-rw >/dev/null 2>&1
|
||||
mc admin user add m2 "$hive_access_key" "$hive_secret_key" >/dev/null 2>&1
|
||||
mc admin policy attach m2 aixun-datagov-m2-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
|
||||
exec tail -f /dev/null
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
required=(
|
||||
/run/secrets/hive_mysql_password
|
||||
/run/secrets/hive_s3_access_key
|
||||
/run/secrets/hive_s3_secret_key
|
||||
)
|
||||
for principal in admin loader denied; do
|
||||
required+=(
|
||||
"/run/secrets/hive_auth_${principal}_username"
|
||||
"/run/secrets/hive_auth_${principal}_password"
|
||||
"/run/secrets/hive_auth_${principal}_expiry_epoch"
|
||||
)
|
||||
done
|
||||
for secret_file in "${required[@]}"; do
|
||||
[[ -r "${secret_file}" ]] || { echo 'required secretRef is unavailable' >&2; exit 70; }
|
||||
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-m2-hive-conf
|
||||
install -d -m 0700 "${runtime_conf}"
|
||||
|
||||
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://hive-mysql:3306/aixun_m2_hive_metastore?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-m2-hive/warehouse</value></property>
|
||||
<property><name>hive.metastore.uris</name><value>thrift://hive-metastore:9083</value></property>
|
||||
<property><name>fs.defaultFS</name><value>s3a://aixun-datagov-m2-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://hive-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>
|
||||
<property><name>hive.server2.authentication</name><value>CUSTOM</value></property>
|
||||
<property><name>hive.server2.custom.authentication.class</name><value>cn.aixunkeji.datagov.m2.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>aixun_m2_hive_admin</value></property>
|
||||
</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 /opt/aixun-m2/hive-entrypoint.sh
|
||||
@@ -0,0 +1,21 @@
|
||||
# DataGov-only derivative of the frozen OpenMetadata 1.13.4 ingestion image.
|
||||
# The named build context `wheel` is supplied from a separately SHA-verified
|
||||
# offline artifact directory; no dependency resolver or network install runs.
|
||||
FROM hub.1panel.dev/openmetadata/ingestion@sha256:7fbd5f78de4a3ff7b3ade8bfd928348e1786a296e178b02e3c985243d00d71f5
|
||||
|
||||
USER root
|
||||
|
||||
COPY --from=wheel /pydoris-1.2.0-py3-none-any.whl /tmp/pydoris-1.2.0-py3-none-any.whl
|
||||
COPY script/datagov/m2/openmetadata/pydoris-1.2.0.lock /tmp/pydoris-1.2.0.lock
|
||||
|
||||
RUN set -eux; \
|
||||
cd /tmp; \
|
||||
sha256sum -c /tmp/pydoris-1.2.0.lock; \
|
||||
python -m pip install --no-cache-dir --no-deps --no-index \
|
||||
--target /home/airflow/.local/lib/python3.12/site-packages \
|
||||
/tmp/pydoris-1.2.0-py3-none-any.whl; \
|
||||
chown -R airflow:0 /home/airflow/.local/lib/python3.12/site-packages/pydoris \
|
||||
/home/airflow/.local/lib/python3.12/site-packages/pydoris-1.2.0.dist-info; \
|
||||
rm -f /tmp/pydoris-1.2.0.lock /tmp/pydoris-1.2.0-py3-none-any.whl
|
||||
|
||||
USER airflow
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
umask 077
|
||||
export MYSQL_PASSWORD="$(< /run/secrets/om_airflow_db_password)"
|
||||
exec /entrypoint.sh "$@"
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
umask 077
|
||||
|
||||
export DB_PASSWORD="$(< /run/secrets/om_airflow_db_password)"
|
||||
export AIRFLOW_ADMIN_PASSWORD="$(< /run/secrets/om_airflow_admin_password)"
|
||||
export AIRFLOW__CORE__FERNET_KEY="$(< /run/secrets/om_airflow_fernet_key)"
|
||||
export AIRFLOW__API__SECRET_KEY="$(< /run/secrets/om_airflow_api_secret_key)"
|
||||
export AIRFLOW__API_AUTH__JWT_SECRET="$(< /run/secrets/om_airflow_jwt_secret)"
|
||||
|
||||
exec /bin/bash "$@"
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
export MYSQL_PASSWORD="$(< /run/secrets/om_mysql_app_password)"
|
||||
exec /entrypoint.sh "$@"
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
export DB_USER_PASSWORD="$(< /run/secrets/om_mysql_app_password)"
|
||||
if [[ -r /run/secrets/om_airflow_admin_password ]]; then
|
||||
export AIRFLOW_PASSWORD="$(< /run/secrets/om_airflow_admin_password)"
|
||||
fi
|
||||
exec "$@"
|
||||
@@ -0,0 +1 @@
|
||||
60fb41960477231089fe2f25bf56611448b8e028e547ea3a45f413733ac3fd56 pydoris-1.2.0-py3-none-any.whl
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
|
||||
readonly MAIN_COMPOSE="${PROJECT_ROOT}/script/datagov/docker-compose.local.yml"
|
||||
readonly M2_COMPOSE="${SCRIPT_DIR}/docker-compose.yml"
|
||||
readonly ENV_FILE="${AIXUN_DATAGOV_ENV_FILE:-${PROJECT_ROOT}/script/datagov/.env.datagov}"
|
||||
readonly SECRET_DIR="${SCRIPT_DIR}/local/secrets"
|
||||
readonly POSTGRESQL_DRIVER="${SCRIPT_DIR}/seatunnel/local/artifacts/postgresql-42.7.13.jar"
|
||||
readonly MARIADB_DRIVER="${SCRIPT_DIR}/seatunnel/local/artifacts/mariadb-java-client-3.5.10.jar"
|
||||
readonly HIVE_DRIVER="${SCRIPT_DIR}/seatunnel/local/artifacts/hive-jdbc-4.2.0-standalone.jar"
|
||||
readonly HIVE_CONNECTOR="${SCRIPT_DIR}/seatunnel/local/artifacts/connector-hive-2.3.13.jar"
|
||||
readonly HIVE_EXEC="${SCRIPT_DIR}/seatunnel/local/artifacts/hive-exec-3.1.3.jar"
|
||||
readonly HIVE_FB303="${SCRIPT_DIR}/seatunnel/local/artifacts/libfb303-0.9.3.jar"
|
||||
readonly DAMENG_DRIVER="${SCRIPT_DIR}/seatunnel/local/artifacts/DmJdbcDriver18-8.1.3.62.jar"
|
||||
readonly SQLSERVER_DRIVER="${SCRIPT_DIR}/seatunnel/local/artifacts/mssql-jdbc-13.4.0.jre11.jar"
|
||||
readonly ORACLE_DRIVER="${SCRIPT_DIR}/seatunnel/local/artifacts/ojdbc11-23.26.2.0.0.jar"
|
||||
readonly KINGBASE_DRIVER="${SCRIPT_DIR}/seatunnel/local/artifacts/kingbase8-9.0.1.jre7.jar"
|
||||
|
||||
fail() { echo "M2 preflight failed: $*" >&2; exit 1; }
|
||||
|
||||
"${PROJECT_ROOT}/script/datagov/preflight.sh"
|
||||
[[ -f "${M2_COMPOSE}" ]] || fail "formal M2 Compose file is missing"
|
||||
[[ -d "${SECRET_DIR}" ]] || fail "run generate-local-secrets.sh first"
|
||||
|
||||
required_secrets=(
|
||||
source-password source-mysql-root-password seatunnel-username seatunnel-password callback-token
|
||||
dolphinscheduler-admin-password dolphinscheduler-service-password dolphinscheduler-token ds-callback-curl.conf
|
||||
hive-mysql-root-password hive-mysql-password minio-root-user minio-root-password
|
||||
hive-s3-access-key hive-s3-secret-key hive-loader-password doris-root-password
|
||||
doris-loader-password doris-query-password doris-denied-password
|
||||
)
|
||||
for secret_name in "${required_secrets[@]}"; do
|
||||
secret_path="${SECRET_DIR}/${secret_name}"
|
||||
[[ -s "${secret_path}" ]] || fail "required M2 secretRef file is missing: ${secret_name}"
|
||||
[[ "$(stat -f '%Lp' "${secret_path}")" == "600" ]] || fail "M2 secretRef file must be mode 0600: ${secret_name}"
|
||||
done
|
||||
|
||||
[[ -s "${POSTGRESQL_DRIVER}" ]] || fail "fixed PostgreSQL JDBC driver is missing"
|
||||
postgresql_driver_sha="$(shasum -a 256 "${POSTGRESQL_DRIVER}" | awk '{print $1}')"
|
||||
[[ "${postgresql_driver_sha}" == "6e0e4cc2d8cae902084f8a2b18728b073a6fd9d1f87c9d8bff8f298c18185b93" ]] ||
|
||||
fail "fixed PostgreSQL JDBC driver checksum mismatch"
|
||||
unset postgresql_driver_sha
|
||||
|
||||
[[ -s "${MARIADB_DRIVER}" ]] || fail "fixed MariaDB JDBC driver is missing"
|
||||
mariadb_driver_sha="$(shasum -a 256 "${MARIADB_DRIVER}" | awk '{print $1}')"
|
||||
[[ "${mariadb_driver_sha}" == "919b8c1c771d9ee3465811462f242c9543ab401e140c64988ddbf1d8abcb18b2" ]] ||
|
||||
fail "fixed MariaDB JDBC driver checksum mismatch"
|
||||
unset mariadb_driver_sha
|
||||
|
||||
[[ -s "${HIVE_DRIVER}" ]] || fail "fixed Hive JDBC driver is missing"
|
||||
hive_driver_sha="$(shasum -a 256 "${HIVE_DRIVER}" | awk '{print $1}')"
|
||||
[[ "${hive_driver_sha}" == "c89c6224df9d465ddf96060bc3e289522f1f6e64b01a28e01f94413edeb3d43a" ]] ||
|
||||
fail "fixed Hive JDBC driver checksum mismatch"
|
||||
unset hive_driver_sha
|
||||
|
||||
[[ -s "${HIVE_CONNECTOR}" ]] || fail "fixed SeaTunnel Hive connector is missing"
|
||||
hive_connector_sha="$(shasum -a 256 "${HIVE_CONNECTOR}" | awk '{print $1}')"
|
||||
[[ "${hive_connector_sha}" == "ced310834082e0d05cb32ed8f29ed887ea4fb46617aceffdd01e5d87451125fe" ]] ||
|
||||
fail "fixed SeaTunnel Hive connector checksum mismatch"
|
||||
unset hive_connector_sha
|
||||
|
||||
[[ -s "${HIVE_EXEC}" ]] || fail "fixed Hive execution dependency is missing"
|
||||
hive_exec_sha="$(shasum -a 256 "${HIVE_EXEC}" | awk '{print $1}')"
|
||||
[[ "${hive_exec_sha}" == "de86f70a73d05070c01f902ed1293b5dfbc4c0fb4d2232d9e218dc7d13ff8d6a" ]] ||
|
||||
fail "fixed Hive execution dependency checksum mismatch"
|
||||
unset hive_exec_sha
|
||||
|
||||
[[ -s "${HIVE_FB303}" ]] || fail "fixed Hive fb303 dependency is missing"
|
||||
hive_fb303_sha="$(shasum -a 256 "${HIVE_FB303}" | awk '{print $1}')"
|
||||
[[ "${hive_fb303_sha}" == "23fc397a42181b17bb7d0fada2213735ed8db38cfbf038d12b9c00ea7419e11b" ]] ||
|
||||
fail "fixed Hive fb303 dependency checksum mismatch"
|
||||
unset hive_fb303_sha
|
||||
|
||||
[[ -s "${DAMENG_DRIVER}" ]] || fail "fixed Dameng JDBC driver is missing"
|
||||
dameng_driver_sha="$(shasum -a 256 "${DAMENG_DRIVER}" | awk '{print $1}')"
|
||||
[[ "${dameng_driver_sha}" == "327bade775f4f15b97618bc9736a4625def52701cf53f5ef5ad72580797e6e45" ]] ||
|
||||
fail "fixed Dameng JDBC driver checksum mismatch"
|
||||
unset dameng_driver_sha
|
||||
|
||||
[[ -s "${SQLSERVER_DRIVER}" ]] || fail "fixed SQL Server JDBC driver is missing"
|
||||
sqlserver_driver_sha="$(shasum -a 256 "${SQLSERVER_DRIVER}" | awk '{print $1}')"
|
||||
[[ "${sqlserver_driver_sha}" == "e36f5237c1267983e5b88dc2169f6b9d7e50eceec6dc1ca31018e3877e14af66" ]] ||
|
||||
fail "fixed SQL Server JDBC driver checksum mismatch"
|
||||
unset sqlserver_driver_sha
|
||||
|
||||
[[ -s "${ORACLE_DRIVER}" ]] || fail "fixed Oracle JDBC driver is missing"
|
||||
oracle_driver_sha="$(shasum -a 256 "${ORACLE_DRIVER}" | awk '{print $1}')"
|
||||
[[ "${oracle_driver_sha}" == "dbc0ff940bc056d5d9b8f42c0946ded4ebbc08c25cecf6ec1e521b2c8216956b" ]] ||
|
||||
fail "fixed Oracle JDBC driver checksum mismatch"
|
||||
unset oracle_driver_sha
|
||||
|
||||
[[ -s "${KINGBASE_DRIVER}" ]] || fail "fixed Kingbase JDBC driver is missing"
|
||||
kingbase_driver_sha="$(shasum -a 256 "${KINGBASE_DRIVER}" | awk '{print $1}')"
|
||||
[[ "${kingbase_driver_sha}" == "fea8c73c69b593910c11675e3bc76e8b120678c00e33966650d7e130cf748199" ]] ||
|
||||
fail "fixed Kingbase JDBC driver checksum mismatch"
|
||||
unset kingbase_driver_sha
|
||||
|
||||
verify_local_image() {
|
||||
local reference="$1"
|
||||
local expected_id="$2"
|
||||
actual_id="$(docker image inspect "${reference}" --format '{{.Id}}' 2>/dev/null)" ||
|
||||
fail "reviewed local base image is unavailable: ${reference}"
|
||||
[[ "${actual_id}" == "${expected_id}" ]] || fail "local base image identity drifted: ${reference}"
|
||||
}
|
||||
verify_local_image aixun-datagov/poc-seatunnel:2.3.13-auth-1 sha256:ec839b31e01edd950a52e4fe4bcc11f953e3dd304c11925feb65c7920b5df4a1
|
||||
verify_local_image aixun-datagov/poc-dolphinscheduler:3.4.2-pstree-1 sha256:3d5cc12b361a1ebe95ae8a4709eaa83a3710b95dd70a6bd99ae1c3fd07b0ddb5
|
||||
verify_local_image aixun-datagov/poc-hive:4.2.0-authz-1 sha256:a0a00d9e683e62889e96e963c260f0c69b63b97da508462087f8975fd926fe14
|
||||
|
||||
if rg -q -i '(aixun-admin|aixun-admin-local|openmetadata-docker|namespace:[[:space:]]*public|:latest(?:[[:space:]@]|$)|/Users/[^/]+/Documents/)' \
|
||||
"${M2_COMPOSE}" "${SCRIPT_DIR}/source" "${SCRIPT_DIR}/seatunnel" "${SCRIPT_DIR}/dolphinscheduler" \
|
||||
"${SCRIPT_DIR}/hive" "${SCRIPT_DIR}/doris" "${SCRIPT_DIR}/openmetadata" --glob '!local/**'; then
|
||||
fail "formal M2 runtime contains a forbidden project reference, public namespace, latest tag, or absolute workspace path"
|
||||
fi
|
||||
if rg -q 'com\.aixun\.scope:[[:space:]]*poc|aixun-datagov-poc-' "${M2_COMPOSE}"; then
|
||||
fail "formal M2 Compose must not reuse POC object names or scope"
|
||||
fi
|
||||
|
||||
compose_json="$(docker compose --env-file "${ENV_FILE}" -p aixun-datagov-local \
|
||||
-f "${MAIN_COMPOSE}" -f "${M2_COMPOSE}" --profile app config --format json)" || fail "combined Compose rendering failed"
|
||||
printf '%s' "${compose_json}" | ruby "${PROJECT_ROOT}/script/datagov/validate-compose.rb" "${PROJECT_ROOT}" || \
|
||||
fail "combined Compose validation failed"
|
||||
unset compose_json
|
||||
|
||||
ports=(30307 31180 32145 32133 33106 33185 33186 33192 33193 34100 34101 34102 34103 34106 34183 35130 35190 35140)
|
||||
for port in "${ports[@]}"; do
|
||||
if lsof -nP -iTCP:"${port}" -sTCP:LISTEN >/dev/null 2>&1; then
|
||||
docker ps --filter label=com.aixun.project=aixun-datagov --filter label=com.aixun.scope=m2 --format '{{.Ports}}' |
|
||||
rg -q "127\\.0\\.0\\.1:${port}->" || fail "M2 host port ${port} is occupied outside the formal M2 runtime"
|
||||
fi
|
||||
done
|
||||
|
||||
for container_name in $(docker ps -a --filter label=com.aixun.scope=m2 --format '{{.Names}}'); do
|
||||
[[ "${container_name}" == aixun-datagov-m2-* ]] || fail "unexpected M2 container name ${container_name}"
|
||||
project_label="$(docker inspect "${container_name}" --format '{{index .Config.Labels "com.aixun.project"}}')"
|
||||
compose_label="$(docker inspect "${container_name}" --format '{{index .Config.Labels "com.docker.compose.project"}}')"
|
||||
[[ "${project_label}" == "aixun-datagov" && "${compose_label}" == "aixun-datagov-local" ]] ||
|
||||
fail "existing M2 container is not owned by the formal DataGov Compose project"
|
||||
done
|
||||
|
||||
echo 'M2 preflight passed without creating or changing Docker objects.'
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# M2-GOLDEN-001 was executed through authenticated platform APIs so every
|
||||
# intentional failure remains an immutable JobRun. This command is the
|
||||
# repeatable, read-only replay gate for those real runtime outcomes; it does not
|
||||
# submit another external workflow or mutate any Compose object.
|
||||
readonly PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
|
||||
readonly EVIDENCE_ROOT="${1:-${PROJECT_ROOT}/evidence/M2/M2-GOLDEN-001}"
|
||||
readonly RUN_ROOT="${EVIDENCE_ROOT}/runtime/golden-runs"
|
||||
readonly RESULT_DIR="${EVIDENCE_ROOT}/runtime/golden-chain-replay"
|
||||
|
||||
fail() {
|
||||
printf 'BLOCKED: %s\n' "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
require_file() {
|
||||
[[ -s "$1" ]] || fail "required evidence is missing or empty: ${1#"${PROJECT_ROOT}/"}"
|
||||
}
|
||||
|
||||
require_match() {
|
||||
local pattern=$1
|
||||
local file=$2
|
||||
grep -Eq "${pattern}" "${file}" || fail "expected runtime assertion is absent: ${file#"${PROJECT_ROOT}/"}"
|
||||
}
|
||||
|
||||
mkdir -p "${RESULT_DIR}"
|
||||
|
||||
readonly BACKFILL="${RUN_ROOT}/backfill"
|
||||
require_file "${BACKFILL}/platform-full-readback.tsv"
|
||||
require_file "${BACKFILL}/ds-instance-terminal.json"
|
||||
require_file "${BACKFILL}/seatunnel-job-terminal.json"
|
||||
require_file "${BACKFILL}/hive-partition-location-readback.txt"
|
||||
require_file "${BACKFILL}/hive-object-files-corrected.txt"
|
||||
require_match '^RUN[[:space:]].*[[:space:]]BACKFILL[[:space:]]M2-GOLDEN-20260825-A.*[[:space:]]SUCCEEDED[[:space:]]SUCCESS' "${BACKFILL}/platform-full-readback.tsv"
|
||||
[[ "$(grep -Ec '^STAGE[[:space:]](SEATUNNEL|HIVE|DORIS|OPENMETADATA|FINALIZE)[[:space:]]SUCCEEDED' "${BACKFILL}/platform-full-readback.tsv")" -eq 5 ]] || fail 'the successful backfill does not contain five successful stages'
|
||||
[[ "$(grep -Ec '^MAP[[:space:]](DOLPHINSCHEDULER|DORIS|HIVE|OPENMETADATA|SEATUNNEL)' "${BACKFILL}/platform-full-readback.tsv")" -eq 6 ]] || fail 'the successful backfill external mapping set is incomplete'
|
||||
jq -e '.code == 0 and .data.state == "SUCCESS" and .data.id == 15' "${BACKFILL}/ds-instance-terminal.json" >/dev/null || fail 'DolphinScheduler instance 15 is not SUCCESS'
|
||||
jq -e '.jobStatus == "FINISHED" and .jobId == "1144493599426084865"' "${BACKFILL}/seatunnel-job-terminal.json" >/dev/null || fail 'SeaTunnel backfill job is not FINISHED'
|
||||
require_match 'batch_no=M2-GOLDEN-20260825-A' "${BACKFILL}/hive-partition-location-readback.txt"
|
||||
require_match 'M2-GOLDEN-20260825-A,4' "${BACKFILL}/hive-partition-location-readback.txt"
|
||||
require_match 'M2-GOLDEN-20260825-A,2' "${BACKFILL}/hive-partition-location-readback.txt"
|
||||
require_match 's3a://aixun-datagov-m2-hive/warehouse/aixun_m2.db/m2_orders_valid' "${BACKFILL}/hive-partition-location-readback.txt"
|
||||
require_match 'm2_orders_valid/batch_no=M2-GOLDEN-20260825-A/.*/000000_0' "${BACKFILL}/hive-object-files-corrected.txt"
|
||||
|
||||
readonly IDEMPOTENCY="${RUN_ROOT}/partial-failure-recovery"
|
||||
require_file "${IDEMPOTENCY}/idempotency-db-counts-corrected.tsv"
|
||||
require_match '^1[[:space:]]+1[[:space:]]+2092104297591406594[[:space:]]+7[[:space:]]+1761100000000000001$' "${IDEMPOTENCY}/idempotency-db-counts-corrected.tsv"
|
||||
jq -e '.data.id == 7 and .data.runTimes == 1' "${IDEMPOTENCY}/ds-instance-before-duplicate.json" >/dev/null || fail 'idempotent replay changed the external instance'
|
||||
|
||||
readonly UNKNOWN="${RUN_ROOT}/unknown-reconciliation"
|
||||
require_file "${UNKNOWN}/platform-events-and-maintenance-tables.tsv"
|
||||
require_match '^EVENT[[:space:]]+2[[:space:]]+UNKNOWN[[:space:]]+CALLER_TIMEOUT' "${UNKNOWN}/platform-events-and-maintenance-tables.tsv"
|
||||
require_match '^EVENT[[:space:]]+3[[:space:]]+FAILED[[:space:]]+FAILURE' "${UNKNOWN}/platform-events-and-maintenance-tables.tsv"
|
||||
require_match '^MAINT_TABLE[[:space:]]+dg_maintenance_lease$' "${UNKNOWN}/platform-events-and-maintenance-tables.tsv"
|
||||
|
||||
readonly SEATUNNEL_FAILURE="${RUN_ROOT}/seatunnel-real-failure/platform-terminal-readback.tsv"
|
||||
require_file "${SEATUNNEL_FAILURE}"
|
||||
require_match '^RUN[[:space:]].*[[:space:]]FAILED[[:space:]]+FAILURE[[:space:]]+9[[:space:]]+-[[:space:]]+SEATUNNEL_FAILED' "${SEATUNNEL_FAILURE}"
|
||||
require_match 'Factory initialize failed' "${SEATUNNEL_FAILURE}"
|
||||
|
||||
readonly HIVE_FAILURE="${RUN_ROOT}/hive-fail-once-retry/initial-failure/platform-terminal-readback.tsv"
|
||||
readonly HIVE_RECOVERY="${RUN_ROOT}/hive-fail-once-retry/projection-idempotency-recovery/platform-full-readback.tsv"
|
||||
require_file "${HIVE_FAILURE}"
|
||||
require_file "${HIVE_RECOVERY}"
|
||||
require_match '^STAGE[[:space:]]+HIVE[[:space:]]+FAILED[[:space:]]+1[[:space:]]+M2_CONTROLLED_HIVE_DEPENDENCY_FAILURE' "${HIVE_FAILURE}"
|
||||
require_match '^RUN[[:space:]]+2092111234492071937.*[[:space:]]RETRY[[:space:]]+M2-GOLDEN-20260825-A.*[[:space:]]SUCCEEDED[[:space:]]+SUCCESS' "${HIVE_RECOVERY}"
|
||||
require_match '^SNAPSHOT[[:space:]].*0bb3910552789742f229571668c0cbf0dc54afa1620d81d68595a25f7ba5c036[[:space:]]+0bb3910552789742f229571668c0cbf0dc54afa1620d81d68595a25f7ba5c036' "${HIVE_RECOVERY}"
|
||||
|
||||
readonly LINEAGE="${RUN_ROOT}/hive-fail-once-retry/projection-idempotency-recovery/openmetadata-lineage.json"
|
||||
require_file "${LINEAGE}"
|
||||
jq -e '.entity.fullyQualifiedName == "aixun_m2_golden.golden_database.golden_schema.hive_orders_valid" and (.upstreamEdges | length) == 1 and (.downstreamEdges | length) == 1' "${LINEAGE}" >/dev/null || fail 'OpenMetadata FQN and lineage are incomplete'
|
||||
|
||||
require_file "${EVIDENCE_ROOT}/runtime/doris-readback/result.txt"
|
||||
require_match '^PASS: approved identity read four approved rows' "${EVIDENCE_ROOT}/runtime/doris-readback/result.txt"
|
||||
require_file "${EVIDENCE_ROOT}/runtime/doris-bounds/result.txt"
|
||||
require_match '^PASS: real Doris fixed-query' "${EVIDENCE_ROOT}/runtime/doris-bounds/result.txt"
|
||||
|
||||
{
|
||||
printf 'task_id=M2-GOLDEN-001\n'
|
||||
printf 'mode=read-only-runtime-evidence-replay\n'
|
||||
printf 'successful_run_id=2092111962925236226\n'
|
||||
printf 'successful_ds_instance_id=15\n'
|
||||
printf 'successful_seatunnel_job_id=1144493599426084865\n'
|
||||
printf 'idempotent_run_id=2092104297591406594\n'
|
||||
printf 'unknown_reconciled_run_id=2092106213360730113\n'
|
||||
printf 'seatunnel_failure_run_id=2092106897799839746\n'
|
||||
printf 'hive_failure_run_id=2092107667517538306\n'
|
||||
printf 'hive_recovery_run_id=2092111234492071937\n'
|
||||
printf 'result=PASS\n'
|
||||
} > "${RESULT_DIR}/result.txt"
|
||||
|
||||
printf '%s\n' 'PASS: M2 real success, idempotency, UNKNOWN reconciliation, failure/retry, Hive/Doris/OpenMetadata and external-ID evidence replayed.'
|
||||
@@ -0,0 +1,25 @@
|
||||
FROM aixun-datagov/poc-seatunnel:2.3.13-auth-1
|
||||
|
||||
USER root
|
||||
RUN install -d -o seatunnel -g seatunnel /opt/seatunnel/plugins/connector-jdbc
|
||||
COPY local/artifacts/connector-jdbc-2.3.13.jar /opt/seatunnel/connectors/connector-jdbc-2.3.13.jar
|
||||
COPY local/artifacts/connector-http-base-2.3.13.jar /opt/seatunnel/connectors/connector-http-base-2.3.13.jar
|
||||
COPY local/artifacts/connector-file-local-2.3.13.jar /opt/seatunnel/connectors/connector-file-local-2.3.13.jar
|
||||
COPY local/artifacts/connector-hive-2.3.13.jar /opt/seatunnel/connectors/connector-hive-2.3.13.jar
|
||||
COPY local/artifacts/mysql-connector-j-9.5.0.jar /opt/seatunnel/plugins/connector-jdbc/mysql-connector-j-9.5.0.jar
|
||||
COPY local/artifacts/postgresql-42.7.13.jar /opt/seatunnel/plugins/connector-jdbc/postgresql-42.7.13.jar
|
||||
COPY local/artifacts/mariadb-java-client-3.5.10.jar /opt/seatunnel/plugins/connector-jdbc/mariadb-java-client-3.5.10.jar
|
||||
COPY local/artifacts/hive-jdbc-4.2.0-standalone.jar /opt/seatunnel/plugins/connector-jdbc/hive-jdbc-4.2.0-standalone.jar
|
||||
COPY local/artifacts/hive-exec-3.1.3.jar /opt/seatunnel/lib/hive-exec-3.1.3.jar
|
||||
COPY local/artifacts/libfb303-0.9.3.jar /opt/seatunnel/lib/libfb303-0.9.3.jar
|
||||
COPY local/artifacts/DmJdbcDriver18-8.1.3.62.jar /opt/seatunnel/plugins/connector-jdbc/DmJdbcDriver18-8.1.3.62.jar
|
||||
COPY local/artifacts/mssql-jdbc-13.4.0.jre11.jar /opt/seatunnel/plugins/connector-jdbc/mssql-jdbc-13.4.0.jre11.jar
|
||||
COPY local/artifacts/ojdbc11-23.26.2.0.0.jar /opt/seatunnel/plugins/connector-jdbc/ojdbc11-23.26.2.0.0.jar
|
||||
COPY local/artifacts/kingbase8-9.0.1.jre7.jar /opt/seatunnel/plugins/connector-jdbc/kingbase8-9.0.1.jre7.jar
|
||||
COPY --chmod=0555 start-seatunnel.sh /opt/aixun-m2/start-seatunnel.sh
|
||||
RUN find /opt/seatunnel/lib /opt/seatunnel/connectors -type f -iname '*opengauss*.jar' -delete && \
|
||||
test "$(find /opt/seatunnel/lib /opt/seatunnel/connectors -type f -iname '*opengauss*.jar' | wc -l)" -eq 0 && \
|
||||
chown -R seatunnel:seatunnel /opt/seatunnel/connectors /opt/seatunnel/lib /opt/seatunnel/plugins/connector-jdbc && \
|
||||
install -d -o seatunnel -g seatunnel /opt/aixun-m2
|
||||
USER seatunnel
|
||||
ENTRYPOINT ["/opt/aixun-m2/start-seatunnel.sh"]
|
||||
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
for secret_file in \
|
||||
/run/secrets/seatunnel_username \
|
||||
/run/secrets/seatunnel_password \
|
||||
/run/secrets/hive_s3_access_key \
|
||||
/run/secrets/hive_s3_secret_key; do
|
||||
[[ -r "${secret_file}" ]] || { echo 'required secretRef is unavailable' >&2; exit 70; }
|
||||
done
|
||||
|
||||
basic_username="$(< /run/secrets/seatunnel_username)"
|
||||
basic_password="$(< /run/secrets/seatunnel_password)"
|
||||
s3_access_key="$(< /run/secrets/hive_s3_access_key)"
|
||||
s3_secret_key="$(< /run/secrets/hive_s3_secret_key)"
|
||||
[[ "${s3_access_key}" =~ ^[A-Za-z0-9._-]{8,128}$ ]] || {
|
||||
echo 'S3 access secretRef has an unsupported format' >&2
|
||||
exit 70
|
||||
}
|
||||
[[ "${s3_secret_key}" =~ ^[A-Za-z0-9._+/=-]{8,256}$ ]] || {
|
||||
echo 'S3 secret secretRef has an unsupported format' >&2
|
||||
exit 70
|
||||
}
|
||||
runtime_dir=/tmp/aixun-datagov-m2-seatunnel-config
|
||||
hadoop_conf_dir=/tmp/aixun-datagov-m2-seatunnel-hadoop-conf
|
||||
install -d -m 0700 "${runtime_dir}" "${hadoop_conf_dir}"
|
||||
|
||||
cat >"${hadoop_conf_dir}/core-site.xml" <<EOF
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<property><name>fs.defaultFS</name><value>s3a://aixun-datagov-m2-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://hive-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>
|
||||
</configuration>
|
||||
EOF
|
||||
chmod 0600 "${hadoop_conf_dir}/core-site.xml"
|
||||
|
||||
sed \
|
||||
-e 's/cluster-name: aixun-datagov-poc-seatunnel/cluster-name: aixun-datagov-m2-seatunnel/' \
|
||||
-e 's/cluster-name: seatunnel/cluster-name: aixun-datagov-m2-seatunnel/' \
|
||||
"${SEATUNNEL_HOME}/config/hazelcast.yaml" >"${runtime_dir}/hazelcast.yaml"
|
||||
|
||||
cat >"${runtime_dir}/seatunnel.yaml" <<EOF
|
||||
seatunnel:
|
||||
engine:
|
||||
classloader-cache-mode: true
|
||||
history-job-expire-minutes: 1440
|
||||
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" "${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 s3_access_key s3_secret_key
|
||||
exec "${SEATUNNEL_HOME}/bin/seatunnel-cluster.sh"
|
||||
@@ -0,0 +1,34 @@
|
||||
CREATE TABLE IF NOT EXISTS m2_orders_source (
|
||||
record_id BIGINT NOT NULL,
|
||||
order_no VARCHAR(128) NULL,
|
||||
customer_code VARCHAR(128) NULL,
|
||||
amount DECIMAL(18,2) NULL,
|
||||
event_time DATETIME NULL,
|
||||
quality_flag VARCHAR(32) NOT NULL,
|
||||
batch_no VARCHAR(64) NOT NULL,
|
||||
PRIMARY KEY (record_id),
|
||||
KEY idx_m2_orders_source_batch (batch_no)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS m2_orders_stage (
|
||||
record_id BIGINT NOT NULL,
|
||||
order_no VARCHAR(128) NULL,
|
||||
customer_code VARCHAR(128) NULL,
|
||||
amount DECIMAL(18,2) NULL,
|
||||
event_time DATETIME NULL,
|
||||
quality_flag VARCHAR(32) NOT NULL,
|
||||
batch_no VARCHAR(64) NOT NULL,
|
||||
PRIMARY KEY (record_id),
|
||||
KEY idx_m2_orders_stage_batch (batch_no)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
INSERT INTO m2_orders_source(
|
||||
record_id, order_no, customer_code, amount, event_time, quality_flag, batch_no
|
||||
) VALUES
|
||||
(820000000000000001, 'ORD-M2-001', 'CUST-A', 120.50, '2026-08-25 08:00:00', 'VALID', 'M2-GOLDEN-20260825-A'),
|
||||
(820000000000000002, 'ORD-M2-002', NULL, 0.00, '2026-08-25 08:01:00', 'VALID', 'M2-GOLDEN-20260825-A'),
|
||||
(820000000000000003, 'ORD-M2-DUP', 'CUST-DUP-1', 99.99, '2026-08-25 08:02:00', 'VALID', 'M2-GOLDEN-20260825-A'),
|
||||
(820000000000000004, 'ORD-M2-DUP', 'CUST-DUP-2', 99.99, '2026-08-25 08:03:00', 'VALID', 'M2-GOLDEN-20260825-A'),
|
||||
(820000000000000005, 'ORD-M2-INVALID', 'CUST-X', -5.00, NULL, 'INVALID_AMOUNT', 'M2-GOLDEN-20260825-A'),
|
||||
(820000000000000006, NULL, 'CUST-Y', NULL, '2026-08-25 08:05:00', 'INVALID_REQUIRED', 'M2-GOLDEN-20260825-A')
|
||||
ON DUPLICATE KEY UPDATE record_id=VALUES(record_id);
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
readonly PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
|
||||
readonly SECRET_FILE="${PROJECT_ROOT}/script/datagov/m2/local/secrets/doris-query-password"
|
||||
readonly EVIDENCE_DIR="${1:-${PROJECT_ROOT}/evidence/M2/M2-GOLDEN-001/runtime/doris-bounds}"
|
||||
|
||||
[[ -s "${SECRET_FILE}" ]] || { echo 'Doris query secretRef target is unavailable' >&2; exit 1; }
|
||||
mkdir -p "${EVIDENCE_DIR}"
|
||||
|
||||
cd "${PROJECT_ROOT}"
|
||||
./mvnw -B -pl aixun-modules/aixun-integration -am \
|
||||
-Ddatagov.m2.runtime=true \
|
||||
-Ddatagov.m2.doris.jdbc-url=jdbc:mysql://127.0.0.1:35190 \
|
||||
-Ddatagov.m2.doris.secret-file="${SECRET_FILE}" \
|
||||
-Dtest=DorisAdapterRuntimeContractTest \
|
||||
-Dsurefire.failIfNoSpecifiedTests=false \
|
||||
test 2>&1 | tee "${EVIDENCE_DIR}/maven-runtime-contract.log"
|
||||
|
||||
printf '%s\n' \
|
||||
'PASS: real Doris fixed-query rows/bytes/page, disabled download, timeout, rate, concurrency, backpressure and cancellation guards verified.' \
|
||||
> "${EVIDENCE_DIR}/result.txt"
|
||||
在新工单中引用
屏蔽一个用户