chore: Changes to Postgres to support readonly root FS (#30517)
This commit is contained in:
parent
2bde0d11c4
commit
51c91f8a67
|
|
@ -390,9 +390,13 @@ init_postgres() {
|
|||
echo "Checking initialized local postgres"
|
||||
POSTGRES_DB_PATH="$stacks_path/data/postgres/main"
|
||||
|
||||
if [ -e "$POSTGRES_DB_PATH/PG_VERSION" ]; then
|
||||
echo "Found existing Postgres, Skipping initialization"
|
||||
chown -R postgres:postgres "$POSTGRES_DB_PATH"
|
||||
mkdir -p "$POSTGRES_DB_PATH" "$TMP/pg-runtime"
|
||||
|
||||
# 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 -R postgres:postgres "$POSTGRES_DB_PATH" "$TMP/pg-runtime"
|
||||
|
||||
if [[ -e "$POSTGRES_DB_PATH/PG_VERSION" ]]; then
|
||||
echo "Found existing Postgres, Skipping initialization"
|
||||
else
|
||||
echo "Initializing local postgresql database"
|
||||
mkdir -p "$POSTGRES_DB_PATH"
|
||||
|
|
@ -402,6 +406,7 @@ init_postgres() {
|
|||
|
||||
# Initialize the postgres db file system
|
||||
su postgres -c "/usr/lib/postgresql/13/bin/initdb -D $POSTGRES_DB_PATH"
|
||||
sed -Ei "s,^#(unix_socket_directories =).*,\\1 '$TMP/pg-runtime'," "$POSTGRES_DB_PATH/postgresql.conf"
|
||||
|
||||
# Start the postgres server in daemon mode
|
||||
su postgres -c "/usr/lib/postgresql/13/bin/pg_ctl -D $POSTGRES_DB_PATH start"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user