diff --git a/scripts/export-content.js b/scripts/export-content.js index 29c1d29..40442ce 100755 --- a/scripts/export-content.js +++ b/scripts/export-content.js @@ -156,7 +156,11 @@ async function main() { createdBy: doc.createdBy?.email || doc.createdBy?.name || null, }; - const content = matter.stringify(doc.text || "", frontmatter); + // Pass an object (not a bare string) so gray-matter doesn't run the body + // through its frontmatter parser. Otherwise an Outline doc whose body + // starts with `---` (markdown horizontal rule) gets misread as having + // YAML frontmatter and crashes the export. + const content = matter.stringify({ content: doc.text || "" }, frontmatter); const filePath = path.join(OUTPUT_DIR, filename); await fs.writeFile(filePath, content, "utf-8"); diff --git a/scripts/outline-backup.sh b/scripts/outline-backup.sh index a161d5e..5dc3423 100755 --- a/scripts/outline-backup.sh +++ b/scripts/outline-backup.sh @@ -16,19 +16,26 @@ BACKUP_DIR="${1:-/backups/outline}" DATE=$(date +%Y-%m-%d_%H%M) RETENTION_DAYS=14 +# DokPloy names containers ${COMPOSE_PROJECT}-${SERVICE}-1. APP_NAME is set +# to the compose project name in the .env file, so derive the container +# names from that. Allow overrides via env vars for portability. +PROJECT="${APP_NAME:-outline}" +POSTGRES_CONTAINER="${POSTGRES_CONTAINER:-${PROJECT}-postgres-1}" +OUTLINE_CONTAINER="${OUTLINE_CONTAINER:-${PROJECT}-outline-1}" + mkdir -p "$BACKUP_DIR" echo "=== Outline Backup — $DATE ===" # PostgreSQL dump -echo "Backing up PostgreSQL..." -docker exec outline-postgres pg_dump -U outline -Fc outline \ +echo "Backing up PostgreSQL from $POSTGRES_CONTAINER..." +docker exec "$POSTGRES_CONTAINER" 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 - \ +echo "Backing up file storage from $OUTLINE_CONTAINER..." +docker cp "$OUTLINE_CONTAINER:/var/lib/outline/data" - \ | gzip > "$BACKUP_DIR/outline-files-$DATE.tar.gz" echo " Files: outline-files-$DATE.tar.gz"