From 31e24ade67447ba7d7ca75c0c7ed5a096f3b9881 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Sun, 23 Jun 2024 17:59:19 -0400 Subject: [PATCH] add backups --- docker/compose.override.yml | 5 ++--- docker/compose.yml | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/docker/compose.override.yml b/docker/compose.override.yml index bd05bb0..f57a3a0 100644 --- a/docker/compose.override.yml +++ b/docker/compose.override.yml @@ -38,15 +38,14 @@ services: STATE_DIRECTORY: /mnt # zrok homedir in container # most relevant options - ZROK_UNIQUE_NAME: selfgoatfarm # name is used to construct frontend domain name, e.g. "myapp" in "myapp.share.zrok.io" + ZROK_UNIQUE_NAME: # name is used to construct frontend domain name, e.g. "myapp" in "myapp.share.zrok.io" ZROK_BACKEND_MODE: # web, caddy, drive, proxy - ZROK_TARGET: http://www:80 # backend target, is a path in container filesystem unless proxy mode + ZROK_TARGET: # backend target, is a path in container filesystem unless proxy mode ZROK_INSECURE: # "--insecure" if proxy target has unverifiable TLS server certificate ZROK_OAUTH_PROVIDER: # google, github ZROK_OAUTH_EMAILS: # allow space-separated list of OAuth email address glob patterns ZROK_BASIC_AUTH: # username:password, mutually-exclusive with ZROK_OAUTH_PROVIDER - # least relevant options ZROK_VERBOSE: # "--verbose" ZROK_SHARE_OPTS: # additional arguments to "zrok reserve public" command diff --git a/docker/compose.yml b/docker/compose.yml index 4a5aefb..9437212 100644 --- a/docker/compose.yml +++ b/docker/compose.yml @@ -8,6 +8,18 @@ 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: @@ -15,9 +27,30 @@ services: ports: [] #- '5432:5432' environment: - POSTGRES_USER: farm + POSTGRES_USER: POSTGRES_PASSWORD: - POSTGRES_DB: farm + 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: