Fix two cron jobs that surfaced once the container could actually run them
With yesterday's cron infrastructure fix in place, both daily jobs got
to actually execute today and revealed bugs that had been hiding behind
the silent failures.
1. Wiki export crashed on docs whose body starts with `---` (markdown
horizontal rule). matter.stringify(str, data) re-parses str as if
it might already contain frontmatter, so a leading `---` makes
gray-matter try to YAML-parse the body and choke on the first
`Title: subtitle` colon. Pass {content: str} instead — the parser
only runs on bare strings, so an object skips the re-parse path.
2. outline-backup.sh referenced docker container names `outline-postgres`
and `outline`, but DokPloy names containers `${project}-${service}-1`,
so the backup got `Error response from daemon: No such container`.
Derive names from $APP_NAME (set to the compose project name) with
POSTGRES_CONTAINER / OUTLINE_CONTAINER overrides for portability.
This commit is contained in:
parent
2085ad5103
commit
888fa2f6b5
2 changed files with 16 additions and 5 deletions
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue