Merge pull request #2428 from nextcloud/enh/noid/borg-retention-policy

allow to adjust borgs retention policy
This commit is contained in:
Simon L 2023-05-30 11:28:36 +02:00 committed by GitHub
commit ef43d19a27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 8 deletions

View file

@ -273,7 +273,8 @@
"BACKUP_RESTORE_PASSWORD=%BACKUP_RESTORE_PASSWORD%",
"ADDITIONAL_DIRECTORIES_BACKUP=%ADDITIONAL_DIRECTORIES_BACKUP%",
"BORGBACKUP_HOST_LOCATION=%BORGBACKUP_HOST_LOCATION%",
"BORG_HOST_ID=nextcloud-aio-borgbackup"
"BORG_HOST_ID=nextcloud-aio-borgbackup",
"BORG_RETENTION_POLICY=%BORG_RETENTION_POLICY%"
],
"volumes": [
{

View file

@ -581,6 +581,13 @@ class ConfigurationManager
return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue);
}
public function GetBorgRetentionPolicy() : string {
$envVariableName = 'BORG_RETENTION_POLICY';
$configName = 'borg_retention_policy';
$defaultValue = '--keep-within=7d --keep-weekly=4 --keep-monthly=6';
return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue);
}
public function GetDockerSocketPath() : string {
$envVariableName = 'WATCHTOWER_DOCKER_SOCKET_PATH';
$configName = 'docker_socket_path';

View file

@ -328,6 +328,8 @@ class DockerActionManager
$replacements[1] = $this->configurationManager->GetNextcloudMemoryLimit();
} elseif ($out[1] === 'NEXTCLOUD_MAX_TIME') {
$replacements[1] = $this->configurationManager->GetNextcloudMaxTime();
} elseif ($out[1] === 'BORG_RETENTION_POLICY') {
$replacements[1] = $this->configurationManager->GetBorgRetentionPolicy();
} elseif ($out[1] === 'NEXTCLOUD_TRUSTED_CACERTS_DIR') {
$replacements[1] = $this->configurationManager->GetTrustedCacertsDir();
} elseif ($out[1] === 'ADDITIONAL_DIRECTORIES_BACKUP') {

View file

@ -407,7 +407,7 @@
The backup itself uses a tool that is called <a href="https://github.com/borgbackup/borg#what-is-borgbackup"><b>BorgBackup</b></a> which is a well-known server backup tool that efficiently backs up your files and encrypts them on the fly. <br /><br/>
Backups get created in the following directory on the host: <b>{{ borg_backup_host_location }}/borg</b> <br /><br/>
Be aware that this solution does not back up files and folders that are mounted into Nextcloud using the external storage app - but you can add further Docker volumes and host paths that you want to back up after the initial backup is done.<br><br>
Regarding backup retention, see <b><a href="https://github.com/nextcloud/all-in-one/discussions/1675">this</a></b>.<br><br>
Regarding backup retention, see <b><a href="https://github.com/nextcloud/all-in-one#how-to-adjust-borgs-retention-policy">this</a></b>.<br><br>
Daily backups can get enabled after the initial backup is done. Enabling this also allows to enable an option that allows to update all containers, Nextcloud and its apps automatically.<br><br>
For further documentation and options on this backup solution refer to <b><a href="https://github.com/nextcloud/all-in-one#backup-solution">this section</a></b> and below.<br>