Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a733665

Browse files
committedJan 17, 2025·
add borgbackup-viewer community container
Signed-off-by: Simon L. <szaimen@e.mail.de>
1 parent c19ba34 commit a733665

File tree

5 files changed

+103
-3
lines changed

5 files changed

+103
-3
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"aio_services_v1": [
3+
{
4+
"container_name": "nextcloud-aio-borgbackup-viewer",
5+
"image_tag": "v1",
6+
"display_name": "Borg Backup Viewer",
7+
"documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/borgbackup-viewer",
8+
"image": "szaimen/aio-borgbackup-viewer",
9+
"internal_port": "5800",
10+
"ports": [
11+
{
12+
"ip_binding": "",
13+
"port_number": "5800",
14+
"protocol": "tcp"
15+
}
16+
],
17+
"environment": [
18+
"BORG_HOST_ID=nextcloud-aio-borgbackup-viewer",
19+
"WEB_AUTHENTICATION_USERNAME=nextcloud",
20+
"WEB_AUTHENTICATION_PASSWORD=%BORGBACKUP_VIEWER_PASSWORD%",
21+
"WEB_LISTENING_PORT=5800",
22+
"BORG_PASSPHRASE=%BORGBACKUP_PASSWORD%",
23+
"BORG_REPO=/mnt/borgbackup/borg"
24+
],
25+
"secrets": [
26+
"BORGBACKUP_VIEWER_PASSWORD",
27+
"BORGBACKUP_PASSWORD"
28+
],
29+
"volumes": [
30+
{
31+
"source": "nextcloud_aio_backup_cache",
32+
"destination": "/root",
33+
"writeable": true
34+
},
35+
{
36+
"source": "%NEXTCLOUD_DATADIR%",
37+
"destination": "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data",
38+
"writeable": true
39+
},
40+
{
41+
"source": "nextcloud_aio_mastercontainer",
42+
"destination": "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer",
43+
"writeable": true
44+
},
45+
{
46+
"source": "%BORGBACKUP_HOST_LOCATION%",
47+
"destination": "/mnt/borgbackup",
48+
"writeable": true
49+
},
50+
{
51+
"source": "nextcloud_aio_elasticsearch",
52+
"destination": "/nextcloud_aio_volumes/nextcloud_aio_elasticsearch",
53+
"writeable": true
54+
},
55+
{
56+
"source": "nextcloud_aio_redis",
57+
"destination": "/mnt/redis",
58+
"writeable": true
59+
}
60+
],
61+
"devices": [
62+
"/dev/fuse"
63+
],
64+
"cap_add": [
65+
"SYS_ADMIN"
66+
],
67+
"apparmor_unconfined": true
68+
}
69+
]
70+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## Borgbackup Viewer
2+
This container allows to view the local borg repository in a web session. It also allows you to restore files and folders from the backup by using desktop programs in a web browser.
3+
4+
### Notes
5+
- After adding and starting the container, you need to visit `https://ip.address.of.this.server:5800` in order to log in with the user `nextcloud` and the password that you can retrieve when running `sudo docker inspect nextcloud-aio-borgbackup-viewer | grep WEB_AUTHENTICATION_PASSWORD`.
6+
- Then, you should see a terminal. There type in `borg mount /mnt/borgbackup/borg /tmp/borg` to mount the backup archive at `/tmp/borg` inside the container. Afterwards type in `nautilus /tmp/borg` which will show a file explorer and allows you to see all the files. You can then copy files and folders back to their initial mountpoints inside `/nextcloud_aio_volumes/`, `/host_mounts/` and `/docker_volumes/`. ⚠️ Be very carefully while doing that as can break your instance!
7+
- After you are done with the operation, click on the terminal in the background and press `[CTRL]+[c]` multiple times to close any open application. Then run `umount /tmp/borg` to unmount the mountpoint correctly.
8+
- You can also delete specific archives by running `borg list`, delete a specific archive e.g. via `borg delete --stats --progress "::20220223_174237-nextcloud-aio"` and compact the archives via `borg compact`. After doing so, make sure to update the backup archives list in the AIO interface! You can do so by clicking on the `Check backup integrity` button or `Create backup` button.
9+
- ⚠️ After you are done doing your operations, remove the container for better security again from the stack: https://github.com/nextcloud/all-in-one/tree/main/community-containers#how-to-remove-containers-from-aios-stack
10+
- See https://github.com/nextcloud/all-in-one/tree/main/community-containers#community-containers how to add it to the AIO stack
11+
12+
### Repository
13+
https://github.com/szaimen/aio-borgbackup-viewer
14+
15+
### Maintainer
16+
https://github.com/szaimen
17+

