From 416f9a0b4835c1d547eff2357af951ce5cf34907 Mon Sep 17 00:00:00 2001 From: chasqui Date: Tue, 10 Nov 2026 17:51:59 -0600 Subject: [PATCH] Add Backup Bot Two support for PeerTube --- .env.sample | 1 + compose.yml | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.env.sample b/.env.sample index acb5573..e33d962 100644 --- a/.env.sample +++ b/.env.sample @@ -3,6 +3,7 @@ TYPE=peertube DOMAIN=peertube.example.com # <= EDIT THIS LETS_ENCRYPT_ENV=production COMPOSE_FILE=compose.yml +ENABLE_BACKUPS=true PEERTUBE_WEBSERVER_PORT=443 PEERTUBE_WEBSERVER_HTTPS=true diff --git a/compose.yml b/compose.yml index 2eadeec..3df0796 100644 --- a/compose.yml +++ b/compose.yml @@ -80,6 +80,12 @@ services: deploy: labels: - "coop-cloud.${STACK_NAME}.version=8.4.2+v8.3.2-trixie" + - "backupbot.backup=${ENABLE_BACKUPS:-true}" + - "backupbot.backup.volumes.app-assets=false" + - "backupbot.backup.volumes.nginx-tmp=false" + - "backupbot.backup.volumes.nginx-cache=false" + - "backupbot.backup.volumes.postgres-data=false" + - "backupbot.backup.volumes.redis-data=false" db: image: pgautoupgrade/pgautoupgrade:18-alpine @@ -99,6 +105,22 @@ services: timeout: 5s retries: 10 + backup: + image: postgres:18-trixie + entrypoint: ["sleep", "infinity"] + secrets: + - db_password + volumes: + - backup-db:/backup + networks: + - internal + deploy: + labels: + - "backupbot.backup.volumes.backup-db.path=backup.dump" + - "backupbot.backup.pre-hook=PGPASSWORD=$$(cat /run/secrets/db_password) pg_dump -h db -U peertube -d peertube -Fc -f /backup/backup.dump" + - "backupbot.backup.post-hook=rm -f /backup/backup.dump" + - "backupbot.restore.post-hook=PGPASSWORD=$$(cat /run/secrets/db_password) pg_restore -h db -U peertube -d peertube --clean --if-exists --no-owner --no-privileges --exit-on-error /backup/backup.dump && rm -f /backup/backup.dump" + cache: image: redis:8-alpine volumes: @@ -124,6 +146,7 @@ volumes: nginx-cache: postgres-data: redis-data: + backup-db: configs: nginx_config: -- 2.54.0