fix: stabilize systemd deployment and release updates
Release / release (push) Canceled after 0s

This commit is contained in:
Qiufeng
2026-08-18 16:25:41 +08:00
parent cea7048f6c
commit 8eb1cbad83
15 changed files with 253 additions and 74 deletions
+32
View File
@@ -51,6 +51,10 @@ EOF
cat > "$WORK/java" <<'SH'
#!/usr/bin/env bash
set -Eeuo pipefail
if [ "${1:-}" = -version ]; then
printf 'openjdk version "17-fixture"\n' >&2
exit 0
fi
{
printf 'cwd=%s\n' "$PWD"
printf 'args=%s\n' "$*"
@@ -92,6 +96,34 @@ PID_RECORD=$(sed -n 's/^pid-record=//p' "$WORK/java.log")
SELF_PID=$(sed -n 's/^self-pid=//p' "$WORK/java.log")
[ "$PID_RECORD" = "$SELF_PID 424242" ] || fail 'PID file did not bind the PID to its proc start time'
# systemd reads the root-only EnvironmentFile before dropping to User=kaidi.
# The launcher must therefore be able to start with those files intentionally
# unreadable by the service user.
chmod 000 "$WORK/base.env" "$WORK/runtime.env"
MOCK_JAVA_LOG="$WORK/preloaded.log" \
PATH="$WORK/mock-bin:$PATH" \
KAIDI_ENV_PRELOADED=true \
KAIDI_JAVA_BIN="$WORK/java" \
SPRING_PROFILES_ACTIVE=production \
SERVER_ADDRESS=127.0.0.1 \
SERVER_PORT=21000 \
DB_URL='jdbc:mysql://db.fixture/kaidi_finance' \
DB_USERNAME=fixture-user \
DB_PASSWORD='fixture-password' \
FIELD_ENCRYPTION_KEY=fixture-field-key \
FILE_STORAGE_ROOT="$WORK/files" \
FILE_STORAGE_TEMP="$WORK/tmp" \
FINANCE_SETUP_ENABLED=false \
FINANCE_UPDATE_ENABLED=true \
FILE_SCANNER_ENABLED=false \
KAIDI_PID_FILE="$WORK/state/preloaded.pid" \
KAIDI_CONFIG_FILE="$WORK/base.env" \
KAIDI_RUNTIME_ENV_FILE="$WORK/runtime.env" \
"$RELEASE/ops/baota-start.sh"
grep -Fqx 'port=21000' "$WORK/preloaded.log" \
|| fail 'launcher still depended on the root-only configuration files under systemd'
chmod 0644 "$WORK/base.env" "$WORK/runtime.env"
MOCK_JAVA_LOG="$WORK/explicit.log" \
PATH="$WORK/mock-bin:$PATH" \
KAIDI_JAVA_BIN="$WORK/java" \