The Attachments README counts its 13 panes (it said 12), the old /information address is documented as redirecting to /admin/settings/version, and the retention, limits and backup numbers are taken from the code. Thanks to xet7 !
6.5 KiB
Admin Panel / Attachments / Backup
What it is
Admin Panel / Attachments / Backup takes a backup archive of this WeKan now or on a schedule: the database text data, the attachments and the avatars, each a checkbox. A site admin backs up the whole instance; an Organization's admin backs up only that Organization's boards. The archives can be listed and restored from the same pane.
Use Backup and restore for the current illustrated guide: immediate and scheduled backups, instance/Organization scope, storage destinations, restore modes and coverage limits. It also explains how to copy a complete stopped FerretDB/SQLite installation with users and attachments.
An Admin Panel archive, a raw database backup and a board export contain different data. Choose the method and verify its restore before relying on it.
Read more
- Backup on Wikipedia.
- ZIP (file format) on Wikipedia - the archive format.
- Cron on Wikipedia - the idea behind the schedule.
- WeKan: Backup and restore, Continuous backup, Problems / Backup status and the Attachments tab.
How to use it
Take a backup now:
- Open your member menu (top right) → Admin Panel → Attachments → Backup (it is the pane that opens).
- Under Backup scope, choose Whole instance or one Organization.
- Tick what to include: Attachments, Avatars, Data (text). A complete backup needs all three and Whole instance.
- Choose Save to storage, then press Backup now. Backup completed is shown when it is done.
Schedule backups:
- In Scheduled backups, choose a Frequency: Off, Daily, Weekly or Monthly.
- For Weekly pick the day of the week, for Monthly the day of the month, and set the time.
- Press Save.
Restore:
- Press List backups.
- Choose the Restore mode: Add missing data only or Replace all data, and restore the archive you want.
How the numbers are calculated
From models/lib/backupPaths.js and models/lib/backupRuns.js:
- Schedule time -
HH:MM, 00:00 to 23:59, default 04:00. Weekly defaults to Sunday. Day of the month is 1 to 28, so every month has that day. - Overdue - a scheduled instance backup is overdue when its last success is older than the period plus a 2-hour grace: 26 hours for Daily, 7 days 2 hours for Weekly, 31 days 2 hours for Monthly.
- A run still "running" after 24 hours counts as failed (
STALE_RUNNING_MS). - History - run records older than 400 days are removed when a new run starts; the backup history (Problems / Backup) shows the 30 most recent.
- BACKUP_KEEP_DAYS - a whole number of days from 1 to 3650; anything else is 0, which keeps every backup. After a successful backup, local archives older than that many days are deleted.
- A scheduled backup that finds another backup still running is recorded as failed with "skipped: another backup was still running".
How it works in WeKan
- Client: client/components/settings/attachments.jade
and
attachments.jsbeside it. - Server methods: server/methods/backup.js -
backup, list and restore, the
BackupSettingsschedule document (_id: 'schedule') and the synced-cron job "WeKan Scheduled Backup". Site admins only for the whole instance; an Organization admin only for the Organizations they administer. - Whole-instance archive: server/lib/fullBackup.js, a versioned BSON/file-stream format with a manifest of payload hashes.
- Organization archive: models/lib/tenantBackup.js, which decides the collections and the ownership guard on restore.
- Run history: the
BackupRunscollection, written by server/lib/backupRuns.js; pruning by server/lib/backupPrune.js. - Archive paths and ZipBleed guard:
safeEntryPathandsymlinkOnRestorePathinmodels/lib/backupPaths.js. - Tests: tests/backupPaths.test.cjs, tests/backupRuns.test.cjs, tests/backupCron.test.cjs, tests/backupValidation.test.cjs, tests/tenantBackup.test.cjs, tests/zipbleed.test.cjs, tests/backupRestoreSymlink.test.cjs and the browser spec tests/playwright/specs/admin-full-backup.e2e.js.
Commits
- Backups in S3 can be encrypted at rest
- Every backup run recorded, failures and overdue backups shown, old local backups pruned
- Refuse to restore a backup file through a symlink
- Scheduled full-instance backups start, and the archive holds every collection and file
- The schedule's day is picked from buttons
- Backup and restore of one Organization
- ZipBleed: a restored archive cannot write outside the files directory
- The scheduled backup cron no longer crashes at server startup
- Low-memory streaming archives with archiver and unzipper
- Scheduled backups of attachments, avatars and data, with list and restore