M2: full backup runs (database, config, data) with occ and cron

BackupService starts a run per location (database dump in one
transaction, then config + data directory as a resumable file run),
stores the state in ngb_runs after every step, locks a run while a step
executes and records the snapshot. Previews, logs, updater backups and
per-user cache/uploads are excluded (TreeWalker now supports patterns).
BackupJob (every 5 min) starts the daily schedule and steps running runs
with a short budget under web cron and a long one under system cron.
occ: backup:run, backup:status, backup:list.

Tested on NC34/PostgreSQL: first run 128 files / 1 GiB in 64 s (443 MiB
uploaded to S3), unchanged second run 2 s / 0 bytes; a background run to
SFTP completed through cron.php.
This commit is contained in:
2026-10-02 00:53:50 +02:00
parent bc5a589ed8
commit 446e317786
12 changed files with 693 additions and 15 deletions
+7 -1
View File
@@ -5,7 +5,7 @@
<name>NG Backup</name>
<summary>Encrypted, incremental backups of your Nextcloud with restore from the web interface</summary>
<description><![CDATA[Work in progress, not ready for use.]]></description>
<version>0.0.1</version>
<version>0.0.2</version>
<licence>agpl</licence>
<author>Dillard Blom</author>
<namespace>NgBackup</namespace>
@@ -16,6 +16,9 @@
<lib>sodium</lib>
<nextcloud min-version="32" max-version="35"/>
</dependencies>
<background-jobs>
<job>OCA\NgBackup\BackgroundJob\BackupJob</job>
</background-jobs>
<commands>
<command>OCA\NgBackup\Command\KeyInit</command>
<command>OCA\NgBackup\Command\KeyKit</command>
@@ -24,5 +27,8 @@
<command>OCA\NgBackup\Command\TargetAdd</command>
<command>OCA\NgBackup\Command\TargetList</command>
<command>OCA\NgBackup\Command\TargetRemove</command>
<command>OCA\NgBackup\Command\RunBackup</command>
<command>OCA\NgBackup\Command\Status</command>
<command>OCA\NgBackup\Command\ListSnapshots</command>
</commands>
</info>