diff --git a/docker/compose.override.yml b/docker/compose.override.yml index f57a3a0..ae2ad56 100644 --- a/docker/compose.override.yml +++ b/docker/compose.override.yml @@ -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 diff --git a/docker/compose.yml b/docker/compose.yml index 9437212..a233595 100644 --- a/docker/compose.yml +++ b/docker/compose.yml @@ -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: