Added compression support for pg_dumpall (#31)

This commit is contained in:
Pau Rodriguez-Estivill
2020-09-02 18:56:13 +02:00
parent 7e40b9cf25
commit 393147d563
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ Most variables are the same as in the [official postgres image](https://hub.dock
| 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 for `pg_dump`. Defaults to `-Z9`. | | POSTGRES_EXTRA_OPTS | Additional options for `pg_dump`. Defaults to `-Z9`. |
| POSTGRES_CLUSTER | Set to `TRUE` in order to use `pg_dumpall` instead. | | 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. |
| POSTGRES_PASSWORD_FILE | Alternative to POSTGRES_PASSWORD, for usage with docker secrets. | | POSTGRES_PASSWORD_FILE | Alternative to POSTGRES_PASSWORD, for usage with docker secrets. |
+1 -1
View File
@@ -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}" -f "${DFILE}" ${POSTGRES_EXTRA_OPTS} pg_dumpall -l "${DB}" ${POSTGRES_EXTRA_OPTS} | gzip -9 > "${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}