mirror of
https://github.com/prodrigestivill/docker-postgres-backup-local.git
synced 2026-06-18 17:37:58 +00:00
Improve compression speed #43
This commit is contained in:
@@ -44,7 +44,7 @@ services:
|
|||||||
- POSTGRES_USER=username
|
- POSTGRES_USER=username
|
||||||
- POSTGRES_PASSWORD=password
|
- POSTGRES_PASSWORD=password
|
||||||
# - POSTGRES_PASSWORD_FILE=/run/secrets/db_password <-- alternative for POSTGRES_PASSWORD (to use with docker secrets)
|
# - POSTGRES_PASSWORD_FILE=/run/secrets/db_password <-- alternative for POSTGRES_PASSWORD (to use with docker secrets)
|
||||||
- POSTGRES_EXTRA_OPTS=-Z9 --schema=public --blobs
|
- POSTGRES_EXTRA_OPTS=-Z6 --schema=public --blobs
|
||||||
- SCHEDULE=@daily
|
- SCHEDULE=@daily
|
||||||
- BACKUP_KEEP_DAYS=7
|
- BACKUP_KEEP_DAYS=7
|
||||||
- BACKUP_KEEP_WEEKS=4
|
- BACKUP_KEEP_WEEKS=4
|
||||||
@@ -76,7 +76,7 @@ Most variables are the same as in the [official postgres image](https://hub.dock
|
|||||||
| HEALTHCHECK_PORT | Port listening for cron-schedule health check. Defaults to `8080`. |
|
| HEALTHCHECK_PORT | Port listening for cron-schedule health check. Defaults to `8080`. |
|
||||||
| POSTGRES_DB | Comma or space separated list of postgres databases to backup. Required. |
|
| POSTGRES_DB | Comma or space separated list of postgres databases to backup. Required. |
|
||||||
| POSTGRES_DB_FILE | Alternative to POSTGRES_DB, but with one database per line, for usage with docker secrets. |
|
| POSTGRES_DB_FILE | Alternative to POSTGRES_DB, but with one database per line, for usage with docker secrets. |
|
||||||
| POSTGRES_EXTRA_OPTS | Additional [options](https://www.postgresql.org/docs/12/app-pgdump.html#PG-DUMP-OPTIONS) for `pg_dump` (or `pg_dumpall` [options](https://www.postgresql.org/docs/12/app-pg-dumpall.html#id-1.9.4.13.6) if POSTGRES_CLUSTER is set). Defaults to `-Z9`. |
|
| POSTGRES_EXTRA_OPTS | Additional [options](https://www.postgresql.org/docs/12/app-pgdump.html#PG-DUMP-OPTIONS) for `pg_dump` (or `pg_dumpall` [options](https://www.postgresql.org/docs/12/app-pg-dumpall.html#id-1.9.4.13.6) if POSTGRES_CLUSTER is set). Defaults to `-Z6`. |
|
||||||
| POSTGRES_CLUSTER | Set to `TRUE` in order to use `pg_dumpall` instead. Also set POSTGRES_EXTRA_OPTS to any value or empty since the default value is not compatible with `pg_dumpall`. |
|
| POSTGRES_CLUSTER | Set to `TRUE` in order to use `pg_dumpall` instead. Also set POSTGRES_EXTRA_OPTS to any value or empty since the default value is not compatible with `pg_dumpall`. |
|
||||||
| POSTGRES_HOST | Postgres connection parameter; postgres host to connect to. Required. |
|
| POSTGRES_HOST | Postgres connection parameter; postgres host to connect to. Required. |
|
||||||
| POSTGRES_PASSWORD | Postgres connection parameter; postgres password to connect with. Required. |
|
| POSTGRES_PASSWORD | Postgres connection parameter; postgres password to connect with. Required. |
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ ENV POSTGRES_DB="**None**" \
|
|||||||
POSTGRES_PASSWORD="**None**" \
|
POSTGRES_PASSWORD="**None**" \
|
||||||
POSTGRES_PASSWORD_FILE="**None**" \
|
POSTGRES_PASSWORD_FILE="**None**" \
|
||||||
POSTGRES_PASSFILE_STORE="**None**" \
|
POSTGRES_PASSFILE_STORE="**None**" \
|
||||||
POSTGRES_EXTRA_OPTS="-Z9" \
|
POSTGRES_EXTRA_OPTS="-Z6" \
|
||||||
POSTGRES_CLUSTER="FALSE" \
|
POSTGRES_CLUSTER="FALSE" \
|
||||||
SCHEDULE="@daily" \
|
SCHEDULE="@daily" \
|
||||||
BACKUP_DIR="/backups" \
|
BACKUP_DIR="/backups" \
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ for DB in ${POSTGRES_DBS}; do
|
|||||||
#Create dump
|
#Create dump
|
||||||
if [ "${POSTGRES_CLUSTER}" = "TRUE" ]; then
|
if [ "${POSTGRES_CLUSTER}" = "TRUE" ]; then
|
||||||
echo "Creating cluster dump of ${DB} database from ${POSTGRES_HOST}..."
|
echo "Creating cluster dump of ${DB} database from ${POSTGRES_HOST}..."
|
||||||
pg_dumpall -l "${DB}" ${POSTGRES_EXTRA_OPTS} | gzip -9 > "${DFILE}"
|
pg_dumpall -l "${DB}" ${POSTGRES_EXTRA_OPTS} | gzip > "${DFILE}"
|
||||||
else
|
else
|
||||||
echo "Creating dump of ${DB} database from ${POSTGRES_HOST}..."
|
echo "Creating dump of ${DB} database from ${POSTGRES_HOST}..."
|
||||||
pg_dump -d "${DB}" -f "${DFILE}" ${POSTGRES_EXTRA_OPTS}
|
pg_dump -d "${DB}" -f "${DFILE}" ${POSTGRES_EXTRA_OPTS}
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ ENV POSTGRES_DB="**None**" \
|
|||||||
POSTGRES_PASSWORD="**None**" \
|
POSTGRES_PASSWORD="**None**" \
|
||||||
POSTGRES_PASSWORD_FILE="**None**" \
|
POSTGRES_PASSWORD_FILE="**None**" \
|
||||||
POSTGRES_PASSFILE_STORE="**None**" \
|
POSTGRES_PASSFILE_STORE="**None**" \
|
||||||
POSTGRES_EXTRA_OPTS="-Z9" \
|
POSTGRES_EXTRA_OPTS="-Z6" \
|
||||||
POSTGRES_CLUSTER="FALSE" \
|
POSTGRES_CLUSTER="FALSE" \
|
||||||
SCHEDULE="@daily" \
|
SCHEDULE="@daily" \
|
||||||
BACKUP_DIR="/backups" \
|
BACKUP_DIR="/backups" \
|
||||||
|
|||||||
Reference in New Issue
Block a user