move backups to override file

This commit is contained in:
Kenneth Bingham 2024-06-23 18:06:15 -04:00
parent 31e24ade67
commit 3ee52192dd
2 changed files with 35 additions and 33 deletions

View file

@ -1,4 +1,39 @@
services:
www-backup:
profiles:
- backup
image: busybox
command:
- /bin/sh
- -c
- |
tar -cvzf /backup/www.$(date -u -Is).tgz -C /www .
volumes:
- www:/www
- ./backup:/backup
db-backup:
profiles:
- backup
image: postgres:13
volumes:
- db:/var/lib/postgresql/data
- ./backup:/backup
command:
- /bin/sh
- -c
- |
pg_dump \
-U ${POSTGRES_USER} \
-d ${POSTGRES_DB} \
-h db \
-F c -b -v \
-f /backup/db.$(date -u -Is).psql
environment:
POSTGRES_USER:
PGPASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB:
# set file ownership
zrok-init:
image: busybox

View file

@ -8,18 +8,6 @@ services:
restart: unless-stopped
depends_on:
- db
www-backup:
profiles:
- backup
image: busybox
command:
- /bin/sh
- -c
- |
tar -cvzf /backup/www.$(date -u -Is).tgz -C /www .
volumes:
- www:/www
- ./backup:/backup
db:
image: postgres:13
volumes:
@ -30,27 +18,6 @@ services:
POSTGRES_USER:
POSTGRES_PASSWORD:
POSTGRES_DB:
db-backup:
profiles:
- backup
image: postgres:13
volumes:
- db:/var/lib/postgresql/data
- ./backup:/backup
command:
- /bin/sh
- -c
- |
pg_dump \
-U ${POSTGRES_USER} \
-d ${POSTGRES_DB} \
-h db \
-F c -b -v \
-f /backup/db.$(date -u -Is).psql
environment:
POSTGRES_USER:
PGPASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB:
volumes:
www: