diff --git a/Containers/borgbackup/backupscript.sh b/Containers/borgbackup/backupscript.sh
index dda0504c595..be159206725 100644
--- a/Containers/borgbackup/backupscript.sh
+++ b/Containers/borgbackup/backupscript.sh
@@ -193,6 +193,13 @@ if [ "$BORG_MODE" = backup ]; then
# Exclude the nextcloud log and audit log for GDPR reasons
BORG_EXCLUDE=(--exclude "/nextcloud_aio_volumes/nextcloud_aio_nextcloud/data/nextcloud.log*" --exclude "/nextcloud_aio_volumes/nextcloud_aio_nextcloud/data/audit.log")
+ # Exclude previews from backup if selected to speed up process
+ ADDITIONAL_BORG_EXCLUDES=()
+ if [ -n "$BACKUP_EXCLUDE_PREVIEWS" ]; then
+ ADDITIONAL_BORG_EXCLUDES=(--exclude "sh:nextcloud_aio_volumes/nextcloud_aio_nextcloud_data/appdata_*/preview/**")
+ echo "Excluding previews from backup"
+ fi
+
# Make sure that there is always a borg.config file before creating a new backup
if ! [ -f "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/borg.config" ]; then
echo "Did not find borg.config file in the mastercontainer volume."
@@ -203,7 +210,7 @@ if [ "$BORG_MODE" = backup ]; then
# Create the backup
echo "Starting the backup..."
get_start_time
- if ! borg create "${BORG_OPTS[@]}" "${BORG_EXCLUDE[@]}" "::$CURRENT_DATE-nextcloud-aio" "/nextcloud_aio_volumes/" --exclude-from /borg_excludes; then
+ if ! borg create "${BORG_OPTS[@]}" "${BORG_EXCLUDE[@]}" "::$CURRENT_DATE-nextcloud-aio" "/nextcloud_aio_volumes/" --exclude-from /borg_excludes "${ADDITIONAL_BORG_EXCLUDES[@]}"; then
echo "Deleting the failed backup archive..."
borg delete --stats "::$CURRENT_DATE-nextcloud-aio"
echo "Backup failed!"
diff --git a/compose.yaml b/compose.yaml
index 8596efd36e7..f01ad65bf05 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -18,6 +18,7 @@ services:
# APACHE_PORT: 11000 # Is needed when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
# APACHE_IP_BINDING: 127.0.0.1 # Should be set when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else) that is running on the same host. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
# APACHE_ADDITIONAL_NETWORK: frontend_net # (Optional) Connect the apache container to an additional docker network. Needed when behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else) running in a different docker network on same server. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
+ # BACKUP_EXCLUDE_PREVIEWS: false # Exclude previews when performing backups in order to speed up the backup process
# BORG_RETENTION_POLICY: --keep-within=7d --keep-weekly=4 --keep-monthly=6 # Allows to adjust borgs retention policy. See https://github.com/nextcloud/all-in-one#how-to-adjust-borgs-retention-policy
# COLLABORA_SECCOMP_DISABLED: false # Setting this to true allows to disable Collabora's Seccomp feature. See https://github.com/nextcloud/all-in-one#how-to-disable-collaboras-seccomp-feature
# NEXTCLOUD_DATADIR: /mnt/ncdata # Allows to set the host directory for Nextcloud's datadir. ⚠️⚠️⚠️ Warning: do not set or adjust this value after the initial Nextcloud installation is done! See https://github.com/nextcloud/all-in-one#how-to-change-the-default-location-of-nextclouds-datadir
diff --git a/php/containers.json b/php/containers.json
index 1457b0de7ef..7b66b747e22 100644
--- a/php/containers.json
+++ b/php/containers.json
@@ -524,6 +524,7 @@
"BORG_MODE=%BORGBACKUP_MODE%",
"SELECTED_RESTORE_TIME=%SELECTED_RESTORE_TIME%",
"RESTORE_EXCLUDE_PREVIEWS=%RESTORE_EXCLUDE_PREVIEWS%",
+ "BACKUP_EXCLUDE_PREVIEWS=%BACKUP_EXCLUDE_PREVIEWS%",
"BACKUP_RESTORE_PASSWORD=%BACKUP_RESTORE_PASSWORD%",
"ADDITIONAL_DIRECTORIES_BACKUP=%ADDITIONAL_DIRECTORIES_BACKUP%",
"BORGBACKUP_HOST_LOCATION=%BORGBACKUP_HOST_LOCATION%",
diff --git a/php/public/index.php b/php/public/index.php
index e5823cb4e67..177e443f15f 100644
--- a/php/public/index.php
+++ b/php/public/index.php
@@ -110,6 +110,7 @@
'borg_restore_password' => $configurationManager->GetBorgRestorePassword(),
'daily_backup_time' => $configurationManager->GetDailyBackupTime(),
'is_daily_backup_running' => $configurationManager->isDailyBackupRunning(),
+ 'are_previews_excluded_from_backups' => $configurationManager->arePreviewsExcludedFromBackups(),
'timezone' => $configurationManager->GetTimezone(),
'skip_domain_validation' => $configurationManager->shouldDomainValidationBeSkipped(),
'talk_port' => $configurationManager->GetTalkPort(),
diff --git a/php/src/Controller/ConfigurationController.php b/php/src/Controller/ConfigurationController.php
index 67463ab14c7..77ff1d56250 100644
--- a/php/src/Controller/ConfigurationController.php
+++ b/php/src/Controller/ConfigurationController.php
@@ -41,6 +41,12 @@ public function SetConfig(Request $request, Response $response, array $args) : R
$this->configurationManager->SetBorgRestoreLocationVarsAndPassword($restoreLocation, $borgRemoteRepo, $borgPassword);
}
+ if (isset($request->getParsedBody()['backup_exclude_previews'])) {
+ $this->configurationManager->SetBackupExcludePreviewsEnabledState('true');
+ } else {
+ $this->configurationManager->SetBackupExcludePreviewsEnabledState('false');
+ }
+
if (isset($request->getParsedBody()['daily_backup_time'])) {
if (isset($request->getParsedBody()['automatic_updates'])) {
$enableAutomaticUpdates = true;
diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php
index f040e16953a..403b3796b1d 100644
--- a/php/src/Controller/DockerController.php
+++ b/php/src/Controller/DockerController.php
@@ -79,6 +79,15 @@ public function GetLogs(Request $request, Response $response, array $args) : Res
}
public function StartBackupContainerBackup(Request $request, Response $response, array $args) : Response {
+ $config = $this->configurationManager->GetConfig();
+
+ if (isset($request->getParsedBody()['backup_exclude_previews'])) {
+ $config['backup_exclude_previews'] = true;
+ } else {
+ $config['backup_exclude_previews'] = false;
+ }
+
+ $this->configurationManager->WriteConfig($config);
$this->startBackup();
return $response->withStatus(201)->withHeader('Location', '/');
}
diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php
index e7d6884ff27..735236a497f 100644
--- a/php/src/Data/ConfigurationManager.php
+++ b/php/src/Data/ConfigurationManager.php
@@ -120,6 +120,23 @@ public function GetBackupTimes() : array {
return $backupTimes;
}
+ public function GetBackupExcludePreviews() : string {
+ $envVariableName = 'BACKUP_EXCLUDE_PREVIEWS';
+ $configName = 'backup_exclude_previews';
+ $defaultValue = 'false';
+ return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue);
+ }
+
+ public function arePreviewsExcludedFromBackups() : bool {
+ return $this->GetBackupExcludePreviews() === 'true';
+ }
+
+ public function SetBackupExcludePreviewsEnabledState(string $value) : void {
+ $config = $this->GetConfig();
+ $config['backup_exclude_previews'] = $value;
+ $this->WriteConfig($config);
+ }
+
public function wasStartButtonClicked() : bool {
if (isset($this->GetConfig()['wasStartButtonClicked'])) {
return true;
diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php
index e3d7c337f75..34ab567ef66 100644
--- a/php/src/Docker/DockerActionManager.php
+++ b/php/src/Docker/DockerActionManager.php
@@ -275,6 +275,8 @@ public function CreateContainer(Container $container) : void {
$replacements[1] = $this->configurationManager->GetSelectedRestoreTime();
} elseif ($out[1] === 'RESTORE_EXCLUDE_PREVIEWS') {
$replacements[1] = $this->configurationManager->GetRestoreExcludePreviews();
+ } elseif ($out[1] === 'BACKUP_EXCLUDE_PREVIEWS') {
+ $replacements[1] = $this->configurationManager->GetBackupExcludePreviews();
} elseif ($out[1] === 'APACHE_PORT') {
$replacements[1] = $this->configurationManager->GetApachePort();
} elseif ($out[1] === 'TALK_PORT') {
diff --git a/php/templates/containers.twig b/php/templates/containers.twig
index 57dfc3f1d91..a6e2ddcaeac 100644
--- a/php/templates/containers.twig
+++ b/php/templates/containers.twig
@@ -169,7 +169,19 @@
{% endfor %}
-
+
+
{% endif %}
@@ -483,6 +495,18 @@