mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
Add remote borg backup support (#4804)
Signed-off-by: Tim Diels <tim@diels.me> Signed-off-by: Simon L. <szaimen@e.mail.de> Co-authored-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
parent
34a264d945
commit
3eeda1ea91
12 changed files with 402 additions and 159 deletions
|
|
@ -25,6 +25,7 @@
|
|||
{# timezone-prefill #}
|
||||
<script type="text/javascript" src="timezone.js"></script>
|
||||
|
||||
{% set hasBackupLocation = borg_backup_host_location or borg_remote_repo %}
|
||||
{% set isAnyRunning = false %}
|
||||
{% set isAnyRestarting = false %}
|
||||
{% set isWatchtowerRunning = false %}
|
||||
|
|
@ -90,7 +91,7 @@
|
|||
<input type="submit" value="Update mastercontainer" />
|
||||
</form>
|
||||
{% else %}
|
||||
{% if borg_backup_host_location == '' and borg_restore_password == '' %}
|
||||
{% if not hasBackupLocation %}
|
||||
<p>The official Nextcloud installation method. Nextcloud All-in-One provides easy deployment and maintenance with most features included in this one Nextcloud instance.</p>
|
||||
<p>You can either create a new AIO instance or restore a former AIO instance from backup. See the two sections below.</p>
|
||||
{{ include('includes/aio-config.twig') }}
|
||||
|
|
@ -130,7 +131,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if is_instance_restore_attempt == false %}
|
||||
{% if borg_backup_host_location != '' and borg_restore_password != '' %}
|
||||
{% if hasBackupLocation %}
|
||||
{% if borg_backup_mode in ['test', 'check'] %}
|
||||
{% if backup_exit_code > 0 %}
|
||||
<p><span class="status error"></span> Last {{ borg_backup_mode }} failed! (<a href="/api/docker/logs?id=nextcloud-aio-borgbackup" target="_blank" rel="noopener">Logs</a>)</p>
|
||||
|
|
@ -179,11 +180,23 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if borg_backup_host_location == '' or borg_restore_password == '' or borg_backup_mode not in ['test', 'check', ''] or backup_exit_code > 0 %}
|
||||
<p>Please enter the location of the backup archive on your host and the encryption password of the backup archive below:</p>
|
||||
{% if not hasBackupLocation or borg_backup_mode not in ['test', 'check', ''] or backup_exit_code > 0 %}
|
||||
{% if borg_remote_repo and backup_exit_code > 0 %}
|
||||
<p>
|
||||
You may still need to authorize this pubkey on your borg remote:<br><strong>{{ borg_public_key }}</strong><br>
|
||||
To try again, resubmit your location and rerun the test.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
Please enter the location of the backup archive on your host or a
|
||||
<a href="https://borgbackup.readthedocs.io/en/stable/usage/general.html#repository-urls">remote borg repo url</a>
|
||||
if stored remotely; and the encryption password of the backup archive below:
|
||||
</p>
|
||||
<form method="POST" action="/api/configuration" class="xhr">
|
||||
<input type="text" name="borg_restore_host_location" value="{{borg_backup_host_location}}" placeholder="/mnt/backup"/>
|
||||
<input type="text" name="borg_restore_password" value="{{borg_restore_password}}" placeholder="encryption password"/>
|
||||
<label>Local backup location</label> <input type="text" name="borg_restore_host_location" value="{{borg_backup_host_location}}" placeholder="/mnt/backup"/><br>
|
||||
<label>Remote borg repo</label> <input type="text" name="borg_restore_remote_repo" value="{{borg_remote_repo}}" placeholder="user@host:/path/to/repo"/><br>
|
||||
<label>Borg passphrase</label> <input type="text" name="borg_restore_password" value="{{borg_restore_password}}" placeholder="encryption password"/><br>
|
||||
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
|
||||
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||
<input type="submit" value="Submit location and encryption password" />
|
||||
|
|
@ -220,19 +233,19 @@
|
|||
{% if domain != "" %}
|
||||
{% if isAnyRunning == true %}
|
||||
{% if isApacheStarting != true %}
|
||||
{% if borg_backup_host_location != '' %}
|
||||
{% if hasBackupLocation %}
|
||||
<details>
|
||||
<summary>Click here to reveal the initial Nextcloud credentials</summary>
|
||||
{% endif %}
|
||||
<p>Initial Nextcloud username: <strong>admin</strong></p>
|
||||
{% if borg_backup_host_location != '' %}
|
||||
{% if hasBackupLocation %}
|
||||
{# nextcloud_password needs to be duplicated due to a bug in Firefox. See https://github.com/nextcloud/all-in-one/issues/638. #}
|
||||
<p>Initial Nextcloud password: <strong>{{ nextcloud_password }}</strong></p></details>
|
||||
{% else %}
|
||||
<p>Initial Nextcloud password: <strong>{{ nextcloud_password }}</strong></p>
|
||||
{% endif %}
|
||||
<p><a href="https://{{ domain }}" class="button" target="_blank" rel="noopener">Open your Nextcloud ↗</a></p>
|
||||
{% if borg_backup_host_location == '' %}
|
||||
{% if not hasBackupLocation %}
|
||||
<p>If your Nextcloud does not open when clicking the button above, see <strong><a href="https://github.com/nextcloud/all-in-one/discussions/2105">this documentation</a></strong></p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
|
|
@ -371,11 +384,16 @@
|
|||
<h2>Backup and restore</h2>
|
||||
<p>The backup section is disabled via environmental variable.</p>
|
||||
{% else %}
|
||||
{% if is_backup_container_running == false and borg_backup_host_location == "" and isApacheStarting != true %}
|
||||
{% if is_backup_container_running == false and not hasBackupLocation and isApacheStarting != true %}
|
||||
<h2>Backup and restore</h2>
|
||||
<p>Please enter the directory path below where backups will be created on the host system. It's best to choose a location on a separate drive and not on your root drive.</p>
|
||||
<p>
|
||||
To store backups remotely instead, fill in the
|
||||
<a href="https://borgbackup.readthedocs.io/en/stable/usage/general.html#repository-urls">remote borg repo url</a>.
|
||||
</p>
|
||||
<form method="POST" action="/api/configuration" class="xhr">
|
||||
<input type="text" name="borg_backup_host_location" placeholder="/mnt/backup"/>
|
||||
<label>Local backup location</label> <input type="text" name="borg_backup_host_location" placeholder="/mnt/backup"/><br>
|
||||
<label>Remote borg repo</label> <input type="text" name="borg_remote_repo" placeholder="user@host:/path/to/repo"/><br>
|
||||
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
|
||||
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||
<input type="submit" value="Submit backup location" />
|
||||
|
|
@ -386,7 +404,7 @@
|
|||
|
||||
{% if is_backup_section_enabled == true %}
|
||||
|
||||
{% if borg_backup_host_location != "" %}
|
||||
{% if hasBackupLocation %}
|
||||
{% if is_backup_container_running == false %}
|
||||
<h2>Backup and restore</h2>
|
||||
{% if backup_exit_code > 0 %}
|
||||
|
|
@ -404,9 +422,19 @@
|
|||
</details>
|
||||
{% endif %}
|
||||
{% if has_backup_run_once == false %}
|
||||
<p>The initial backup was not successful.</p>
|
||||
|
||||
{% if borg_remote_repo %}
|
||||
<p>
|
||||
You may still need to authorize this pubkey on your borg remote:<br><strong>{{ borg_public_key }}</strong><br>
|
||||
To try again, click <strong>Create backup</strong>.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<p>You may change the backup path again since the initial backup was not successful. After submitting the new value, you need to click on <strong>Create Backup</strong> to test the new value.</p>
|
||||
<form method="POST" action="/api/configuration" class="xhr">
|
||||
<input type="text" value="{{borg_backup_host_location}}" name="borg_backup_host_location" placeholder="/mnt/backup" />
|
||||
<label>Local backup location</label> <input type="text" name="borg_backup_host_location" placeholder="/mnt/backup"/><br>
|
||||
<label>Remote borg repo</label> <input type="text" name="borg_remote_repo" placeholder="user@host:/path/to/repo"/><br>
|
||||
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
|
||||
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||
<input type="submit" value="Set backup location again" />
|
||||
|
|
@ -432,7 +460,17 @@
|
|||
<p>All important data from your Nextcloud AIO instance such as the database, your files and the mastercontainer's configuration files, will be backed up.</p>
|
||||
<p>The backup uses a tool called <a href="https://github.com/borgbackup/borg#what-is-borgbackup"><strong>BorgBackup</strong></a>, a well-known server backup tool that efficiently backs up your files and encrypts them on the fly.</p>
|
||||
<p>By using this tool, backups are incremental, differential, compressed and encrypted – so only the first backup will take a while. Further backups should be fast as only changes are taken into account.</p>
|
||||
<p>Backups will be created in the following directory on the host: <strong>{{ borg_backup_host_location }}/borg</strong></p>
|
||||
{% if borg_remote_repo != '' %}
|
||||
<p>
|
||||
Backups get created remotely at:<br>
|
||||
<strong>{{ borg_remote_repo }}</strong>
|
||||
{% if has_backup_run_once == true %}
|
||||
<br/>Your borg ssh public key is:<br><strong>{{ borg_public_key }}</strong>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% else %}
|
||||
<p>Backups will be created in the following directory on the host: <strong>{{ borg_backup_host_location }}/borg</strong></p>
|
||||
{% endif %}
|
||||
<p>Be aware that this solution does not backup 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.</p>
|
||||
<p>For information about backup retention, see <strong><a href="https://github.com/nextcloud/all-in-one#how-to-adjust-borgs-retention-policy">this</a></strong>.</p>
|
||||
<p>Daily backups can be enabled after the initial backup is done. Enabling this also allows you to enable an option to update all containers, Nextcloud, and its apps automatically.</p>
|
||||
|
|
@ -448,10 +486,14 @@
|
|||
</form>
|
||||
|
||||
{% if has_backup_run_once == false %}
|
||||
<h3>Reset backup host location</h3>
|
||||
<p>If the configured backup host location <strong>{{ borg_backup_host_location }}</strong> is wrong, you can reset it by clicking on the button below.</p>
|
||||
<h3>Reset backup location</h3>
|
||||
<p>
|
||||
If the configured backup host location <strong>{{ borg_backup_host_location }}</strong>
|
||||
{% if borg_remote_repo %}or the remote repo <strong>{{ borg_remote_repo }}</strong> is wrong{% endif %},
|
||||
you can reset it by clicking on the button below.
|
||||
</p>
|
||||
<form method="POST" action="/api/configuration" class="xhr">
|
||||
<input type="hidden" name="delete_borg_backup_host_location" value="yes"/>
|
||||
<input type="hidden" name="delete_borg_backup_location_vars" value="yes"/>
|
||||
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
|
||||
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||
<input type="submit" value="Reset backup location" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue