elastic startup fix
This commit is contained in:
parent
764e820fee
commit
039b38e6fd
@ -584,11 +584,9 @@ postStart:
|
||||
- -c
|
||||
- |
|
||||
echo "[postStart] Starting postStart hook..." >&2
|
||||
|
||||
# Default values (override in env)
|
||||
MAX_RETRIES="${MAX_RETRIES:-30}"
|
||||
RETRY_INTERVAL="${RETRY_INTERVAL:-5}"
|
||||
|
||||
# Validate required env vars
|
||||
REQUIRED_VARS=("CA_CERT" "ES_USERNAME" "ELASTIC_PASSWORD" "ES_URL" "TEMPLATE_PATH_1" "TEMPLATE_PATH_2" "TEMPLATE_PATH_3")
|
||||
for var in "${REQUIRED_VARS[@]}"; do
|
||||
@ -597,7 +595,6 @@ postStart:
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "[postStart] Waiting for Elasticsearch at $ES_URL to be ready..." >&2
|
||||
for ((i=1; i<=MAX_RETRIES; i++)); do
|
||||
if /usr/bin/curl --cacert "$CA_CERT" -s -u "$ES_USERNAME:$ELASTIC_PASSWORD" "$ES_URL" >/dev/null; then
|
||||
@ -611,7 +608,6 @@ postStart:
|
||||
echo "[postStart] Attempt $i: Elasticsearch not ready, retrying in $RETRY_INTERVAL seconds..." >&2
|
||||
sleep "$RETRY_INTERVAL"
|
||||
done
|
||||
|
||||
echo "[postStart] Applying index templates..." >&2
|
||||
for idx in "chat:$TEMPLATE_PATH_1" "message:$TEMPLATE_PATH_2" "user:$TEMPLATE_PATH_3"; do
|
||||
name="${idx%%:*}"
|
||||
@ -625,9 +621,7 @@ postStart:
|
||||
fi
|
||||
echo "[postStart] Applied template: $name" >&2
|
||||
done
|
||||
|
||||
echo "[postStart] All index templates applied successfully." >&2
|
||||
|
||||
sysctlInitContainer:
|
||||
enabled: true
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user