aboutsummaryrefslogtreecommitdiffstats
path: root/pgaas/src/stage/opt/app/pgaas/etc
diff options
context:
space:
mode:
Diffstat (limited to 'pgaas/src/stage/opt/app/pgaas/etc')
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/common-db-tasks43
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/create-cdf-master54
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/create-cdf-secondary62
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/create-db-backup38
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/create-db-master72
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/create-db-secondary122
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/create-extensions53
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/create-repmgr-user40
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/create-ssh-master40
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/create-ssh-secondary102
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/create_dcae_rotate.sql21
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/dcae_admin_db.cfg2
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/do-post-install-config157
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/do-post-install-post35
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/do-post-install-prep259
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/do-post-install-tools51
-rwxr-xr-xpgaas/src/stage/opt/app/pgaas/etc/do-pre-rm.prep17
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/gen-pgpass28
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/gen-recovery.conf51
-rwxr-xr-xpgaas/src/stage/opt/app/pgaas/etc/gen-repmgr.conf63
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/lock-and-create-db-backup37
-rwxr-xr-xpgaas/src/stage/opt/app/pgaas/etc/makecerts98
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/makefile44
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/reset-db-secondary59
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/ssleay.cnf33
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/start-db33
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/update-db-master63
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/update-db-secondary95
-rw-r--r--pgaas/src/stage/opt/app/pgaas/etc/update-postgres-user34
29 files changed, 0 insertions, 1806 deletions
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/common-db-tasks b/pgaas/src/stage/opt/app/pgaas/etc/common-db-tasks
deleted file mode 100644
index 517fabd..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/common-db-tasks
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$DBROOT" ] || die "DBROOT is not set"
-[ -n "$CFGDIR" ] || die "CFGDIR is not set"
-
-# set up ~/.pgpass
-$CFGDIR/etc/gen-pgpass
-# set up repmgr.conf
-$CFGDIR/etc/gen-repmgr.conf
-
-# We don't really need to save pwd.cfg anymore since we are now forcing the password.
-# PWDCFG=$DBROOT/../pgaas/pwd.cfg
-# egrep '^Global_Title|^postgres|^repmgr' ${INSTALL_ROOT}/opt/app/cdf/lib/cdf.cfg > $PWDCFG
-
-cd $CFGDIR/main || die "Cannot cd $CFGDIR/main"
-
-sed -e "s!%CFGDIR%!$CFGDIR!" < postgresql.conf.orig > postgresql.conf || die "Cannot cp postgresql.conf"
-sed -e "s!%CFGDIR%!$CFGDIR!" < pg_hba.conf.orig > pg_hba.conf || die "Cannot cp pg_hba.conf"
-
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/create-cdf-master b/pgaas/src/stage/opt/app/pgaas/etc/create-cdf-master
deleted file mode 100644
index dcbbf46..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/create-cdf-master
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-set -x
-
-DBROOT=/dbroot/pgdata/main
-CDFCFG=${INSTALL_ROOT}/opt/app/cdf/lib/cdf.cfg
-
-# We don't really need to save pwd.cfg anymore since we are now forcing the password.
-# PWDCFG=$DBROOT/../pgaas/pwd.cfg
-# if the DB already exists in Cinder storage, grab the password from there for use elsewhere
-# if [ -s $PWDCFG -a $( egrep '^Global_Title' < $PWDCFG ) -eq 1 ]
-# then
-# TMP=$(mktemp /tmp/tmp.ccm.XXXXXXXXXX)
-# trap 'rm -f $TMP' 0 1 2 3 15
-# egrep -v '^Global_Title|^postgres|^repmgr' $CDFCFG > $TMP
-# egrep '^Global_Title|^postgres|^repmgr' $PWDCFG | cat $TMP - > $CDFCFG
-# fi
-
-# generate a 64 hex random value (256 bits of randomness) for the passwords
-if grep '^postgres' $CDFCFG > /dev/null
-then :
-else
- val2=
- # if .pgpass has a password for postgres, keep it
- # *:*:*:postgres:4069b81b26cb01e064e242611c36e67a50f11a3d0dbe1f05d9b9aaedf2cadab1
- PGPASS=~postgres/.pgpass
- if [ -f $PGPASS ]
- then val2=$( grep :postgres: $PGPASS | sed 's/^.*://' )
- fi
- if [ -z "$val2" ]
- then
- val2=$(dd if=/dev/urandom count=1 ibs=32 2>/dev/null | od -x -w1000 | sed -e 's/^0000000 //' -e 's/ //g' -e 1q)
- fi
- echo "ENCRYPTME.AES.postgres=$val2" | ${INSTALL_ROOT}/opt/app/cdf/bin/setencryptedvalues >> $CDFCFG
-fi
-if grep '^repmgr' $CDFCFG > /dev/null
-then :
-else
- val2=$(dd if=/dev/urandom count=1 ibs=32 2>/dev/null | od -x -w1000 | sed -e 's/^0000000 //' -e 's/ //g' -e 1q)
- echo "ENCRYPTME.AES.repmgr=$val2" | ${INSTALL_ROOT}/opt/app/cdf/bin/setencryptedvalues >> $CDFCFG
-fi
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/create-cdf-secondary b/pgaas/src/stage/opt/app/pgaas/etc/create-cdf-secondary
deleted file mode 100644
index 78c35f9..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/create-cdf-secondary
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$MASTER" ] || die "MASTER is not set"
-
-umask 077
-TMP=$( mktemp /tmp/tmp.ccs1.XXXXXXXXXX )
-trap 'rm -f $TMP' 0 1 2 3 15
-
-bwget()
-{
- ${INSTALL_ROOT}/opt/app/pgaas/bin/pgwget --progress=dot:giga "$@"
-}
-
-done=
-max=40
-for s in `seq $max`
-do
- echo "$s of $max: Waiting for master $MASTER to send cdf.cfg"
- bwget -O$TMP http://$MASTER:8000/getcdf/`hostname -f`
- ls -l $TMP
- if [ -s $TMP ]
- then
- msg=$(cat $TMP)
- case "$msg" in
- OK* )
- echo "Received cdf.cfg"
- done=yes
- break
- ;;
- * ) echo "Received invalid cdf: $msg"
- ;;
- esac
- fi
- rm -f $TMP
- sleep 15
-done
-[ "$done" = "yes" ] || die "Master did not send cdf.cfg"
-
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/create-db-backup b/pgaas/src/stage/opt/app/pgaas/etc/create-db-backup
deleted file mode 100644
index d6e856b..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/create-db-backup
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-if [ -d /opt/app/postgresql-9.5.2 ]
-then PGDIR=/opt/app/postgresql-9.5.2
-elif [ -d /usr/lib/postgresql/9.6 ]
-then PGDIR=/usr/lib/postgresql/9.6
-elif [ -d /usr/lib/postgresql/9.5 ]
-then PGDIR=/usr/lib/postgresql/9.5
-else echo PostgreSQL bin directory not found
-fi
-
-$PGDIR/bin/psql <<-EOF
- SELECT pg_start_backup('backup');
-EOF
-
-cd /dbroot/pgdata &&
-{
- find main | grep -v main/pg_xlog/
- find main/pg_xlog -type d
-} | cpio -oc | gzip > main.cpio.gz.$$ && mv main.cpio.gz.$$ main.cpio.gz
-
-$PGDIR/bin/psql <<-EOF
- SELECT pg_stop_backup();
-EOF
-echo /dbroot/pgdata/main.cpio.gz created
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/create-db-master b/pgaas/src/stage/opt/app/pgaas/etc/create-db-master
deleted file mode 100644
index eb8fca3..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/create-db-master
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-# create a master database
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$PGDIR" ] || die "PGDIR is not set"
-[ -n "$DBROOT" ] || die "DBROOT is not set"
-[ -n "$CFGDIR" ] || die "CFGDIR is not set"
-
-cd $CFGDIR/main || die "Cannot cd $CFGDIR/main"
-
-PATH=${INSTALL_ROOT}/opt/app/pgaas/bin:$CFGDIR/etc:$PGDIR/bin:$PATH
-
-umask 077
-TMP=$(mktemp /tmp/tmp.cdm.XXXXXXXXXX)
-trap 'rm -f $TMP' 0 1 2 3 15
-
-rm -rf $DBROOT/* # initdb fails if the directory is not totally empty
-pswd=$( ${INSTALL_ROOT}/opt/app/cdf/bin/getpropvalue -x -n postgres )
-echo "$pswd" > $TMP
-$PGDIR/bin/initdb -D $DBROOT --pwfile=$TMP
-rm -f $TMP
-
-$CFGDIR/etc/start-db
-sleep 30
-
-# create temporal tables and other extensions, if needed
-$CFGDIR/etc/create-extensions
-
-# create repmgr user/db, if needed
-$CFGDIR/etc/create-repmgr-user
-
-sleep 10
-
-# register as master
-repmgr -f $CFGDIR/main/repmgr.conf master register
-echo repmgr ret=$?
-
-sleep 10
-
-# start repmgrd
-# start repmgrd (verbose logging for testing)
-umask 07
-repmgrd -f $CFGDIR/main/repmgr.conf -d --verbose
-echo repmgrd ret=$?
-# start repmgrd (normal logging)
-# repmgrd -f $CFGDIR/main/repmgr.conf -d
-
-
-# NO LONGER NEEDED $CFGDIR/etc/create-db-backup
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/create-db-secondary b/pgaas/src/stage/opt/app/pgaas/etc/create-db-secondary
deleted file mode 100644
index a0cc8e3..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/create-db-secondary
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-# create a secondary database
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$MASTER" ] || die "MASTER is not set"
-[ -n "$PGDIR" ] || die "PGDIR is not set"
-[ -n "$DBROOT" ] || die "DBROOT is not set"
-[ -n "$CFGDIR" ] || die "CFGDIR is not set"
-
-cd $CFGDIR/main || die "Cannot cd $CFGDIR/main"
-
-PATH=${INSTALL_ROOT}/opt/app/pgaas/bin:$CFGDIR/etc:$PGDIR/bin:$PATH
-
-bwget()
-{
- ${INSTALL_ROOT}/opt/app/pgaas/bin/pgwget --progress=dot:giga "$@"
-}
-
-umask 077
-TMP=$(mktemp /tmp/tmp.cds1.XXXXXXXXXX)
-TMP2=$(mktemp /tmp/tmp.cds2.XXXXXXXXXX)
-trap 'rm -f $TMP $TMP2' 0 1 2 3 15
-
-# wait until master DB is active and has repmgr available
-max=40
-for s in `seq $max`
-do
- echo "$s of $max: Asking master $MASTER if repmgr is ready"
- bwget -O$TMP http://$MASTER:8000/hasrepmgr
- ls -l $TMP
- if [ -s $TMP ]
- then
- msg=$(cat $TMP)
- case $msg in
- OK* )
- echo "Master has repmgr ready"
- done=yes
- break
- ;;
- * )
- echo "Master does not have repmgr ready, msg=$msg"
- ;;
- esac
- fi
- rm -f $TMP
- sleep 15
-done
-[ "$done" = "yes" ] || die "Master never had repmgr available"
-
-
-# clone database from master
-
-# make sure /dbroot/pgdata/main is empty
-mv $DBROOT $DBROOT-$(date +%Y%m%d%H%M%S)
-mkdir -p $DBROOT
-# rm -rf $DBROOT/*
-
-repmgr -v -h $MASTER -U repmgr -d repmgr -D $DBROOT -f $CFGDIR/main/repmgr.conf --ignore-external-config-files standby clone
-
-if [ ! -f $DBROOT/PG_VERSION ]
-then
- umask 022
- cat /opt/logs/dcae/postgresql/server/repmgr.log >> /tmp/pgaas-failures
- die repmgr clone failed
-fi
-
-$CFGDIR/etc/start-db
-
-sleep 10
-
-# register as standby
-repmgr -f $CFGDIR/main/repmgr.conf standby register
-echo repmgr ret=$?
-sleep 10
-
-# start repmgrd
-# start repmgrd (verbose logging for testing)
-umask 07
-
-# wait until repmgrd starts up
-max=20
-REPLOG=/opt/logs/dcae/postgresql/server/repmgr.log
-done=no
-for s in `seq $max`
-do
- cat $REPLOG > $TMP
- repmgrd -f $CFGDIR/main/repmgr.conf -d --verbose
- # start repmgrd (normal logging)
- # repmgrd -f $CFGDIR/main/repmgr.conf -d
- echo repmgrd ret=$?
- sleep 5
- diff $TMP $REPLOG | grep "ERROR.*terminating" > $TMP2
- if [ -s "$TMP2" ]
- then cat "$TMP2"
- else done=yes; break
- fi
- sleep 10
-done
-[ "$done" = "yes" ] || die "Secondary never started repmgrd"
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/create-extensions b/pgaas/src/stage/opt/app/pgaas/etc/create-extensions
deleted file mode 100644
index 70306a6..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/create-extensions
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$PGDIR" ] || die "PGDIR is not set"
-
-PATH=${INSTALL_ROOT}/opt/app/pgaas/bin:$PGDIR/bin:$PATH
-
-TMP=$(mktemp /tmp/tmp.ce.XXXXXXXXXX)
-trap 'rm -f $TMP' 0 1 2 3 15
-
-echo "select datname from pg_database;" | psql --tuples-only | sed -e 's/^ *//' -e '/^$/d' -e '/^template0$/d' -e '/^repmgr$/d' > $TMP
-
-for db in $(< $TMP)
-do
- # enable temporal tables for use
- if [ -f /opt/app/postgresql-9.5.2/lib/temporal_tables.so ]
- then
- psql --dbname=$db <<-EOF
- CREATE EXTENSION temporal_tables;
- EOF
- else
- echo "$0: temporal_tables extension is not installed"
- fi
-
- # and other extensions
- psql --dbname=$db <<-EOF
- CREATE EXTENSION hstore;
- CREATE EXTENSION pgcrypto;
- EOF
-done
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/create-repmgr-user b/pgaas/src/stage/opt/app/pgaas/etc/create-repmgr-user
deleted file mode 100644
index 35ca401..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/create-repmgr-user
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$PGDIR" ] || die "PGDIR is not set"
-
-PATH=${INSTALL_ROOT}/opt/app/pgaas/bin:$PGDIR/bin:${INSTALL_ROOT}/opt/app/cdf/bin:$PATH
-pswd=$( getpropvalue -x -n repmgr )
-
-# note: The "pgaas" in "repmgr_pgaas" must match the cluster name used in repmgr.conf
-
-psql <<-EOF
- CREATE ROLE repmgr SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;
- DROP DATABASE repmgr;
- CREATE DATABASE repmgr OWNER repmgr;
- ALTER USER repmgr PASSWORD '$pswd';
- ALTER USER repmgr SET search_path TO repmgr_pgaas, "\$user", public;
-EOF
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/create-ssh-master b/pgaas/src/stage/opt/app/pgaas/etc/create-ssh-master
deleted file mode 100644
index 5565041..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/create-ssh-master
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-umask 077
-mkdir -p ~postgres/.ssh
-chmod 700 ~postgres/.ssh
-
-PGAASDIR=/dbroot/pgdata/pgaas
-if [ -f $PGAASDIR/id_rsa.pub -a -f $PGAASDIR/id_rsa -a $PGAASDIR/authorized_keys ]
-then
- cp -p $PGAASDIR/id_rsa.pub $PGAASDIR/id_rsa $PGAASDIR/authorized_keys ~postgres/.ssh
-else
- ssh-keygen -t rsa -N '' -f ~postgres/.ssh/id_rsa
- cp -p ~postgres/.ssh/id_rsa.pub ~postgres/.ssh/authorized_keys
- cp -p ~postgres/.ssh/id_rsa ~postgres/.ssh/id_rsa.pub ~postgres/.ssh/authorized_keys $PGAASDIR
-fi
-
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/create-ssh-secondary b/pgaas/src/stage/opt/app/pgaas/etc/create-ssh-secondary
deleted file mode 100644
index 2121eb3..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/create-ssh-secondary
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-bwget()
-{
- ${INSTALL_ROOT}/opt/app/pgaas/bin/pgwget --progress=dot:giga "$@"
-}
-
-[ -n "$MASTER" ] || die "MASTER is not set"
-
-
-
-umask 077
-TMP=$(mktemp /tmp/tmp.css1.XXXXXXXXXX)
-TMP2=$(mktemp /tmp/tmp.css2.XXXXXXXXXX)
-trap 'rm -f $TMP $TMP2' 0 1 2 3 15
-
-# do we have the keys already?
-if [ -f $PGAASDIR/id_rsa.pub -a -f $PGAASDIR/id_rsa -a $PGAASDIR/authorized_keys ]
-then
- mkdir -p ~postgres/.ssh
- chmod 700 ~postgres/.ssh
- cp -p $PGAASDIR/id_rsa.pub $PGAASDIR/id_rsa $PGAASDIR/authorized_keys ~postgres/.ssh
-else
- # no? copy them from the master
- done=
- max=40
- for s in `seq $max`
- do
- echo "$s of $max: Waiting for master $MASTER to come online and send its public key"
- bwget -O$TMP http://$MASTER:8000/getpubkey
- ls -l $TMP
- if [ -s $TMP ]
- then
- msg=$(cat $TMP)
- case "$msg" in
- ssh-rsa* )
- echo "Received public key"
- mkdir -p ~postgres/.ssh
- chmod 700 ~postgres/.ssh
- cp -p $TMP ~postgres/.ssh/authorized_keys
- done=yes
- break
- ;;
- * ) echo "Received invalid public key: $msg"
- ;;
- esac
- else
- echo "No key available yet"
- fi
- rm -f $TMP
- sleep 15
- done
- [ "$done" = "yes" ] || die "Unable to get key from $MASTER"
-
- done=
- max=40
- for s in `seq $max`
- do
- echo "$s of $max: Asking for master $MASTER to send remaining ssh files"
- bwget -O$TMP2 http://$MASTER:8000/getssh/`hostname -f`
- ls -l $TMP2
- if [ -s $TMP2 ]
- then
- msg=$(cat $TMP2)
- case "$msg" in
- OK* ) echo "Master has sent the remaining ssh keys"
- done=yes
- break
- ;;
- * ) echo "No ssh keys yet: $msg"
- ;;
- esac
- fi
- rm -f $TMP2
- sleep 15
- done
- [ "$done" = "yes" ] || die "Master did not send ssh keys"
-fi
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/create_dcae_rotate.sql b/pgaas/src/stage/opt/app/pgaas/etc/create_dcae_rotate.sql
deleted file mode 100644
index 2200362..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/create_dcae_rotate.sql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this code except in compliance
- with the License. You may obtain a copy of the License
- at http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied. See the License for the specific language governing
- permissions and limitations under the License.
-
-*/
-create table dcae_rotate (
- basetablename varchar(129) not null, /* the base table name to derive other tables from */
- columnname varchar(64) not null, /* which column name to use as the datestamp */
- count int, /* how many periods to keep around */
- period varchar(20) /* one of 'week', 'month' or 'day' */
-);
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/dcae_admin_db.cfg b/pgaas/src/stage/opt/app/pgaas/etc/dcae_admin_db.cfg
deleted file mode 100644
index 139597f..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/dcae_admin_db.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/do-post-install-config b/pgaas/src/stage/opt/app/pgaas/etc/do-post-install-config
deleted file mode 100644
index 87689ef..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/do-post-install-config
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-echo "================ $0 ================"
-id
-set -x
-
-die()
-{
- echo "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$CFGDIR" ] || die "CFGDIR is not set"
-[ -n "$ONAP" ] || die "ONAP is not set"
-[ -n "$NOTONAP" ] || die "NOTONAP is not set"
-
-if [ -d ${INSTALL_ROOT}/opt/app/postgresql-9.5.2 ]
-then PGDIR=${INSTALL_ROOT}/opt/app/postgresql-9.5.2
-elif [ -d ${INSTALL_ROOT}/usr/lib/postgresql/9.6 ]
-then PGDIR=${INSTALL_ROOT}/usr/lib/postgresql/9.6
-elif [ -d ${INSTALL_ROOT}/usr/lib/postgresql/9.5 ]
-then PGDIR=${INSTALL_ROOT}/usr/lib/postgresql/9.5
-else die PostgreSQL bin directory not found
-fi
-export PGDIR
-export DBROOT=/dbroot/pgdata/main
-export PATH=$PATH:${INSTALL_ROOT}/opt/app/pgaas/bin
-
-$CFGDIR/etc/makecerts
-
-cat $CFGDIR/lib/profile.additions >> ~postgres/.profile
-
-# Determine which system is the master.
-# For central, we look first in /var/config/DCAE/chef/*-postgres.conf.
-# If we don't find that, we look at the pgnodes list and pick the first one.
-# For edge, we ignore /var/config/DCAE/chef/*-postgres.conf and go directly to the pgnodes list.
-# Each edge site has its own master.
-clustertype=$( ${INSTALL_ROOT}/opt/app/cdf/bin/getpropvalue -n cluster )
-ismaster=no
-
-case $clustertype in
- central )
- CONFDIR1=/var/config/DCAE/chef
- CONFDIR2=/tmp
- CONFCOUNT1=$(ls $CONFDIR1/*-postgres.conf 2>/dev/null | wc -l)
- CONFCOUNT2=$(ls $CONFDIR2/*-postgres.conf 2>/dev/null | wc -l)
- CONFCOUNTBOTH=$(ls $CONFDIR1/*-postgres.conf $CONFDIR2/*-postgres.conf 2>/dev/null | wc -l)
-
- if [ $CONFCOUNTBOTH -eq 0 ]
- then
- # not OpenDCAE/ONAP, but it's better if we STILL require a pgaas-postgres.conf file.
- die "No xyz-postgres.conf files were found in $CONFDIR1 or $CONFDIR2"
- # Alternatively, the following code MIGHT work:
- # ismaster=yes
- # PGNODES=$( ${INSTALL_ROOT}/opt/app/cdf/bin/getpropvalue -n pgnodes )
- # export MASTER=$( gen-repmgr-info -n "$PGNODES" -m )
- else
- if [ $CONFCOUNT1 -eq 1 ]
- then CONFDIR=$CONFDIR1
- elif [ $CONFCOUNT2 -eq 1 ]
- then CONFDIR=$CONFDIR2
- else CONFDIR=
- fi
- if [ -n "$CONFDIR" ]
- then # OpenDCAE/ONAP
- # We need the value of master from xyz-postgres.conf
- umask 077
- TMP=$(mktemp /tmp/tmp.pi1.XXXXXXXXXX)
- trap 'rm -f $TMP' 0 1 2 3 15
- cat $CONFDIR/*-postgres.conf |
- sed -e 's/ *: */="/' -e 's/[ ]*$/"/' -e 's/=""/="/' -e 's/""$/"/' > $TMP
- . $TMP
- case "$master" in
- `hostname` | `hostname -f` ) ismaster=yes ;;
- *?* ) ismaster=no ;;
- '' ) die "master is not set in $CONF" ;;
- esac
- PGNODES=$( ${INSTALL_ROOT}/opt/app/cdf/bin/getpropvalue -n pgnodes )
- export MASTER=$( gen-repmgr-info -n "$PGNODES" -M "$master" )
- [ -n "$MASTER" ] || die "Cannot determine master system. $CONF has '$master' (from env.yaml), which cannot be found in pgnodes."
- else
- if [ $CONFCOUNT1 -gt 1 ]
- then die "More than one postgres.conf was found in $CONFDIR1: $(ls $CONFDIR1/*-postgres.conf 2>&1)"
- elif [ $CONFCOUNT2 -gt 1 ]
- then die "More than one postgres.conf was found in $CONFDIR2: $(ls $CONFDIR2/*-postgres.conf 2>&1)"
- fi
- fi
- fi
- ;;
- edge )
- host=$( hostname -f )
- PGNODES=$( ${INSTALL_ROOT}/opt/app/cdf/bin/getpropvalue -n pgnodes )
- export MASTER=$( gen-repmgr-info -n "$PGNODES" -C $host )
- case $MASTER in
- '' ) die "Cannot determine master system. Does cdf.cfg have pgnodes= in it? Is $host listed as a site?" ;;
- DEFAULT ) ismaster=yes MASTER=$host ;;
- esac
- ;;
-esac
-
-ssh_and_cdf_okay=no
-
-if pgrep postgres
-then pkill postgres
-fi
-
-case $ismaster in
- yes ) # master
- $CFGDIR/etc/create-ssh-master &&
- $CFGDIR/etc/create-cdf-master &&
- ssh_and_cdf_okay=yes
- ;;
-
- no ) # secondary
- $CFGDIR/etc/create-ssh-secondary &&
- $CFGDIR/etc/create-cdf-secondary &&
- touch $CFGDIR/lib/ignore-database-reconfiguration # prevent dcae_admin_db.py from looking at json DB reconfigurations &&
- ssh_and_cdf_okay=yes
- ;;
-esac
-
-[ "$ssh_and_cdf_okay" = yes ] || die "Could not set up ssh or cdf"
-
-$CFGDIR/etc/common-db-tasks
-# check if we have a database already
-if [ ! -s $DBROOT/PG_VERSION ]
-then
- # need to create it
- case $ismaster in
- yes ) $CFGDIR/etc/create-db-master ;;
- no ) $CFGDIR/etc/create-db-secondary ;;
- esac
-else
- # need to update it
- case $ismaster in
- yes ) $CFGDIR/etc/update-db-master ;;
- no )
- $CFGDIR/etc/create-db-secondary # use repmgr clone even if secondary previously existed
- # $CFGDIR/etc/update-db-secondary
- ;;
- esac
-fi
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/do-post-install-post b/pgaas/src/stage/opt/app/pgaas/etc/do-post-install-post
deleted file mode 100644
index 66eea14..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/do-post-install-post
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-echo "================ $0 ================"
-id
-set -x
-
-die()
-{
- echo "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-################ nothing needs to be done
-BIN=/opt/app/pgaas/bin
-
-[ -d $BIN ] || die "Cannot find $BIN"
-
-PATH=$PATH:$BIN
-
-pgaas-verify-install
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/do-post-install-prep b/pgaas/src/stage/opt/app/pgaas/etc/do-post-install-prep
deleted file mode 100644
index 02eabef..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/do-post-install-prep
+++ /dev/null
@@ -1,259 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-echo "================ $0 ================"
-id
-set -x
-
-die()
-{
- echo "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-umask 022
-
-TMP=$( mktemp /tmp/pgprep.$$.XXXXXXXXXX )
-trap 'rm -f $TMP' 0 1 2 3 15
-
-if $ONAP
-then INSTALL_ROOT=
-fi
-
-
-# There needs to be a configuration file passed in, named something like pgaas-postgres.conf
-# and stored either in /var/config/DCAE/chef or /tmp. We need at least one, and there cannot
-# be more than one within the directory. (If one exists in both /var/config and /tmp, we trust
-# the one in /var/config.)
-#
-# The variable "master" needs to be in xyz-postgres.conf. It should be the hostname or
-# hostname -f value of the VM that is the initial PG master.
-# In addition, the following values could be in postgres.conf or
-# already in the environment:
-# DRTR_NODE_KSTOREFILE: /opt/app/dcae-certificate/keystore.jks
-# DRTR_NODE_KSTOREPASS: "No Certificate"
-# DRTR_NODE_PVTKEYPASS: "No Certificate"
-# PG_NODES : uiopmno1qwpstg00.research.example.com|asbczw1vepstg00.dcae.simpledemo.onap.org
-# PG_JAVA_HOME : /opt/app/java/jdk/jdk170
-# PG_CLUSTER : global/central | site/edge (pick one)
-
-CONFDIR1=/var/config/DCAE/chef
-CONFDIR2=/tmp
-CONFCOUNT1=$(ls $CONFDIR1/*-postgres.conf 2>/dev/null | wc -l)
-CONFCOUNT2=$(ls $CONFDIR2/*-postgres.conf 2>/dev/null | wc -l)
-CONFCOUNTBOTH=$(ls $CONFDIR1/*-postgres.conf $CONFDIR2/*-postgres.conf 2>/dev/null | wc -l)
-
-if [ $CONFCOUNTBOTH -eq 0 ]
-then
- die "No xyz-postgres.conf files were found in $CONFDIR1 or $CONFDIR2"
-else
- if [ $CONFCOUNT1 -eq 1 ]
- then CONFDIR=$CONFDIR1
- elif [ $CONFCOUNT2 -eq 1 ]
- then CONFDIR=$CONFDIR2
- else CONFDIR=
- fi
- if [ -n "$CONFDIR" ]
- then # OpenDCAE/ONAP
- cat $CONFDIR/*-postgres.conf |
- sed -e 's/ *: */="/' -e 's/[ ]*$/"/' -e 's/=""/="/' -e 's/""$/"/' > $TMP
- . $TMP
- else
- if [ $CONFCOUNT1 -gt 1 ]
- then die "More than one postgres.conf was found in $CONFDIR1: $(ls $CONFDIR1/*-postgres.conf 2>&1)"
- elif [ $CONFCOUNT2 -gt 1 ]
- then die "More than one postgres.conf was found in $CONFDIR2: $(ls $CONFDIR2/*-postgres.conf 2>&1)"
- fi
- fi
-fi
-
-[ -n "$PG_NODES" ] || die "PG_NODES is not set"
-[ -n "$PG_CLUSTER" ] || die "PG_CLUSTER is not set"
-[ -n "$DRTR_NODE_KSTOREFILE" ] || die "DRTR_NODE_KSTOREFILE is not set"
-[ -n "$DRTR_NODE_KSTOREPASS" ] || die "DRTR_NODE_KSTOREPASS is not set"
-[ -n "$DRTR_NODE_PVTKEYPASS" ] || die "DRTR_NODE_PVTKEYPASS is not set"
-
-# create various directories with proper permissions
-mkdir -p ${INSTALL_ROOT}/dbroot/pgdata/main \
- ${INSTALL_ROOT}/dbroot/pgdata/pgaas \
- ${INSTALL_ROOT}/dbroot/pglogs/main \
- ${INSTALL_ROOT}/var/run/postgresql \
- ${INSTALL_ROOT}/opt/logs/dcae/postgresql/init \
- ${INSTALL_ROOT}/opt/logs/dcae/postgresql/server \
- ${INSTALL_ROOT}/opt/logs/dcae/postgresql/idns
-chmod 700 ${INSTALL_ROOT}/dbroot/pgdata/pgaas
-chmod 700 ${INSTALL_ROOT}/dbroot/pglogs
-chmod 700 ${INSTALL_ROOT}/dbroot/pgdata/main
-
-if $ONAP
-then
- if [ -d /var/lib/postgresql/9.5 ]
- then VER=9.5
- elif [ -d /var/lib/postgresql/9.6 ]
- then VER=9.6
- else die "Cannot determine version of PostgreSQL. Looking for /var/lib/postgresql/9.[56]."
- fi
- mv /var/lib/postgresql/$VER/main /var/lib/postgresql/$VER/main.sv
- ln -s /dbroot/dbdata/main /var/lib/postgresql/$VER/main
-
- mv /etc/postgresql/$VER/main /etc/postgresql/$VER/main.sv
- ln -s /opt/app/pgaas/main /etc/postgresql/$VER/main
-
-fi
-
-chown -R postgres:postgres ${INSTALL_ROOT}/dbroot ${INSTALL_ROOT}/var/run/postgresql ${INSTALL_ROOT}/opt/logs/dcae/postgresql
-
-chmod 711 ~postgres
-if [ -d /opt/app/postgresql-9.5.2 ]
-then PGDIR=/opt/app/postgresql-9.5.2
-elif [ -d /usr/lib/postgresql/9.6 ]
-then PGDIR=/usr/lib/postgresql/9.6
-elif [ -d /usr/lib/postgresql/9.5 ]
-then PGDIR=/usr/lib/postgresql/9.5
-else echo PostgreSQL bin directory not found 1>&2; exit 1
-fi
-chmod 751 $PGDIR/bin
-
-# fix up the CDF package so that it works
-if [ ! -L /opt/cdf ]
-then rm -f /opt/cdf; ln -sf /opt/app/cdf /opt/cdf
-fi
-
-PATH=${INSTALL_ROOT}/opt/app/pgaas/bin:$PATH
-
-# and save some values within
-(
- echo "allpgnodes=\"$PG_NODES\""
- case "$PG_CLUSTER" in
- global | central )
- cnodes=$( gen-repmgr-info -n "$PG_NODES" -p )
- echo "pgnodes=\"$cnodes\""
- echo "cluster=central"
- shanodes=$( gen-repmgr-info -n "$PG_NODES" -P )
- ;;
- site | edge )
- HOSTNAME=$( hostname -f )
- lnodes=$( gen-repmgr-info -n "$PG_NODES" -e $HOSTNAME )
- echo "pgnodes=\"$lnodes\""
- if [ -z "$lnodes" ]
- then die "Cannot determine the name of the system. hostname -f ($HOSTNAME) is not found in PG_NODES ($PG_NODES)"
- fi
- shanodes=$( gen-repmgr-info -n "$PG_NODES" -E $HOSTNAME )
- echo "cluster=edge"
- ;;
- * ) die "Cannot determine what type of cluster this is. PG_CLUSTER should be either 'global/central' or 'site/edge'" ;;
- esac
-
- echo "drtr_node_kstorefile=$DRTR_NODE_KSTOREFILE"
- echo "ENCRYPTME.AES.drtr_node_kstorepass='$DRTR_NODE_KSTOREPASS'" | ${INSTALL_ROOT}/opt/app/cdf/bin/setencryptedvalues
- echo "ENCRYPTME.AES.drtr_node_pvtkeypass='$DRTR_NODE_PVTKEYPASS'" | ${INSTALL_ROOT}/opt/app/cdf/bin/setencryptedvalues
- echo "ENCRYPTME.AES.wgetpswd=$shanodes" | ${INSTALL_ROOT}/opt/app/cdf/bin/setencryptedvalues
-) >> ${INSTALL_ROOT}/opt/app/cdf/lib/cdf.cfg
-
-# install the init scripts for postgresql
-# init.d-pgaas init-pgaas-idns.conf init-pgaas-init.conf logrotate
-
-INIT=${INSTALL_ROOT}/opt/app/pgaas/init
-
-# take care of cron jobs
-if [ -d ${INSTALL_ROOT}/opt/app/platform/cron ]
-then
- CRONDIR=${INSTALL_ROOT}/opt/app/platform/cron/postgres
- mkdir -p $CRONDIR
- chown postgres:postgres $CRONDIR
- chmod 755 $CRONDIR
- cp $INIT/pglogs.cron $CRONDIR/pglogs.cron
- su postgres -c "sh -x ${INSTALL_ROOT}/opt/app/platform/bin/mergeCron"
-else
- su postgres -c "crontab $INIT/pglogs.cron"
-fi
-
-# take care of PGaaS init job
-if [ -d ${INSTALL_ROOT}/opt/app/platform/init.d ]
-then
- INITDEST=${INSTALL_ROOT}/opt/app/platform/init.d/pgaas
- cp $INIT/init.d-pgaas $INITDEST
- chown postgres:postgres $INITDEST
- chmod 755 $INITDEST
-else
- cd ${INSTALL_ROOT}/opt/app/platform/rc.d
- ln -sf ../init.d/pgaas K20pgaas
- ln -sf ../init.d/pgaas S20pgaas
-fi
-
-# take care of /var/run/postgresql directory
-if [ -f /usr/lib/tmpfiles.d/postgresql.conf ]
-then
- : # no need to create the /var/run/postgresql directory (probably because postgresql package already did it)
-elif [ -d /usr/lib/tmpfiles.d ]
-then
- (
- echo "# Directory for PostgreSQL sockets, lockfiles and stats tempfiles"
- echo "d /var/run/postgresql 2775 postgres postgres - -"
- ) > /usr/lib/tmpfiles.d/postgresql.conf
-else
- # install an init script to create it
- cp $INIT/init-pgaas-init.conf ${INSTALL_ROOT}/etc/init/pgaas-init.conf
- service pgaas-init stop
- sleep 1
- service pgaas-init start
- sleep 1
-fi
-# double check to make sure it's been created
-if [ ! -d /var/run/postgresql ]
-then
- mkdir -p /var/run/postgresql
- chown postgres:postgres /var/run/postgresql
-fi
-
-# take care of iDNS-responder
-if [ -d /lib/systemd/system -a -f /bin/systemctl ]
-then
- # install the init script for iDNS in systemd
- cp $INIT/systemd-pgaas-idns.service /lib/systemd/system/pgaas-idns.service
-# if [ -f /usr/sbin/service ]
-# then
-# service pgaas-idns stop
-# sleep 1
-# service pgaas-idns start
-# else
-# systemctl stop pgaas-idns
- sleep 1
- systemctl daemon-reload
- sleep 1
- systemctl enable pgaas-idns
- sleep 1
- systemctl start pgaas-idns
-# fi
-
-else
- # install the init script for iDNS in upstart
- cp $INIT/init-pgaas-idns.conf ${INSTALL_ROOT}/etc/init/pgaas-idns.conf
- service pgaas-idns stop
- sleep 1
- service pgaas-idns start
-fi
-
-# take care of log rotation
-cp $INIT/logrotate ${INSTALL_ROOT}/etc/logrotate.d/pgaas
-chown root:root ${INSTALL_ROOT}/etc/logrotate.d/pgaas
-chmod 644 ${INSTALL_ROOT}/etc/logrotate.d/pgaas
-
-chown -R postgres:postgres ${INSTALL_ROOT}/opt/app/pgaas
-
-echo ENDING $0 $(date)
-echo ENDING $0 $(date) >> /tmp/pgaas.inst.report
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/do-post-install-tools b/pgaas/src/stage/opt/app/pgaas/etc/do-post-install-tools
deleted file mode 100644
index 16cb5e5..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/do-post-install-tools
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-echo "================ $0 ================"
-id
-set -x
-
-die()
-{
- echo "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-export CDFCFG=${INSTALL_ROOT}/opt/app/cdf/lib/cdf.cfg
-export PGAASCFG=${INSTALL_ROOT}/opt/app/pgaas/lib/pgaas.cfg
-
-if [ -d /opt/app/postgresql-9.5.2 ]
-then PGDIR=/opt/app/postgresql-9.5.2
-elif [ -d /usr/lib/postgresql/9.6 ]
-then PGDIR=/usr/lib/postgresql/9.6
-elif [ -d /usr/lib/postgresql/9.5 ]
-then PGDIR=/usr/lib/postgresql/9.5
-else die PostgreSQL bin directory not found
-fi
-CFGDIR=/opt/app/pgaas
-CONF=$CFGDIR/main/postgresql.conf
-if [ ! -f $CONF ]
-then echo "$0: Cannot find PostgreSQL configuration" 1>&2; exit 1
-fi
-
-
-(
- grep '^postgres.x' < $CDFCFG | sed -e 's/^postgres/dcae_admin_db_password/'
- echo "db_configuration=$CONF"
- echo "pg_bin_directory=$PGDIR/bin"
- echo "skip_configuration_file=$CFGDIR/lib/ignore-database-reconfiguration"
-) >> $PGAASCFG
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/do-pre-rm.prep b/pgaas/src/stage/opt/app/pgaas/etc/do-pre-rm.prep
deleted file mode 100755
index a03a13b..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/do-pre-rm.prep
+++ /dev/null
@@ -1,17 +0,0 @@
-echo STARTING $0 $(date)
-
-set -x
-id
-
-if [ -d /opt/app/postgresql-9.5.2 ]
-then
- rm -f $INSTALL_ROOT/opt/app/platform/postgres/pglogs.cron
- su postgres -c "$INSTALL_ROOT/opt/app/platform/bin/mergeCron"
- rmdir $INSTALL_ROOT/opt/app/platform/postgres
- rm -f $INSTALL_ROOT/opt/app/platform/init.d/pgaas
- rm -f $INSTALL_ROOT/opt/app/platform/rc.d/K20pgaas
- rm -f $INSTALL_ROOT/opt/app/platform/rc.d/S20pgaas
-fi
-
-rm -f $INSTALL_ROOT/etc/init/pgaas-idns.conf $INSTALL_ROOT/etc/init/pgaas-init.conf
-rm -f $INSTALL_ROOT/etc/logrotate.d/pgaas
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/gen-pgpass b/pgaas/src/stage/opt/app/pgaas/etc/gen-pgpass
deleted file mode 100644
index f97d573..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/gen-pgpass
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-# create ~postgres/.pgpass
-postgrespswd=$( ${INSTALL_ROOT}/opt/app/cdf/bin/getpropvalue -x -n postgres )
-repmgrpswd=$( ${INSTALL_ROOT}/opt/app/cdf/bin/getpropvalue -x -n repmgr )
-umask 077
-pswdfile=~postgres/.pgpass
-if [ -f $pswdfile ]
-then
- sed -i -e '/:postgres:/d' -e '/:repmgr:/d' $pswdfile
-fi
-
-echo "*:*:*:postgres:$postgrespswd" >> $pswdfile
-echo "*:*:*:repmgr:$repmgrpswd" >> $pswdfile
-chmod 600 $pswdfile
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/gen-recovery.conf b/pgaas/src/stage/opt/app/pgaas/etc/gen-recovery.conf
deleted file mode 100644
index 1ad41c2..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/gen-recovery.conf
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$DBROOT" ] || die "DBROOT is not set"
-
-cd $DBROOT || die "Cannot cd $DBROOT"
-PATH=${INSTALL_ROOT}/opt/app/pgaas/bin:${INSTALL_ROOT}/opt/app/cdf/bin:$PATH
-
-PGNODES=$( getpropvalue -n pgnodes )
-HOSTNAME=`hostname -f`
-PGNODEVALUE=$( gen-repmgr-info -n "$PGNODES" -l "$HOSTNAME" )
-
-# node_name from repmgr.conf => application_name in recovery.conf conninfo line
-# "node" value from repmgr.conf => primary_slot_name in recovery.conf with the string "repmgr_slot_" prefixed
-# node_name in repmgr.conf can be the $HOSTNAME value ?
-
-pswd=$( ${INSTALL_ROOT}/opt/app/cdf/bin/getpropvalue -x -n repmgr )
-
-appname=$HOSTNAME
-PGNODEVALUE=$( gen-repmgr-info -n "$PGNODES" -l "$HOSTNAME" )
-umask 07
-cat <<-EOF > $DBROOT/recovery.conf
- standby_mode = 'on'
- primary_conninfo = 'user=repmgr password=$pswd host=$HOSTNAME port=5432 application_name=$HOSTNAME sslmode=prefer sslcompression=1'
- recovery_target_timeline = 'latest'
- primary_slot_name = repmgr_slot_$PGNODEVALUE
-EOF
-
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/gen-repmgr.conf b/pgaas/src/stage/opt/app/pgaas/etc/gen-repmgr.conf
deleted file mode 100755
index 924a097..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/gen-repmgr.conf
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$CFGDIR" ] || die "CFGDIR is not set"
-
-cd $CFGDIR/main || die "Cannot cd $CFGDIR/main"
-PATH=${INSTALL_ROOT}/opt/app/pgaas/bin:${INSTALL_ROOT}/opt/app/cdf/bin:$PATH
-LOGDIR=/opt/logs/dcae/postgresql/server
-
-PGNODES=$( getpropvalue -n pgnodes )
-
-CLUSTER=pgaas
-HOSTNAME=`hostname -f`
-PGNODEVALUE=$( gen-repmgr-info -n "$PGNODES" -l "$HOSTNAME" )
-UPSTREAMPGNODE=$( gen-repmgr-info -n "$PGNODES" -c "$HOSTNAME" )
-
-UPSTREAMTEXT="#upstream_node="
-case $UPSTREAMPGNODE in
- DEFAULT ) ;;
- * ) UPSTREAMTEXT="upstream_node=$UPSTREAMPGNODE" ;;
-esac
-
-cat <<-EOF > repmgr.conf
- cluster=$CLUSTER
- node=$PGNODEVALUE
- node_name=$HOSTNAME
- conninfo='host=$HOSTNAME user=repmgr dbname=repmgr'
- use_replication_slots=1
- $UPSTREAMTEXT
-
- failover=automatic
- promote_command='repmgr standby promote -f $CFGDIR/main/repmgr.conf'
- follow_command='repmgr standby follow -f $CFGDIR/main/repmgr.conf'
- event_notification_command='/opt/app/pgaas/bin/repmgrd-status-changes %n %e %s "%t" "%d"'
-
- #Log level: possible values are DEBUG, INFO, NOTICE, WARNING, ERR, ALERT, CRIT or EMERG
- loglevel=INFO
- logfile='$LOGDIR/repmgr.log'
-EOF
-
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/lock-and-create-db-backup b/pgaas/src/stage/opt/app/pgaas/etc/lock-and-create-db-backup
deleted file mode 100644
index cb8586d..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/lock-and-create-db-backup
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-if [ -d /opt/app/postgresql-9.5.2 ]
-then PGDIR=${INSTALL_ROOT}/opt/app/postgresql-9.5.2
-elif [ -d /usr/lib/postgresql/9.6 ]
-then PGDIR=/usr/lib/postgresql/9.6
-elif [ -d /usr/lib/postgresql/9.5 ]
-then PGDIR=/usr/lib/postgresql/9.5
-else echo PostgreSQL bin directory not found
-fi
-
-export PATH=$PGDIR/bin:${INSTALL_ROOT}/opt/java/jdk/jdk170/bin:${INSTALL_ROOT}/opt/app/cdf/bin:${INSTALL_ROOT}/opt/app/pgaas/bin:$PATH
-
-LOCKFILE=/var/lock/create-db-backup
-
-testlock -s -t 0 -r 99 ${LOCKFILE} create-db-backup
-retc=$?
-
-if [ $retc -eq 99 ]
-then
- echo Backup is already being created
-fi
-exit $retc
-
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/makecerts b/pgaas/src/stage/opt/app/pgaas/etc/makecerts
deleted file mode 100755
index 494c78b..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/makecerts
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-# NAME
-# makecerts - Create elf-signed certificates for PostgreSQL
-#
-# USAGE
-# makecerts [--force-overwrite]
-#
-# FILES
-# /opt/app/pgaas/etc
-# ssleay.cnf - template
-# /opt/app/pgaas/lib
-# ssl-cert-snakeoil.pem - public key
-# ssl-cert-snakeoil.key - private key
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-dir=${INSTALL_ROOT}/opt/app/pgaas
-etcdir=$dir/etc
-libdir=$dir/lib
-template="$etcdir/ssleay.cnf"
-
-usage()
-{
- exec 1>&2
- echo "Usage: $0 [--force-overwrite]"
- echo "Create self-signed certificates for $dir"
- exit 1
-}
-
-set -x
-
-if [ -f "$libdir/ssl-cert-snakeoil.pem" ] && [ -f "$libdir/ssl-cert-snakeoil.key" ]; then
- if [ "$1" != "--force-overwrite" ]; then
- exit 0
- fi
-fi
-
-# make_snakeoil
-
-if ! HostName="$(hostname -f)" ; then
- HostName="$(hostname)"
- echo "$0: Could not get FQDN, using \"$HostName\"."
- echo "$0: You may want to fix your /etc/hosts and/or DNS setup and run"
- echo "$0: '$0 --force-overwrite'"
- echo "$0: again."
-fi
-if [ ${#HostName} -gt 64 ] ; then
- AltName="DNS:$HostName"
- HostName="$(hostname)"
-fi
-
-
-TMPFILE="$(mktemp /tmp/tmp.mc1.XXXXXXXXXX)" || die mktemp failed
-TMPOUT="$(mktemp /tmp/tmp.mc2.XXXXXXXXXX)" || die mktemp failed
-
-trap "rm -f $TMPFILE $TMPOUT" EXIT 1 2 3 15
-
-# create_temporary_cnf
- sed -e s#@HostName@#"$HostName"# $template > $TMPFILE
- [ -z "$AltName" ] || echo "subjectAltName=$AltName" >> $TMPFILE
-
-# create the certificate.
-
-umask 077
-
-if ! openssl req -config $TMPFILE -new -x509 -days 3650 -nodes \
- -out $libdir/ssl-cert-snakeoil.pem \
- -keyout $libdir/ssl-cert-snakeoil.key > $TMPOUT 2>&1
-then
- echo Could not create certificate. Openssl output was: >&2
- cat $TMPOUT >&2
- die openssl failed
-fi
-chmod 644 $libdir/ssl-cert-snakeoil.pem
-chmod 600 $libdir/ssl-cert-snakeoil.key
-# hash symlink
-ln -sf ssl-cert-snakeoil.pem $libdir/$(openssl x509 -hash -noout -in $libdir/ssl-cert-snakeoil.pem)
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/makefile b/pgaas/src/stage/opt/app/pgaas/etc/makefile
deleted file mode 100644
index b5a5484..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-all:
-
-STAGEDIR=/dev/null
-DISTPATH=/opt/app/pgaas
-
-CFGFILES= create_dcae_rotate.sql
-
-stage:
- rm -rf $(STAGEDIR)/$(DISTPATH)/etc
- mkdir -p $(STAGEDIR)/$(DISTPATH)/etc
- for i in *; do \
- case $$i in \
- *.py | gen*.conf ) \
- j=`basename $$i .py`; \
- cp $$i $(STAGEDIR)/$(DISTPATH)/etc/$$j; \
- chmod a+x $(STAGEDIR)/$(DISTPATH)/etc/$$j; \
- ;; \
- *.conf | *.cfg | *.cnf | *.sql ) \
- cp $$i $(STAGEDIR)/$(DISTPATH)/etc/$$i; \
- chmod a+r $(STAGEDIR)/$(DISTPATH)/etc/$$i; \
- ;; \
- makefile | *~ ) ;; \
- * ) \
- if [ -f $$i ]; then \
- cp $$i $(STAGEDIR)/$(DISTPATH)/etc/$$i; \
- chmod a+rx $(STAGEDIR)/$(DISTPATH)/etc/$$i; \
- fi; \
- ;; \
- esac; \
- done
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/reset-db-secondary b/pgaas/src/stage/opt/app/pgaas/etc/reset-db-secondary
deleted file mode 100644
index 5be1c60..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/reset-db-secondary
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-die()
-{
- echo "$@" 1>&2
- exit 1
-}
-
-export CFGDIR=/opt/app/pgaas
-
-if [ -d /opt/app/postgresql-9.5.2 ]
-then PGDIR=/opt/app/postgresql-9.5.2
-elif [ -d /usr/lib/postgresql/9.6 ]
-then PGDIR=/usr/lib/postgresql/9.6
-elif [ -d /usr/lib/postgresql/9.5 ]
-then PGDIR=/usr/lib/postgresql/9.5
-else die PostgreSQL bin directory not found
-fi
-export PGDIR
-
-export DBROOT=/dbroot/pgdata/main
-export PATH=$PATH:/opt/app/pgaas/bin:/opt/app/pgaas/etc:/opt/app/cdf/bin:/opt/app/postgresql-config/etc
-
-clustertype=$( getpropvalue -n cluster )
-PGNODES=$( getpropvalue -n pgnodes )
-case $clustertype in
- central )
- export MASTER=$( gen-repmgr-info -n "$PGNODES" -M "$master" )
- ;;
- edge )
- host=$( hostname -f )
- export MASTER=$( gen-repmgr-info -n "$PGNODES" -C $host )
- ;;
-esac
-
-[ -n "$CFGDIR" ] || die "CFGDIR is not set"
-[ -n "$MASTER" ] || die "MASTER is not set"
-[ -n "$PGDIR" ] || die "PGDIR is not set"
-[ -n "$DBROOT" ] || die "DBROOT is not set"
-
-# make certain that everything is down
-pkill repmgrd
-pkill repmgr
-pg_ctl_stop
-
-# reset the database to a fresh copy of what is on the master
-create-db-secondary
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/ssleay.cnf b/pgaas/src/stage/opt/app/pgaas/etc/ssleay.cnf
deleted file mode 100644
index 2b665cc..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/ssleay.cnf
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-#
-# SSLeay example configuration file.
-#
-
-RANDFILE = /dev/urandom
-
-[ req ]
-default_bits = 2048
-default_keyfile = privkey.pem
-distinguished_name = req_distinguished_name
-prompt = no
-policy = policy_anything
-req_extensions = v3_req
-x509_extensions = v3_req
-
-[ req_distinguished_name ]
-commonName = @HostName@
-
-[ v3_req ]
-basicConstraints = CA:FALSE
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/start-db b/pgaas/src/stage/opt/app/pgaas/etc/start-db
deleted file mode 100644
index a91d16a..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/start-db
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$PGDIR" ] || die "PGDIR is not set"
-[ -n "$DBROOT" ] || die "DBROOT is not set"
-[ -n "$CFGDIR" ] || die "CFGDIR is not set"
-
-rm -f $DBROOT/postmaster.pid
-chmod 600 $CFGDIR/lib/*.key
-$PGDIR/bin/pg_ctl start -D $DBROOT -o "-c config_file=$CFGDIR/main/postgresql.conf"
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/update-db-master b/pgaas/src/stage/opt/app/pgaas/etc/update-db-master
deleted file mode 100644
index db0d5ba..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/update-db-master
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-# update a master database
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$PGDIR" ] || die "PGDIR is not set"
-[ -n "$DBROOT" ] || die "DBROOT is not set"
-[ -n "$CFGDIR" ] || die "CFGDIR is not set"
-
-cd $CFGDIR/main || die "Cannot cd $CFGDIR/main"
-
-PATH=${INSTALL_ROOT}/opt/app/pgaas/bin:$CFGDIR/etc:$PGDIR/bin:$PATH
-
-# update postgresql.conf - got new ones
-# update pg_hba.conf - got new ones
-# set up repmgr.conf - in common
-
-# start the DB
-start-db
-sleep 10
-
-# make sure the postgres password is right
-$CFGDIR/etc/update-postgres-user
-
-# create temporal tables and other extensions, if needed
-$CFGDIR/etc/create-extensions
-
-# create repmgr user/db, if needed
-$CFGDIR/etc/create-repmgr-user
-
-# register as master
-repmgr -f $CFGDIR/main/repmgr.conf master register
-echo repmgr ret=$?
-
-# start repmgrd
-# start repmgrd (verbose logging for testing)
-umask 07
-repmgrd -f $CFGDIR/main/repmgr.conf -d --verbose
-echo repmgrd ret=$?
-# start repmgrd (normal logging)
-# repmgrd -f $CFGDIR/main/repmgr.conf -d
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/update-db-secondary b/pgaas/src/stage/opt/app/pgaas/etc/update-db-secondary
deleted file mode 100644
index e06c810..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/update-db-secondary
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-# update a secondary database
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$MASTER" ] || die "MASTER is not set"
-[ -n "$PGDIR" ] || die "PGDIR is not set"
-[ -n "$DBROOT" ] || die "DBROOT is not set"
-[ -n "$CFGDIR" ] || die "CFGDIR is not set"
-
-cd $CFGDIR/main || die "Cannot cd $CFGDIR/main"
-
-PATH=${INSTALL_ROOT}/opt/app/pgaas/bin:$CFGDIR/etc:$PGDIR/bin:$PATH
-
-umask 077
-TMP=$(mktemp /tmp/tmp.uds1.XXXXXXXXXX)
-trap 'rm -f $TMP' 0 1 2 3 15
-
-# update postgresql.conf - got new ones
-# update pg_hba.conf - got new ones
-# set up repmgr.conf - in common
-
-# replace/update recovery.conf
-if [ -f $DBROOT/recovery.conf ];then mv $DBROOT/recovery.conf $DBROOT/recovery.conf.upgraded;fi
-$CFGDIR/etc/gen-recovery.conf
-
-# wait until master DB is active and has repmgr available
-max=40
-for s in `seq $max`
-do
- echo "$s of $max: Asking master $MASTER if repmgr is ready"
- pgwget --progress=dot:giga -O$TMP http://$MASTER:8000/hasrepmgr
- if [ -s $TMP ]
- then
- msg=$(cat $TMP)
- case $msg in
- OK* )
- echo "Master has repmgr ready"
- done=yes
- break
- ;;
- * )
- echo "Master does not have repmgr ready, msg=$msg"
- ;;
- esac
- fi
- rm -f $TMP
- sleep 15
-done
-[ "$done" = "yes" ] || die "Master never had repmgr available"
-
-
-$CFGDIR/etc/start-db
-
-sleep 10
-
-# make sure the postgres password is right
-$CFGDIR/etc/update-postgres-user
-
-# register as standby
-repmgr -f $CFGDIR/main/repmgr.conf standby register
-echo repmgr ret=$?
-sleep 10
-
-# start repmgrd
-# start repmgrd (verbose logging for testing)
-umask 07
-repmgrd -f $CFGDIR/main/repmgr.conf -d --verbose
-echo repmgrd ret=$?
-# start repmgrd (normal logging)
-# repmgrd -f $CFGDIR/main/repmgr.conf -d
-
-chmod 600 recovery.conf
diff --git a/pgaas/src/stage/opt/app/pgaas/etc/update-postgres-user b/pgaas/src/stage/opt/app/pgaas/etc/update-postgres-user
deleted file mode 100644
index 0466ad8..0000000
--- a/pgaas/src/stage/opt/app/pgaas/etc/update-postgres-user
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this code except in compliance
-# with the License. You may obtain a copy of the License
-# at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-
-set -x
-
-die()
-{
- echo $0: "$@" 1>&2
- echo $0: "$@"
- umask 022
- echo $0: "$@" >> /tmp/pgaas-failures
- exit 1
-}
-
-[ -n "$PGDIR" ] || die "PGDIR is not set"
-
-PATH=${INSTALL_ROOT}/opt/app/pgaas/bin:$PGDIR/bin:${INSTALL_ROOT}/opt/app/cdf/bin:$PATH
-pswd=$( getpropvalue -x -n postgres )
-
-psql <<-EOF
- ALTER USER postgres PASSWORD '$pswd';
- EOF