diff --git a/README-DEV.md b/README-DEV.md index fddd42e..75af42b 100644 --- a/README-DEV.md +++ b/README-DEV.md @@ -3,7 +3,7 @@ To build the lastest version using local docker, switch to the folder where the `dockerfile` resides, and run: ``` -docker build --tag husselhans/hassos-addon-timescaledb-aarch64:dev . +docker build --platform linux/aarch64 --tag husselhans/hassos-addon-timescaledb-aarch64:dev . ``` The dockerfile already contains the default build architecture and the default base image: diff --git a/timescaledb/Dockerfile b/timescaledb/Dockerfile index 833c532..8133d77 100644 --- a/timescaledb/Dockerfile +++ b/timescaledb/Dockerfile @@ -215,7 +215,7 @@ RUN set -ex \ # Make sure that S6 is not so hard on our service startup/shutdown ENV \ - S6_SERVICES_GRACETIME=18000 + S6_SERVICES_GRACETIME=50000 # Copy data COPY rootfs / diff --git a/timescaledb/config.json b/timescaledb/config.json index 1449767..9153565 100644 --- a/timescaledb/config.json +++ b/timescaledb/config.json @@ -10,7 +10,7 @@ "boot": "auto", "init": false, "map": ["share:rw"], - "timeout": 20, + "timeout": 60, "ports": { "5432/tcp": null }, diff --git a/timescaledb/rootfs/etc/cont-init.d/init.sh b/timescaledb/rootfs/etc/cont-init.d/init.sh index 6ce7985..4150daf 100644 --- a/timescaledb/rootfs/etc/cont-init.d/init.sh +++ b/timescaledb/rootfs/etc/cont-init.d/init.sh @@ -64,7 +64,11 @@ upgradePostgreSQL12to14 () { # And upgrade PostgreSQL bashio::log.notice "Upgrading PostgreSql..." - #First, start postgres on the old data-dir + # Backup old HBA.conf and create a temp one... + mv ${postgres_data}12/pg_hba.conf ${postgres_data}12/pg_hba_backup.conf + echo "local all all trust" > ${postgres_data}12/pg_hba.conf + + #Start postgres on the old data-dir bashio::log.info "Starting PostgreSQL-12 first.." su - postgres -c "/usr/libexec/postgresql12/postgres -D ${postgres_data}12" & postgres_pid=$! @@ -79,7 +83,11 @@ upgradePostgreSQL12to14 () { # Stop server kill ${postgres_pid} - wait ${postgres_pid} + wait ${postgres_pid} || true + + # Restore HBA.CONF + rm ${postgres_data}12/pg_hba.conf + mv ${postgres_data}12/pg_hba_backup.conf ${postgres_data}12/pg_hba.conf # And upgrade! bashio::log.notice "Upgrading databases.." @@ -112,6 +120,14 @@ if bashio::var.true "${new_install}"; then bashio::addon.version > ${version_file} initializeDataDirectory else + + # # Check if an aborted upgrade is present.. (not working.. some users already upgraded..) + # if bashio::fs.directory_exists "${postgres_data}12"; then + # bashio::log.notice "An aborted upgrade from 12 to 14 was detected. Retrying..." + # mv ${postgres_data} ${postgres_data}_backup_2_0_1 || true + # mv ${postgres_data}12 ${postgres_data} || true + # fi + # Check if we need to upgrade from 12 to 14. if [[ $(< ${postgres_data}/PG_VERSION) == "12" ]]; then bashio::log.notice "A database upgrade is required from Postgres 12."