86 lines
2.4 KiB
Markdown
86 lines
2.4 KiB
Markdown
# Syncthing
|
|
|
|
```sh
|
|
sudo systemctl restart syncthing@photoprism.service
|
|
```
|
|
|
|
Admin interface: http://192.168.1.10:8384/
|
|
|
|
I have a user called `photoprism` and the password is in Bitwarden
|
|
|
|
# Borg Backup to Hetzner Storage Box
|
|
|
|
For backup I use [Borg](https://borgbackup.readthedocs.io/). I followed the steps described in this community article:
|
|
|
|
* [Install and Configure BorgBackup](https://community.hetzner.com/tutorials/install-and-configure-borgbackup)
|
|
|
|
We have two backups in the storage box:
|
|
|
|
* `/./borgbackup/photoprism`
|
|
* `/./borgbackup/nextcloud`
|
|
|
|
## Photoprism backup
|
|
|
|
This is what I did for Photoprism
|
|
|
|
The init script (which is only done once, be careful it will overwrite!):
|
|
|
|
```sh
|
|
# (As root)
|
|
export BORG_RSH='ssh -i /root/.ssh/id_ed25519'
|
|
export BORG_PASSPHRASE="<I GENERATED A PASSPHRASE>"
|
|
borg init --encryption=repokey ssh://u388089@u388089.your-storagebox.de:23/./borgbackup/photoprism
|
|
```
|
|
|
|
It outputs a key which I put in Bitwarden (you need it to decrypt the backup).
|
|
|
|
To make a manual backup:
|
|
|
|
```sh
|
|
export BORG_RSH='ssh -i /root/.ssh/id_ed25519'
|
|
export BORG_PASSPHRASE="<SEE BITWARDEN>"
|
|
borg create --stats ssh://u388089@u388089.your-storagebox.de:23/./borgbackup/photoprism::2024_11_24 /home/photoprism/Import/ /home/photoprism/Pictures/
|
|
```
|
|
|
|
The above can be found in Bitwarden, look for "Hetzner Borg Backup Script for Photoprism"
|
|
|
|
I also created a bash script in `/usr/local/bin/photoprism_backup.sh` (as mentioned in the article).
|
|
|
|
You can find it here in this repo:
|
|
|
|
* [photoprism_backup.sh](./scripts/photoprism_backup.sh)
|
|
|
|
## Nextcloud backup
|
|
|
|
Ok, this is confusing but Nextcloud uses Borgbackup internally. Go to the [aio interface](http://192.168.1.10:8080/) and you'll notice there are backups to:
|
|
|
|
```
|
|
/root/nextcloudbackup
|
|
```
|
|
|
|
So nextcloud keeps making backups to this directory. Not ideal (TODO: I gotta find a solution for this).
|
|
|
|
But I can rclone the data:
|
|
|
|
```sh
|
|
rclone sync -v /root/nextcloudbackup/ hetzner:/cloned_borgbackup/nextcloud
|
|
```
|
|
|
|
For this I also created a script and placed it in `/usr/local/bin`
|
|
|
|
[nextcloud_backup.sh](./scripts/nextcloud_backup.sh)
|
|
|
|
# Automatic backup
|
|
|
|
* [cloud_backup.service](./scripts/cloud_backup.service)
|
|
* [cloud_backup.timer](./scripts/cloud_backup.timer)
|
|
|
|
```sh
|
|
cp -v cloud_backup.service /etc/systemd/system/
|
|
cp -v cloud_backup.timer /etc/systemd/system/
|
|
```
|
|
|
|
```sh
|
|
systemctl enable cloud_backup.service
|
|
systemctl enable cloud_backup.timer
|
|
```
|