Skip to content

Commit 8ae5262

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

File tree

3 files changed

+91
-3
lines changed

3 files changed

+91
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
],
24+
"secrets": [
25+
"BORGBACKUP_VIEWER_PASSWORD",
26+
"BORGBACKUP_PASSWORD"
27+
],
28+
"volumes": [
29+
{
30+
"source": "nextcloud_aio_backup_cache",
31+
"destination": "/root",
32+
"writeable": true
33+
},
34+
{
35+
"source": "%NEXTCLOUD_DATADIR%",
36+
"destination": "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data",
37+
"writeable": true
38+
},
39+
{
40+
"source": "nextcloud_aio_mastercontainer",
41+
"destination": "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer",
42+
"writeable": true
43+
},
44+
{
45+
"source": "%BORGBACKUP_HOST_LOCATION%",
46+
"destination": "/mnt/borgbackup",
47+
"writeable": true
48+
},
49+
{
50+
"source": "nextcloud_aio_elasticsearch",
51+
"destination": "/nextcloud_aio_volumes/nextcloud_aio_elasticsearch",
52+
"writeable": true
53+
},
54+
{
55+
"source": "nextcloud_aio_redis",
56+
"destination": "/mnt/redis",
57+
"writeable": true
58+
}
59+
],
60+
"devices": [
61+
"/dev/fuse"
62+
],
63+
"cap_add": [
64+
"SYS_ADMIN"
65+
],
66+
"apparmor_unconfined": true
67+
}
68+
]
69+
}
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 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. You should afterwards 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)