wiki_ghostguild/scripts/outline-backup.sh
Jennie Robinson Faber 289e673cbc Replace Nuxt wiki with Outline deployment config
Strip the Nuxt 4 static site and replace with Docker Compose config
for self-hosted Outline wiki (Outline + PostgreSQL 16 + Redis 7).
Adds nginx reverse proxy with WebSocket support and CSS injection,
migration script for existing markdown articles, backup script,
and starter theme CSS.
2026-03-01 15:45:44 +00:00

39 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# =============================================================================
# Outline Wiki Backup Script
# Backs up PostgreSQL database and file storage from Docker containers.
#
# Usage:
# ./outline-backup.sh [backup_dir]
#
# Crontab (daily at 3 AM):
# 0 3 * * * /path/to/outline-backup.sh /backups/outline >> /var/log/outline-backup.log 2>&1
# =============================================================================
BACKUP_DIR="${1:-/backups/outline}"
DATE=$(date +%Y-%m-%d_%H%M)
RETENTION_DAYS=14
mkdir -p "$BACKUP_DIR"
echo "=== Outline Backup — $DATE ==="
# PostgreSQL dump
echo "Backing up PostgreSQL..."
docker exec outline-postgres pg_dump -U outline -Fc outline \
> "$BACKUP_DIR/outline-db-$DATE.dump"
echo " Database: outline-db-$DATE.dump"
# File storage backup
echo "Backing up file storage..."
docker cp outline:/var/lib/outline/data - \
| gzip > "$BACKUP_DIR/outline-files-$DATE.tar.gz"
echo " Files: outline-files-$DATE.tar.gz"
# Prune old backups
echo "Pruning backups older than $RETENTION_DAYS days..."
find "$BACKUP_DIR" -type f -mtime +$RETENTION_DAYS -delete
echo "=== Backup complete ==="