add files for building containter artifacts
Lifted in large parts from version 9.5 of the SCL postgresql container. https://github.com/sclorg/postgresql-container
This commit is contained in:
parent
8161155280
commit
fa7e7e5dec
15 changed files with 830 additions and 0 deletions
36
root/usr/bin/run-postgresql-slave
Executable file
36
root/usr/bin/run-postgresql-slave
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
export ENABLE_REPLICATION=true
|
||||
|
||||
set -eu
|
||||
export_vars=$(cgroup-limits) ; export $export_vars
|
||||
|
||||
source "$CONTAINER_SCRIPTS_PATH"/common.sh
|
||||
|
||||
set_pgdata
|
||||
|
||||
function initialize_replica() {
|
||||
echo "Initializing PostgreSQL slave ..."
|
||||
# TODO: Validate and reuse existing data?
|
||||
rm -rf $PGDATA
|
||||
PGPASSWORD="${POSTGRESQL_MASTER_PASSWORD}" pg_basebackup -x --no-password --pgdata ${PGDATA} --host=${MASTER_FQDN} --port=5432 -U "${POSTGRESQL_MASTER_USER}"
|
||||
|
||||
# PostgreSQL recovery configuration.
|
||||
generate_postgresql_recovery_config
|
||||
cat >> "$PGDATA/recovery.conf" <<EOF
|
||||
|
||||
# Custom OpenShift recovery configuration:
|
||||
include '${POSTGRESQL_RECOVERY_FILE}'
|
||||
EOF
|
||||
}
|
||||
|
||||
check_env_vars
|
||||
generate_passwd_file
|
||||
generate_postgresql_config
|
||||
|
||||
wait_for_postgresql_master
|
||||
export MASTER_FQDN=$(postgresql_master_addr)
|
||||
initialize_replica
|
||||
|
||||
unset_env_vars
|
||||
exec postgres "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue