add backups

This commit is contained in:
Kenneth Bingham 2024-06-23 17:59:19 -04:00
parent d9fac63613
commit 31e24ade67
2 changed files with 37 additions and 5 deletions

View file

@ -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

View file

@ -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: