This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
569fbb4
commit 4153af8
Showing
6 changed files
with
107 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck shell=bash | ||
|
||
[ ! -z "$DEBUG" ] && set -x | ||
|
||
# first argument should be '14' or '15' for the version | ||
if [ "$1" == "14" ]; then | ||
echo "Starting server for PSQL 14" | ||
PSQL14=@PSQL14_BINDIR@ | ||
BINDIR="$PSQL14" | ||
elif [ "$1" == "15" ]; then | ||
echo "Starting server for PSQL 15" | ||
PSQL15=@PSQL15_BINDIR@ | ||
BINDIR="$PSQL15" | ||
else | ||
echo "Please provide a valid Postgres version (14 or 15)" | ||
exit 1 | ||
fi | ||
|
||
export PATH=$BINDIR/bin:$PATH | ||
|
||
PGSQL_SUPERUSER=@PGSQL_SUPERUSER@ | ||
MASTER_PORTNO="$2" | ||
REPLICA_PORTNO="$3" | ||
REPLICA_SLOT="replica_$RANDOM" | ||
DATDIR=$(mktemp -d) | ||
mkdir -p "$DATDIR" | ||
|
||
echo "NOTE: runing pg_basebackup for server on port $MASTER_PORTNO" | ||
echo "NOTE: using replica slot $REPLICA_SLOT" | ||
|
||
pg_basebackup -p "$MASTER_PORTNO" -h localhost -U "${PGSQL_SUPERUSER}" -X stream -C -S "$REPLICA_SLOT" -v -R -D "$DATDIR" | ||
|
||
echo "NOTE: using port $REPLICA_PORTNO for replica" | ||
echo "NOTE: using temporary directory $DATDIR for data, which will not be removed" | ||
echo "NOTE: you are free to re-use this data directory at will" | ||
echo | ||
|
||
exec postgres -p "$REPLICA_PORTNO" -D "$DATDIR" -k /tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env bash | ||
l!/usr/bin/env bash | ||
# shellcheck shell=bash | ||
|
||
[ ! -z "$DEBUG" ] && set -x | ||
|