postgres: always create socketDir during init if not already present (#88)

If the socketDir is in tmpfs, or if it is deleted by some other process, we would want the socketDir to be created, if not already present, on restarts.
This commit is contained in:
Shivaraj B H 2024-01-31 18:47:52 +05:30 committed by GitHub
parent 44b50d51ec
commit 9b806b53f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -94,13 +94,19 @@ in
fi fi
# Setup config # Setup config
echo "Setting up postgresql.conf"
cp ${configFile} "$PGDATA/postgresql.conf" cp ${configFile} "$PGDATA/postgresql.conf"
# Create socketDir if it doesn't exist
if [ ! -d "${config.socketDir}" ]; then
echo "Creating socket directory"
mkdir -p "${config.socketDir}"
fi
if [[ "$POSTGRES_RUN_INITIAL_SCRIPT" = "true" ]]; then if [[ "$POSTGRES_RUN_INITIAL_SCRIPT" = "true" ]]; then
echo echo
echo "PostgreSQL is setting up the initial database." echo "PostgreSQL is setting up the initial database."
echo echo
PGHOST=$(mkdir -p "${config.socketDir}" && mktemp -d "$(readlink -f "${config.socketDir}")/pg-init-XXXXXX") PGHOST=$(mktemp -d "$(readlink -f "${config.socketDir}")/pg-init-XXXXXX")
export PGHOST export PGHOST
function remove_tmp_pg_init_sock_dir() { function remove_tmp_pg_init_sock_dir() {