From e0cc0ff9aff785294ae83d1e2e59f9cd14962be3 Mon Sep 17 00:00:00 2001 From: iexos Date: Thu, 15 Jun 2023 18:51:28 +0200 Subject: [PATCH] make pg upgrade more safe --- entrypoint.postgres.sh.tmpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/entrypoint.postgres.sh.tmpl b/entrypoint.postgres.sh.tmpl index da27aa8..8289575 100644 --- a/entrypoint.postgres.sh.tmpl +++ b/entrypoint.postgres.sh.tmpl @@ -1,5 +1,7 @@ #!/bin/bash +set -e + MIGRATION_MARKER=$PGDATA/migration_in_progress OLDDATA=$PGDATA/old_data NEWDATA=$PGDATA/new_data @@ -21,7 +23,7 @@ if [ -n "$DATA_VERSION" -a "$PG_MAJOR" != "$DATA_VERSION" ]; then echo "shuffling around" gosu postgres mkdir $OLDDATA $NEWDATA chmod 700 $OLDDATA $NEWDATA - mv $PGDATA/* $OLDDATA/ + mv $PGDATA/* $OLDDATA/ || true touch $MIGRATION_MARKER echo "running initdb" # abuse entrypoint script for initdb by making server error out