1
0

Outline: configure backups

This commit is contained in:
2025-05-05 16:53:09 +03:00
parent daeef1bc4b
commit cd4a7177d7
4 changed files with 54 additions and 7 deletions

View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -eu
set -o pipefail
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
BACKUP_FILE="outline_postgres_${TIMESTAMP}.sql.gz"
echo "Outline: backing up PostgreSQL database"
docker compose --file "{{ base_dir }}/docker-compose.yml" exec \
outline_postgres \
pg_dump \
-U "{{ outline_postgres_user }}" \
"{{ outline_postgres_database }}" \
| gzip > "{{ postgres_backups_dir }}/${BACKUP_FILE}"
echo "Outline: PostgreSQL backup saved to {{ postgres_backups_dir }}/${BACKUP_FILE}"
echo "Outline: removing old backups"
# Keep only the 3 most recent backups
keep-files.py "{{ postgres_backups_dir }}" --keep 3
echo "Outline: backup completed successfully."