1.4 - Switch to packages Postgres Package

This commit is contained in:
Dave Conroy
2017-11-16 09:29:52 -08:00
parent 6e8620a587
commit 8894487904
3 changed files with 11 additions and 61 deletions

View File

@@ -1,4 +1,8 @@
## 1.1 - 2017-11-17 - <dave at tiredofit dot ca> ## 1.4 - 2017-11-17 - <dave at tiredofit dot ca>
* Switch to Packages Postgres
## 1.31 - 2017-11-17 - <dave at tiredofit dot ca>
* Fix to SPLIT_DB Postgresql Backup * Fix to SPLIT_DB Postgresql Backup

View File

@@ -13,67 +13,13 @@ LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
influxdb@testing \ influxdb@testing \
mongodb-tools \ mongodb-tools \
mysql-client \ mysql-client \
openssl \ postgresql \
postgresql-client \
openssl \
redis \ redis \
xz \ xz \
&& \ && \
### Build Postgres 10
mkdir -p /usr/src/postgresql && \
curl https://ftp.postgresql.org/pub/source/v10.0/postgresql-10.0.tar.bz2 | tar xvfj - --strip 1 -C /usr/src/postgresql && \
apk add --no-cache --virtual .build-deps \
bison \
coreutils \
dpkg-dev dpkg \
flex \
gcc \
libc-dev \
libedit-dev \
libxml2-dev \
libxslt-dev \
make \
openssl-dev \
perl-utils \
perl-ipc-run \
util-linux-dev \
zlib-dev \
&& \
cd /usr/src/postgresql && \
awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new && \
grep '/var/run/postgresql' src/include/pg_config_manual.h.new && \
mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h && \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" && \
wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' && \
wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' && \
./configure \
--build="$gnuArch" \
--enable-integer-datetimes \
--enable-thread-safety \
--enable-tap-tests \
--disable-rpath \
--with-uuid=e2fs \
--with-gnu-ld \
--with-pgport=5432 \
--with-system-tzdata=/usr/share/zoneinfo \
--prefix=/usr/local \
--with-includes=/usr/local/include \
--with-libraries=/usr/local/lib \
\
--with-openssl \
--with-libxml \
--with-libxslt && \
make -j "$(nproc)" world && \
make install-world && \
make -C contrib install && \
\
apk del .build-deps && \
cd / && \
rm -rf \
/usr/src/postgresql \
/usr/local/share/doc \
/usr/local/share/man && \
find /usr/local -name '*.a' -delete && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*

View File

@@ -125,11 +125,11 @@ function backup_mongo() {
function backup_pgsql() { function backup_pgsql() {
if [ "$SPLIT_DB" = "TRUE" ] || [ "$SPLIT_DB" = "true" ]; then if [ "$SPLIT_DB" = "TRUE" ] || [ "$SPLIT_DB" = "true" ]; then
export PGPASSWORD=${DBPASS} export PGPASSWORD=${DBPASS}
DATABASES=psql -h $DBHOST -U $DBUSER -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' ) DATABASES=`psql -h $DBHOST -U $DBUSER -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' `
for db in $DATABASES; do for db in $DATABASES; do
echo "** [db-backup] Dumping database: $db" echo "** [db-backup] Dumping database: $db"
TARGET=pgsql_${db}_${DBHOST}_${now}.sql TARGET=pgsql_${db}_${DBHOST}_${now}.sql
pg_dump -h ${DBHOST} -p ${DBPORT}-U ${DBUSER} $db > ${TMPDIR}/${TARGET} pg_dump -h ${DBHOST} -p ${DBPORT} -U ${DBUSER} $db > ${TMPDIR}/${TARGET}
generate_md5 generate_md5
compression compression
move_backup move_backup