Skip to content

Commit 8dcbb30

Browse files
committed
add borgbackup-viewer community container
Signed-off-by: Simon L. <[email protected]>
1 parent c19ba34 commit 8dcbb30

File tree

3 files changed

+89
-3
lines changed

3 files changed

+89
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
],
23+
"secrets": [
24+
"BORGBACKUP_VIEWER_PASSWORD"
25+
],
26+
"volumes": [
27+
{
28+
"source": "nextcloud_aio_backup_cache",
29+
"destination": "/root",
30+
"writeable": true
31+
},
32+
{
33+
"source": "%NEXTCLOUD_DATADIR%",
34+
"destination": "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data",
35+
"writeable": true
36+
},
37+
{
38+
"source": "nextcloud_aio_mastercontainer",
39+
"destination": "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer",
40+
"writeable": true
41+
},
42+
{
43+
"source": "%BORGBACKUP_HOST_LOCATION%",
44+
"destination": "/mnt/borgbackup",
45+
"writeable": true
46+
},
47+
{
48+
"source": "nextcloud_aio_elasticsearch",
49+
"destination": "/nextcloud_aio_volumes/nextcloud_aio_elasticsearch",
50+
"writeable": true
51+
},
52+
{
53+
"source": "nextcloud_aio_redis",
54+
"destination": "/mnt/redis",
55+
"writeable": true
56+
}
57+
],
58+
"devices": [
59+
"/dev/fuse"
60+
],
61+
"cap_add": [
62+
"SYS_ADMIN"
63+
],
64+
"apparmor_unconfined": true
65+
}
66+
]
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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. You need to type in the password for borg next that is shown in the AIO interface. 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 ...
7+
- After you are done with the operation, you should 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
8+
- See https://github.com/nextcloud/all-in-one/tree/main/community-containers#community-containers how to add it to the AIO stack
9+
10+
### Repository
11+
https://github.com/szaimen/aio-borgbackup-viewer
12+
13+
### Maintainer
14+
https://github.com/szaimen
15+

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
}

0 commit comments

Comments
 (0)