mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-21 21:33:28 +01:00
1.3 - Update Postgres Client to support backing up 10.x hosts
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
## 1.3 - 2017-10-25 - <dave at tiredofit dot ca>
|
||||
|
||||
## 1.2 - 2017-10-19 - dave at tiredofit dot ca
|
||||
* Remove Alpine postgres package and recompile version 10
|
||||
|
||||
## 1.2 - 2017-10-19 - <dave at tiredofit dot ca>
|
||||
|
||||
* Syntax Error Fix
|
||||
* Fix some environment variables for Postgres and Redis
|
||||
|
||||
## 1.1 - 2017-09-14 - dave at tiredofit dot ca
|
||||
## 1.1 - 2017-09-14 - <dave at tiredofit dot ca>
|
||||
|
||||
* Added CouchDB
|
||||
|
||||
## 1.0 - 2017-09-14 - dave at tiredofit dot ca
|
||||
## 1.0 - 2017-09-14 - <dave at tiredofit dot ca>
|
||||
|
||||
* Initial Release
|
||||
* Alpine:Edge
|
||||
|
||||
67
Dockerfile
67
Dockerfile
@@ -1,4 +1,4 @@
|
||||
FROM tiredofit/alpine:edge
|
||||
FROM registry.selfdesign.org/docker/alpine:edge
|
||||
LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
|
||||
|
||||
### Set Environment Variables
|
||||
@@ -13,11 +13,72 @@ LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
|
||||
influxdb@testing \
|
||||
mongodb-tools \
|
||||
mysql-client \
|
||||
postgresql-client \
|
||||
redis \
|
||||
xz && \
|
||||
xz
|
||||
|
||||
### Build Postgres 10
|
||||
RUN apk add --no-cache --virtual .fetch-deps \
|
||||
ca-certificates \
|
||||
openssl \
|
||||
&& \
|
||||
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 .fetch-deps .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/*
|
||||
|
||||
|
||||
### S6 Setup
|
||||
ADD install /
|
||||
|
||||
|
||||
@@ -128,12 +128,15 @@ function backup_pgsql() {
|
||||
for db in $DATABASES; do
|
||||
echo "** [db-backup] Dumping database: $db"
|
||||
TARGET=pgsql_${db}_${DBHOST}_${now}.sql
|
||||
export PGPASSWORD=${DBPASS}
|
||||
|
||||
pg_dump -h ${DBHOST} -p ${DBPORT}-U ${DBUSER} $db > ${TMPDIR}/${TARGET}
|
||||
generate_md5
|
||||
compression
|
||||
move_backup
|
||||
done
|
||||
else
|
||||
export PGPASSWORD=${DBPASS}
|
||||
pg_dump -h ${DBHOST} -U ${DBUSER} $db > ${TMPDIR}/${TARGET}
|
||||
generate_md5
|
||||
compression
|
||||
|
||||
Reference in New Issue
Block a user