Skip to content

Commit

Permalink
Make postgres PITR blueprint compatible with postgres 12+ (#1127)
Browse files Browse the repository at this point in the history
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
  • Loading branch information
PrasadG193 committed Nov 2, 2021
1 parent 10afb94 commit 961ea96
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
4 changes: 1 addition & 3 deletions build/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ TEST_TIMEOUT="30m"
# Set default options
TEST_OPTIONS="-tags=integration -timeout ${TEST_TIMEOUT} -check.suitep ${DOP}"
# Regex to match apps to run in short mode
# TODO: PITRPostgreSQL app is incompatible with PostgreSQL:13.4.0`
# Re-enable PITRPostgreSQL app once fixed
SHORT_APPS="^PostgreSQL$|^MySQL$|Elasticsearch|^MongoDB$|Maria"
SHORT_APPS="^PostgreSQL$|^PITRPostgreSQL|^MySQL$|Elasticsearch|^MongoDB$|Maria"
# OCAPPS has all the apps that are to be tested against openshift cluster
OC_APPS3_11="MysqlDBDepConfig$|MongoDBDepConfig$|PostgreSQLDepConfig$"
OC_APPS4_4="MysqlDBDepConfig4_4|MongoDBDepConfig4_4|PostgreSQLDepConfig4_4"
Expand Down
23 changes: 13 additions & 10 deletions examples/stable/postgresql-wale/postgresql-blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,20 @@ actions:
mv ${PGDATA}/kanister-restore/* ${PGDATA}/
rm -fr ${PGDATA}/kanister-restore
# Create required configuration dir/config files
# Create empty conf.d directory
if [ ! -d $PGDATA/conf.d ]; then
mkdir $PGDATA/conf.d
fi
# Create default postgresql.conf
cp /opt/bitnami/postgresql/share/postgresql.conf.sample $PGDATA/postgresql.conf
# Create the recovery file that will apply the WAL files.
cat << EOF > "${PGDATA}"/recovery.conf
touch $PGDATA/recovery.signal
cat << EOF >> "${PGDATA}"/postgresql.conf
restore_command = 'envdir "${PGDATA}/env" wal-e --s3-prefix ${old_wale_prefix} wal-fetch "%f" "%p"'
hot_standby = off
{{- if .Options }}
{{- if .Options.pitr }}
recovery_target_time = '{{ toDate "2006-01-02T15:04:05Z" .Options.pitr | date "2006-01-02 15:04:05 GMT" }}'
Expand All @@ -232,15 +243,6 @@ actions:
EOF
sync
# Create required configuration dir/config files
# Create empty conf.d directory
if [ ! -d $PGDATA/conf.d ]; then
mkdir $PGDATA/conf.d
fi
# Create default postgresql.conf
cp /opt/bitnami/postgresql/share/postgresql.conf.sample $PGDATA/postgresql.conf
# Create default pg_hba.conf
cat << EOF > $PGDATA/pg_hba.conf
host all all 0.0.0.0/0 trust
Expand All @@ -264,6 +266,7 @@ actions:
timeline={{ toDate "2006-01-02T15:04:05.999999999Z07:00" .Time | date "2006-01-02T15-04-05" }}
wale_s3_prefix="s3://{{ .Profile.Location.Bucket }}/{{ .ArtifactsIn.manifest.KeyValue.prefix }}/${timeline}"
echo "${wale_s3_prefix}" > "${env_wal_prefix}"
rm $PGDATA/recovery.signal
- func: ScaleWorkload
name: restartPod
args:
Expand Down

0 comments on commit 961ea96

Please sign in to comment.