feat: expand vehicle data platform capabilities

This commit is contained in:
lingniu
2026-07-27 16:46:15 +08:00
parent e3a1f80f86
commit 3c4bece72c
650 changed files with 62155 additions and 2552 deletions

View File

@@ -7,9 +7,16 @@ ARCHIVE=${2:?web archive is required}
API_BINARY=${3:-}
ONEOS_SCOPE_BINARY=${4:-}
RECONCILIATION_BINARY=${5:-}
OPEN_STAT_BINARY=${6:-}
ALERT_EVALUATOR_BINARY=${7:-}
ALERT_STREAM_EVALUATOR_BINARY=${8:-}
ALERT_NOTIFICATION_DISPATCHER_BINARY=${9:-}
ROOT=${PLATFORM_ROOT:-/opt/lingniu-vehicle-platform}
BASE_URL=${PLATFORM_BASE_URL:-http://127.0.0.1:20300}
SERVICE=${PLATFORM_SERVICE:-lingniu-vehicle-platform}
ALERT_EVALUATOR_SERVICE=${ALERT_EVALUATOR_SERVICE:-lingniu-vehicle-alert-evaluator}
ALERT_STREAM_EVALUATOR_SERVICE=${ALERT_STREAM_EVALUATOR_SERVICE:-lingniu-vehicle-alert-stream-evaluator}
ALERT_NOTIFICATION_DISPATCHER_SERVICE=${ALERT_NOTIFICATION_DISPATCHER_SERVICE:-lingniu-vehicle-alert-notification-dispatcher}
COMPATIBILITY_GENERATIONS=${COMPATIBILITY_GENERATIONS:-3}
RELEASE_HISTORY_LIMIT=${RELEASE_HISTORY_LIMIT:-20}
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
@@ -29,6 +36,18 @@ fi
if test -n "$RECONCILIATION_BINARY"; then
test -f "$RECONCILIATION_BINARY" || { printf 'reconciliation evaluator binary is missing: %s\n' "$RECONCILIATION_BINARY" >&2; exit 1; }
fi
if test -n "$OPEN_STAT_BINARY"; then
test -f "$OPEN_STAT_BINARY" || { printf 'open platform statistics binary is missing: %s\n' "$OPEN_STAT_BINARY" >&2; exit 1; }
fi
if test -n "$ALERT_EVALUATOR_BINARY"; then
test -f "$ALERT_EVALUATOR_BINARY" || { printf 'alert evaluator binary is missing: %s\n' "$ALERT_EVALUATOR_BINARY" >&2; exit 1; }
fi
if test -n "$ALERT_STREAM_EVALUATOR_BINARY"; then
test -f "$ALERT_STREAM_EVALUATOR_BINARY" || { printf 'alert stream evaluator binary is missing: %s\n' "$ALERT_STREAM_EVALUATOR_BINARY" >&2; exit 1; }
fi
if test -n "$ALERT_NOTIFICATION_DISPATCHER_BINARY"; then
test -f "$ALERT_NOTIFICATION_DISPATCHER_BINARY" || { printf 'alert notification dispatcher binary is missing: %s\n' "$ALERT_NOTIFICATION_DISPATCHER_BINARY" >&2; exit 1; }
fi
test -x "$SCRIPT_DIR/prepare-web-release-tree.sh" || { printf 'release tree helper is missing\n' >&2; exit 1; }
test -f "$SCRIPT_DIR/prune-release-history.py" || { printf 'release pruning helper is missing\n' >&2; exit 1; }
test -f "$SCRIPT_DIR/verify-customer-demo.py" || { printf 'customer demo gate is missing\n' >&2; exit 1; }
@@ -73,6 +92,9 @@ rollback() {
python3 -c 'import os,sys; os.replace(sys.argv[1], sys.argv[2])' "$ROOT/current.rollback" "$ROOT/current"
set_release_env "$old_release"
"$SYSTEMCTL_BIN" restart "$SERVICE"
test -z "$ALERT_EVALUATOR_BINARY" || "$SYSTEMCTL_BIN" restart "$ALERT_EVALUATOR_SERVICE"
test -z "$ALERT_STREAM_EVALUATOR_BINARY" || "$SYSTEMCTL_BIN" restart "$ALERT_STREAM_EVALUATOR_SERVICE"
test -z "$ALERT_NOTIFICATION_DISPATCHER_BINARY" || "$SYSTEMCTL_BIN" restart "$ALERT_NOTIFICATION_DISPATCHER_SERVICE"
fi
printf 'web release install failed; current restored to %s\n' "$old" >&2
exit "$status"
@@ -81,7 +103,7 @@ trap rollback ERR
test ! -e "$next" || { printf 'release already exists: %s\n' "$next" >&2; exit 1; }
mkdir -p "$next/web"
for runtime_file in platform-api alert-evaluator alert-stream-evaluator platform-migrate oneos-scope-sync reconciliation-evaluator alert-benchmark; do
for runtime_file in platform-api alert-evaluator alert-stream-evaluator alert-notification-dispatcher platform-migrate oneos-scope-sync reconciliation-evaluator alert-benchmark open-platform-stat; do
if test -f "$old/$runtime_file"; then
cp "$old/$runtime_file" "$next/$runtime_file"
fi
@@ -96,6 +118,18 @@ fi
if test -n "$RECONCILIATION_BINARY"; then
cp "$RECONCILIATION_BINARY" "$next/reconciliation-evaluator"
fi
if test -n "$OPEN_STAT_BINARY"; then
cp "$OPEN_STAT_BINARY" "$next/open-platform-stat"
fi
if test -n "$ALERT_EVALUATOR_BINARY"; then
cp "$ALERT_EVALUATOR_BINARY" "$next/alert-evaluator"
fi
if test -n "$ALERT_STREAM_EVALUATOR_BINARY"; then
cp "$ALERT_STREAM_EVALUATOR_BINARY" "$next/alert-stream-evaluator"
fi
if test -n "$ALERT_NOTIFICATION_DISPATCHER_BINARY"; then
cp "$ALERT_NOTIFICATION_DISPATCHER_BINARY" "$next/alert-notification-dispatcher"
fi
if test -f "$old/lingniu-vehicle-platform.service"; then
cp "$old/lingniu-vehicle-platform.service" "$next/lingniu-vehicle-platform.service"
fi
@@ -114,7 +148,7 @@ cp "$SCRIPT_DIR/verify-customer-demo.py" "$next/deploy/verify-customer-demo.py"
cp "$SCRIPT_DIR/import-source-providers.py" "$next/deploy/import-source-providers.py"
cp "$0" "$next/deploy/install-web-release.sh"
chmod +x "$next/platform-api" "$next/deploy/"*.sh "$next/deploy/prune-release-history.py" "$next/deploy/verify-customer-demo.py" "$next/deploy/import-source-providers.py"
for runtime_file in alert-evaluator alert-stream-evaluator platform-migrate oneos-scope-sync reconciliation-evaluator alert-benchmark; do
for runtime_file in alert-evaluator alert-stream-evaluator alert-notification-dispatcher platform-migrate oneos-scope-sync reconciliation-evaluator alert-benchmark open-platform-stat; do
test ! -f "$next/$runtime_file" || chmod +x "$next/$runtime_file"
done
@@ -132,6 +166,9 @@ python3 -c 'import os,sys; os.replace(sys.argv[1], sys.argv[2])' "$ROOT/current.
switched=true
set_release_env "$RELEASE_ID"
"$SYSTEMCTL_BIN" restart "$SERVICE"
test -z "$ALERT_EVALUATOR_BINARY" || "$SYSTEMCTL_BIN" restart "$ALERT_EVALUATOR_SERVICE"
test -z "$ALERT_STREAM_EVALUATOR_BINARY" || "$SYSTEMCTL_BIN" restart "$ALERT_STREAM_EVALUATOR_SERVICE"
test -z "$ALERT_NOTIFICATION_DISPATCHER_BINARY" || "$SYSTEMCTL_BIN" restart "$ALERT_NOTIFICATION_DISPATCHER_SERVICE"
ready=false
for _ in $(seq 1 15); do