From 3ee52192dd44465a6c58e5d2eca56a3436c7f0cb Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Sun, 23 Jun 2024 18:06:15 -0400 Subject: [PATCH] move backups to override file --- docker/compose.override.yml | 35 +++++++++++++++++++++++++++++++++++ docker/compose.yml | 33 --------------------------------- 2 files changed, 35 insertions(+), 33 deletions(-) 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: