poststartup script moved to extra container, non init
This commit is contained in:
parent
eb3ccd30e7
commit
d23a46f828
@ -189,16 +189,22 @@ extraContainers:
|
|||||||
echo "[template-loader] Attempt $i: ES not ready, sleeping..."
|
echo "[template-loader] Attempt $i: ES not ready, sleeping..."
|
||||||
sleep "${RETRY_INTERVAL:-5}"
|
sleep "${RETRY_INTERVAL:-5}"
|
||||||
done
|
done
|
||||||
echo "[template-loader] Applying index templates..."
|
echo "[template-loader] Checking and applying index templates if needed..."
|
||||||
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%%:*}"
|
||||||
path="${idx##*:}"
|
path="${idx##*:}"
|
||||||
echo "[template-loader] Applying template: $name from $path..."
|
# Check if index exists
|
||||||
curl -X PUT "$ES_URL/$name" \
|
if curl -sf -o /dev/null "$ES_URL/$name"; then
|
||||||
-H 'Content-Type: application/json' \
|
echo "[template-loader] Index $name already exists. Skipping."
|
||||||
--data-binary @"$path"
|
else
|
||||||
|
echo "[template-loader] Creating index $name from $path..."
|
||||||
|
curl -X PUT "$ES_URL/$name" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
--data-binary @"$path"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
echo "[template-loader] All templates applied. Exiting."
|
echo "[template-loader] All templates applied (or skipped). Exiting."
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- name: ES_URL
|
- name: ES_URL
|
||||||
value: "http://elasticsearch-master:9200"
|
value: "http://elasticsearch-master:9200"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user