PostgreSQL/ci_scripts/configure-tde-server.sh
Shahid Ullah 43f4804ba5
[PG-938] Bash script to verify backup/restore functionality using pg_basebackup (#63)
* [PG-938] - Add automated bash script to verify pg_tde backup/restore functionality using pg_basebackup
* [PG-1367] Create separate script for server and tde configuration
2025-02-13 19:23:49 +05:00

38 lines
800 B
Bash

#!/bin/bash
# This script is used to configure a TDE server for testing purposes.
export TDE_MODE=1
SCRIPT_DIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1; pwd -P)"
INSTALL_DIR="$SCRIPT_DIR/../../pginst"
cd "$SCRIPT_DIR/.."
export PATH=$INSTALL_DIR/bin:$PATH
export PGDATA=$INSTALL_DIR/data
if pgrep -x "postgres" > /dev/null; then
pg_ctl -D $PGDATA stop
fi
if pgrep -x "postgres" > /dev/null; then
echo "Error: a postgres process is already running"
exit 1
fi
if [ -d $PGDATA ]; then
rm -rf $PGDATA
fi
initdb -D $PGDATA
echo "shared_preload_libraries ='pg_tde'" >> $PGDATA/postgresql.conf
pg_ctl -D $PGDATA start
createdb setup_helper
psql setup_helper < $SCRIPT_DIR/tde_setup_global.sql
echo "pg_tde.wal_encrypt = on" >> $PGDATA/postgresql.conf
pg_ctl -D $PGDATA restart