From a10616ec912b60f8c9abe594381d876fc7671b0a Mon Sep 17 00:00:00 2001 From: Sumesh Pradhan Date: Mon, 19 Jun 2023 15:28:47 +0530 Subject: [PATCH] fix: Embedded postgres file owner fix (#24601) Fixes https://github.com/appsmithorg/appsmith/issues/24358 where postgres system files owner is updated with mongodb user on updating Appsmith. Tested manually by updating v1.9.22 to nightly. (cherry picked from commit 1e33a6c5dc4618986d43bcadc23b4079b8596559) --- deploy/docker/entrypoint.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/deploy/docker/entrypoint.sh b/deploy/docker/entrypoint.sh index 697188bda6..685a056df1 100644 --- a/deploy/docker/entrypoint.sh +++ b/deploy/docker/entrypoint.sh @@ -345,15 +345,16 @@ init_postgres() { if [ -e "$POSTGRES_DB_PATH/PG_VERSION" ]; then echo "Found existing Postgres, Skipping initialization" + chown -R postgres:postgres "$POSTGRES_DB_PATH" else echo "Initializing local postgresql database" - mkdir -p $POSTGRES_DB_PATH + mkdir -p "$POSTGRES_DB_PATH" # Postgres does not allow it's server to be run with super user access, we use user postgres and the file system owner also needs to be the same user postgres - chown postgres:postgres $POSTGRES_DB_PATH + chown postgres:postgres "$POSTGRES_DB_PATH" # Initialize the postgres db file system - su -m postgres -c "/usr/lib/postgresql/13/bin/initdb -D $POSTGRES_DB_PATH" + su postgres -c "/usr/lib/postgresql/13/bin/initdb -D $POSTGRES_DB_PATH" # Start the postgres server in daemon mode su postgres -c "/usr/lib/postgresql/13/bin/pg_ctl -D $POSTGRES_DB_PATH start"