allow to disable the backup section

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-07-17 22:07:34 +02:00
parent adcba6b751
commit 9052828dde
6 changed files with 124 additions and 95 deletions

View file

@ -23,6 +23,7 @@ services:
# - NEXTCLOUD_DATADIR=/mnt/ncdata # Allows to set the host directory for Nextcloud's datadir. See https://github.com/nextcloud/all-in-one#how-to-change-the-default-location-of-nextclouds-datadir
# - NEXTCLOUD_MOUNT=/mnt/ # Allows the Nextcloud container to access the chosen directory on the host. See https://github.com/nextcloud/all-in-one#how-to-allow-the-nextcloud-container-to-access-directories-on-the-host
# - DOCKER_SOCKET_PATH=/var/run/docker.sock # Needs to be specified if the docker socket on the host is not located in the default '/var/run/docker.sock'. Otherwise mastercontainer updates will fail.
# - DISABLE_BACKUP_SECTION=true # Setting this to true allows to hide the backup section in the AIO interface.
# # Optional: Caddy reverse proxy. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
# # You can find further examples here: https://github.com/nextcloud/all-in-one/discussions/588

View file

@ -101,6 +101,7 @@ $app->get('/containers', function ($request, $response, $args) use ($container)
'talk_port' => $configurationManager->GetTalkPort(),
'collabora_dictionaries' => $configurationManager->GetCollaboraDictionaries(),
'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(),
'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(),
]);
})->setName('profile');
$app->get('/login', function ($request, $response, $args) use ($container) {

View file

@ -624,4 +624,19 @@ class ConfigurationManager
$defaultValue = '';
return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue);
}
private function GetDisableBackupSection() : string {
$envVariableName = 'DISABLE_BACKUP_SECTION';
$configName = 'disable_backup_section';
$defaultValue = '';
return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue);
}
public function isBackupSectionEnabled() : bool {
if ($this->GetDisableBackupSection() === 'true') {
return false;
} else {
return true;
}
}
}

View file

@ -293,6 +293,10 @@
{% if was_start_button_clicked == true %}
{% if is_backup_section_enabled == false %}
<h2>Backup and restore</h2>
The backup section is disabled via environmental variable.<br><br>
{% else %}
{% if is_backup_container_running == false and borg_backup_host_location == "" and isApacheStarting != true %}
<h2>Backup and restore</h2>
Please type in the directory where backups will get created on the host system:<br><br>
@ -307,6 +311,9 @@
For macOS it may be <b>/var/backup</b>.<br>
On Windows it must be <b>nextcloud_aio_backupdir</b>. You need to create the 'nextcloud_aio_backupdir' volume beforehand by following this documentation: <a href="https://github.com/nextcloud/all-in-one#how-to-run-aio-on-windows"><b>click here</b></a><br><br>
{% endif %}
{% endif %}
{% if is_backup_section_enabled == true %}
{% if borg_backup_host_location != "" %}
{% if is_backup_container_running == false %}
@ -407,6 +414,7 @@
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% if is_backup_container_running == false %}
{% if isApacheStarting == false %}

View file

@ -377,6 +377,9 @@ You can do so by running the `/daily-backup.sh` script that is stored in the mas
One example for this would be `sudo docker exec -it nextcloud-aio-mastercontainer DAILY_BACKUP=1 /daily-backup.sh`, which you can run via a cronjob or put it in a script.
### How to disable the backup section?
If you already have a backup solution in place, you may want to hide the backup section. You can do so by adding `-e DISABLE_BACKUP_SECTION=true` to the initial startup of the mastercontainer.
### How to change the default location of Nextcloud's Datadir?
You can configure the Nextcloud container to use a specific directory on your host as data directory. You can do so by adding the environmental variable `NEXTCLOUD_DATADIR` to the initial startup of the mastercontainer. Allowed values for that variable are strings that start with `/` and are not equal to `/`.

View file

@ -8,5 +8,6 @@
- [ ] When starting the mastercontainer with `-e NEXTCLOUD_DATADIR="/mnt/testdata"` it should map that location from `/mnt/testdata` to `/mnt/ncdata` inside the Nextcloud container. Not having adjusted the permissions correctly before starting the Nextcloud container the first time will not allow the Nextcloud container to start correctly. See https://github.com/nextcloud/all-in-one#how-to-change-the-default-location-of-nextclouds-datadir for allowed values.
- [ ] When starting the mastercontainer with `-e NEXTCLOUD_MOUNT="/mnt/"` it should map `/mnt/` to `/mnt/` inside the Nextcloud container. See https://github.com/nextcloud/all-in-one#how-to-allow-the-nextcloud-container-to-access-directories-on-the-host for allowed values.
- [ ] When starting the mastercontainer with `-e DOCKER_SOCKET_PATH="/var/run/docker.sock.raw"` it should map `/var/run/docker.sock.raw` to `/var/run/docker.sock` inside the watchtower container which allow to update the mastercontainer on macos and with docker rootless.
- [ ] When starting the mastercontainer with `-e DISABLE_BACKUP_SECTION=true` it should hide the backup section that gets shown after AIO is set up (everything of [020-backup-and-restore](./020-backup-and-restore.md)) and simply show that the backup section is disabled.
You can now continue with [070-timezone-change.md](./070-timezone-change.md)