From feb6438d39424b9f37d6c4a71952115c5bce4e30 Mon Sep 17 00:00:00 2001 From: Simon L Date: Thu, 8 Sep 2022 17:26:36 +0200 Subject: [PATCH] Revert "add a check for init-user-db.sh" Signed-off-by: szaimen --- Containers/postgresql/init-user-db.sh | 4 ---- Containers/postgresql/start.sh | 20 -------------------- 2 files changed, 24 deletions(-) diff --git a/Containers/postgresql/init-user-db.sh b/Containers/postgresql/init-user-db.sh index 5d4474a2..1f09770b 100644 --- a/Containers/postgresql/init-user-db.sh +++ b/Containers/postgresql/init-user-db.sh @@ -1,13 +1,9 @@ #!/bin/bash set -ex -touch /mnt/data/initdb.failed - psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL CREATE USER "oc_$POSTGRES_USER" WITH PASSWORD '$POSTGRES_PASSWORD' CREATEDB; ALTER DATABASE "$POSTGRES_DB" OWNER TO "oc_$POSTGRES_USER"; EOSQL -rm /mnt/data/initdb.failed - set +ex diff --git a/Containers/postgresql/start.sh b/Containers/postgresql/start.sh index b8563b27..b2e25a1b 100644 --- a/Containers/postgresql/start.sh +++ b/Containers/postgresql/start.sh @@ -18,16 +18,6 @@ if ! [ -w "$DUMP_DIR" ]; then exit 1 fi -# Check if initdb was successful -if [ -f "/mnt/data/initdb.failed" ]; then - echo "It seems like initializing the database was unsuccessful." - echo "Most likely the timezone is not a valid one." - echo "Please restore a backup, change the timezone to a valid one and try again." - echo "If this is a new instance, clean it properly by following https://github.com/nextcloud/all-in-one#how-to-properly-reset-the-instance" - echo "Afterwards feel free to try again with a valid timezone." - exit 1 -fi - # Delete the datadir once (needed for setting the correct credentials on old instances once) if ! [ -f "$DUMP_DIR/export.failed" ] && ! [ -f "$DUMP_DIR/initial-cleanup-done" ]; then set -ex @@ -68,11 +58,6 @@ if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSIO # Create new database exec docker-entrypoint.sh postgres & - # Exit if initdb failed - if [ -f "/mnt/data/initdb.failed" ]; then - exit 1 - fi - # Wait for creation while ! nc -z localhost 11000; do echo "Waiting for the database to start." @@ -139,11 +124,6 @@ trap 'true' SIGINT SIGTERM exec docker-entrypoint.sh postgres & wait $! -# Exit if initdb failed -if [ -f "/mnt/data/initdb.failed" ]; then - exit 1 -fi - # Continue with shutdown procedure: do database dump, etc. rm -f "$DUMP_FILE.temp" touch "$DUMP_DIR/export.failed"