‎php/src/Docker/DockerActionManager.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -541,19 +541,23 @@ public function CreateContainer(Container $container) : void {
541541
$mounts = [];
542542

543543
// Special things for the backup container which should not be exposed in the containers.json
544-
if ($container->GetIdentifier() === 'nextcloud-aio-borgbackup') {
544+
if (str_starts_with($container->GetIdentifier(), 'nextcloud-aio-borgbackup')) {
545545
// Additional backup directories
546546
foreach ($this->getAllBackupVolumes() as $additionalBackupVolumes) {
547547
if ($additionalBackupVolumes !== '') {
548548
$mounts[] = ["Type" => "volume", "Source" => $additionalBackupVolumes, "Target" => "/nextcloud_aio_volumes/" . $additionalBackupVolumes, "ReadOnly" => false];
549549
}
550550
}
551+
552+
// Make volumes read only in case of borgbackup container. The viewer makes them writeable
553+
$isReadOnly = $container->GetIdentifier() === 'nextcloud-aio-borgbackup';
554+
551555
foreach ($this->configurationManager->GetAdditionalBackupDirectoriesArray() as $additionalBackupDirectories) {
552556
if ($additionalBackupDirectories !== '') {
553557
if (!str_starts_with($additionalBackupDirectories, '/')) {
554-
$mounts[] = ["Type" => "volume", "Source" => $additionalBackupDirectories, "Target" => "/docker_volumes/" . $additionalBackupDirectories, "ReadOnly" => true];
558+
$mounts[] = ["Type" => "volume", "Source" => $additionalBackupDirectories, "Target" => "/docker_volumes/" . $additionalBackupDirectories, "ReadOnly" => $isReadOnly];
555559
} else {
556-
$mounts[] = ["Type" => "bind", "Source" => $additionalBackupDirectories, "Target" => "/host_mounts" . $additionalBackupDirectories, "ReadOnly" => true, "BindOptions" => ["NonRecursive" => true]];
560+
$mounts[] = ["Type" => "bind", "Source" => $additionalBackupDirectories, "Target" => "/host_mounts" . $additionalBackupDirectories, "ReadOnly" => $isReadOnly, "BindOptions" => ["NonRecursive" => true]];
557561
}
558562
}
559563
}

‎php/templates/containers.twig

+3
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,9 @@
504504
{% endif %}
505505

506506
{% if has_backup_run_once == true %}
507+
<h3>Backup Viewer</h3>
508+
<p>There is now a community container that allows to access your backups in a web session. See <a href="https://github.com/nextcloud/all-in-one/tree/main/community-containers/borgbackup-viewer"><strong>this documentation</strong></a>.</p>
509+
507510
<h3>Backup check</h3>
508511
<p>Click on the button below to perform a backup integrity check. This is an option that verifies that your backup is intact. It shouldn't be needed in most situations.</p>
509512
<form method="POST" action="/api/docker/backup-check" class="xhr">

‎readme.md

+6
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ In this example, it would mount `E:\your\backup\path` into the volume so for a d
493493
#### Pro-tip: Backup archives access
494494
You can open the BorgBackup archives on your host by following these steps:<br>
495495
(instructions for Ubuntu Desktop)
496+
497+
Alternatively, there is now a community container that allows to access your backups in a web session: https://github.com/nextcloud/all-in-one/tree/main/community-containers/borgbackup-viewer.
498+
496499
```bash
497500
# Install borgbackup on the host
498501
sudo apt update && sudo apt install borgbackup
@@ -520,6 +523,9 @@ sudo umount /tmp/borg
520523
#### Delete backup archives manually
521524
You can delete BorgBackup archives on your host manually by following these steps:<br>
522525
(instructions for Debian based OS' like Ubuntu)
526+
527+
Alternatively, there is now a community container that allows to access your backups in a web session: https://github.com/nextcloud/all-in-one/tree/main/community-containers/borgbackup-viewer.
528+
523529
```bash
524530
# Install borgbackup on the host
525531
sudo apt update && sudo apt install borgbackup

0 commit comments

Comments
 (0)
Please sign in to comment.