recollate

This commit is contained in:
Jason Ertel
2026-07-07 16:54:06 -04:00
parent 032d792331
commit ef83450107
+16 -3
View File
@@ -789,7 +789,7 @@ bootstrap_so_soc_database() {
# and runs automatically only on a fresh data directory. Hosts upgrading from
# 3.1.0 already have /nsm/postgres populated, so the so_soc bootstrap block
# added in 3.2 never fires. Re-run the script explicitly; it's idempotent.
echo "Bootstrapping so_soc database via init-db.sh."
echo "Bootstrapping database via init-db.sh."
# The postgres image has no USER directive, so `docker exec` defaults to
# root, and the container env intentionally omits POSTGRES_USER (the upstream
# entrypoint defaults it transiently during first-init only). Recreate both
@@ -800,10 +800,10 @@ bootstrap_so_soc_database() {
return 0
fi
if ! $exec_cmd; then
FINAL_MESSAGE_QUEUE+=("WARNING: init-db.sh failed inside so-postgres during the 3.2.0 upgrade; the so_soc database may not have been bootstrapped. Re-run manually: $exec_cmd")
FINAL_MESSAGE_QUEUE+=("WARNING: init-db.sh failed inside so-postgres during the 3.2.0 upgrade; the database may not have been bootstrapped. Re-run manually: $exec_cmd")
return 0
fi
echo "so_soc bootstrap complete."
echo "Database bootstrap complete."
}
# Existing grids should keep ILM unless an admin explicitly opts in to DLM.
@@ -873,6 +873,16 @@ update_kafka_metadata() {
fi
}
recollate_postgres() {
for db in postgres securityonion so-telegraf; do
exec_cmd="docker exec so-postgres psql -U postgres $db -c \"reindex database $db; alter database $db refresh collation version;\""
if ! $exec_cmd; then
FINAL_MESSAGE_QUEUE+=("WARNING: recollating $db database failed. Re-run manually: $exec_cmd")
return 0
fi
done
}
up_to_3.2.0() {
fix_logstash_0013_lumberjack_pipeline_name
@@ -884,6 +894,9 @@ up_to_3.2.0() {
post_to_3.2.0() {
bootstrap_so_soc_database
# Recollate due to image OS rebase
recollate_postgres
# Including agent regen script here since it was missed in post_to_3.1.0
echo "Regenerating Elastic Agent Installers"
/sbin/so-elastic-agent-gen-installers