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