mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-03 22:34:11 +02:00
update
This commit is contained in:
@@ -38,5 +38,5 @@
|
|||||||
"slug": "postgres",
|
"slug": "postgres",
|
||||||
"udev": true,
|
"udev": true,
|
||||||
"url": "https://github.com/alexbelgium/hassio-addons/tree/master/postgres",
|
"url": "https://github.com/alexbelgium/hassio-addons/tree/master/postgres",
|
||||||
"version": "15.7-27"
|
"version": "15.7-28"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,12 +58,30 @@ fi
|
|||||||
###############################
|
###############################
|
||||||
|
|
||||||
bashio::log.info "Waiting for PostgreSQL to start..."
|
bashio::log.info "Waiting for PostgreSQL to start..."
|
||||||
|
|
||||||
|
# Set PostgreSQL connection variables
|
||||||
|
DB_PORT=5432
|
||||||
|
DB_HOSTNAME=localhost
|
||||||
|
DB_PASSWORD="$(bashio::config 'POSTGRES_PASSWORD')"
|
||||||
|
DB_USERNAME=postgres
|
||||||
|
if bashio::config.has_value "POSTGRES_USER"; then
|
||||||
|
DB_USERNAME="$(bashio::config "POSTGRES_USER")"
|
||||||
|
fi
|
||||||
|
export DB_PORT DB_HOSTNAME DB_USERNAME DB_PASSWORD
|
||||||
|
|
||||||
( bashio::net.wait_for 5432 localhost 900
|
( bashio::net.wait_for 5432 localhost 900
|
||||||
|
|
||||||
|
until pg_isready -h "$DB_HOSTNAME" -p "$DB_PORT" -U "$DB_USERNAME" >/dev/null 2>&1; do
|
||||||
|
echo "PostgreSQL is starting up..."
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
# PostgreSQL Major Version Upgrade #
|
# PostgreSQL Major Version Upgrade #
|
||||||
###############################
|
###############################
|
||||||
|
|
||||||
|
update_postgres() {
|
||||||
|
|
||||||
# Read the previous PostgreSQL version from file
|
# Read the previous PostgreSQL version from file
|
||||||
OLD_PG_VERSION=$(cat "$PG_VERSION_FILE" 2>/dev/null || echo "$PG_MAJOR_VERSION")
|
OLD_PG_VERSION=$(cat "$PG_VERSION_FILE" 2>/dev/null || echo "$PG_MAJOR_VERSION")
|
||||||
|
|
||||||
@@ -113,21 +131,12 @@ if [ "$OLD_PG_VERSION" != "$PG_MAJOR_VERSION" ]; then
|
|||||||
# Store the new PostgreSQL version
|
# Store the new PostgreSQL version
|
||||||
echo "$PG_MAJOR_VERSION" > "$PG_VERSION_FILE"
|
echo "$PG_MAJOR_VERSION" > "$PG_VERSION_FILE"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# Enable & Upgrade pgvector.rs #
|
# Enable & Upgrade pgvector.rs #
|
||||||
#####################################
|
#####################################
|
||||||
|
|
||||||
# Set PostgreSQL connection variables
|
|
||||||
DB_PORT=5432
|
|
||||||
DB_HOSTNAME=localhost
|
|
||||||
DB_PASSWORD="$(bashio::config 'POSTGRES_PASSWORD')"
|
|
||||||
DB_USERNAME=postgres
|
|
||||||
if bashio::config.has_value "POSTGRES_USER"; then
|
|
||||||
DB_USERNAME="$(bashio::config "POSTGRES_USER")"
|
|
||||||
fi
|
|
||||||
export DB_PORT DB_HOSTNAME DB_USERNAME DB_PASSWORD
|
|
||||||
|
|
||||||
# Function: Check if 'vectors' extension is enabled
|
# Function: Check if 'vectors' extension is enabled
|
||||||
check_vector_extension() {
|
check_vector_extension() {
|
||||||
bashio::log.info "Checking if 'vectors' extension is enabled..."
|
bashio::log.info "Checking if 'vectors' extension is enabled..."
|
||||||
@@ -203,7 +212,8 @@ troubleshoot_vector_extension() {
|
|||||||
# Main Extension Handling #
|
# Main Extension Handling #
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
sleep 10
|
# Store previous vector version
|
||||||
|
update_postgres
|
||||||
|
|
||||||
if ! check_vector_extension; then
|
if ! check_vector_extension; then
|
||||||
enable_vector_extension
|
enable_vector_extension
|
||||||
|
|||||||
Reference in New Issue
Block a user