mirror of
https://github.com/prodrigestivill/docker-postgres-backup-local.git
synced 2026-06-27 13:57:58 +00:00
Merge pull request #6 from capnis/master
Add support for docker secrets
This commit is contained in:
@@ -11,6 +11,7 @@ ENV POSTGRES_HOST **None**
|
|||||||
ENV POSTGRES_PORT 5432
|
ENV POSTGRES_PORT 5432
|
||||||
ENV POSTGRES_USER **None**
|
ENV POSTGRES_USER **None**
|
||||||
ENV POSTGRES_PASSWORD **None**
|
ENV POSTGRES_PASSWORD **None**
|
||||||
|
ENV POSTGRES_PASSWORD_FILE **None**
|
||||||
ENV POSTGRES_EXTRA_OPTS '-Z9'
|
ENV POSTGRES_EXTRA_OPTS '-Z9'
|
||||||
ENV SCHEDULE '@daily'
|
ENV SCHEDULE '@daily'
|
||||||
ENV BACKUP_DIR '/backups'
|
ENV BACKUP_DIR '/backups'
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ services:
|
|||||||
- POSTGRES_DB=database
|
- POSTGRES_DB=database
|
||||||
- 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)
|
||||||
pgbackups:
|
pgbackups:
|
||||||
image: prodrigestivill/postgres-backup-local
|
image: prodrigestivill/postgres-backup-local
|
||||||
restart: always
|
restart: always
|
||||||
@@ -36,11 +37,14 @@ services:
|
|||||||
- POSTGRES_DB=database
|
- POSTGRES_DB=database
|
||||||
- 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_EXTRA_OPTS=-Z9 --schema=public --blobs
|
- POSTGRES_EXTRA_OPTS=-Z9 --schema=public --blobs
|
||||||
- SCHEDULE=@daily
|
- SCHEDULE=@daily
|
||||||
- BACKUP_KEEP_DAYS=7
|
- BACKUP_KEEP_DAYS=7
|
||||||
- BACKUP_KEEP_WEEKS=4
|
- BACKUP_KEEP_WEEKS=4
|
||||||
- BACKUP_KEEP_MONTHS=6
|
- BACKUP_KEEP_MONTHS=6
|
||||||
|
- HEALTHCHECK_PORT=80
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Manual Backups
|
### Manual Backups
|
||||||
|
|||||||
@@ -28,7 +28,11 @@ if [ "${POSTGRES_PASSWORD}" = "**None**" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
#Proces vars
|
#Proces vars
|
||||||
export PGPASSWORD=$POSTGRES_PASSWORD
|
if [ "${POSTGRES_PASSWORD_FILE}" = "**None**" ]; then
|
||||||
|
export PGPASSWORD=$POSTGRES_PASSWORD
|
||||||
|
else
|
||||||
|
export PGPASSWORD=$(cat ${POSTGRES_PASSWORD_FILE})
|
||||||
|
fi
|
||||||
POSTGRES_HOST_OPTS="-h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USER $POSTGRES_EXTRA_OPTS"
|
POSTGRES_HOST_OPTS="-h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USER $POSTGRES_EXTRA_OPTS"
|
||||||
KEEP_DAYS=$BACKUP_KEEP_DAYS
|
KEEP_DAYS=$BACKUP_KEEP_DAYS
|
||||||
KEEP_WEEKS=`expr $((($BACKUP_KEEP_WEEKS * 7) + 1))`
|
KEEP_WEEKS=`expr $((($BACKUP_KEEP_WEEKS * 7) + 1))`
|
||||||
|
|||||||
Reference in New Issue
Block a user