docs.benjamin-altpeter.de

Backghup

Runs in an unprivileged Ubuntu 22.04 LXC container.

Setup #

Based on 1.

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
apt install nodejs retry

npm i -g backghup

mkdir ~/gh-backups
# Populate with:
# export GITHUB_TOKEN=<token>
nano ~/env-backghup.sh

# Try it manually once:
source ~/env-backghup.sh
backghup --extract --out-dir ~/gh-backups

The data is backed up to Backblaze B2 using restic. Follow the steps in Net/Restic. Use the backup script below. Use retry --delay 10 --times 3 -- /root/backup-restic-b2.sh as the command in the cronjob.

Backup script (backup-restic-b2.sh) #

#!/bin/bash

set -e

source /root/env-backghup.sh
source /root/env-restic-b2.sh

/usr/bin/backghup --extract --out-dir /root/gh-backups --exclude Raabeschule --exclude getbookshelf --exclude Keeping-Privacy-Labels-Honest

BACKUPDIR="/root/gh-backups"

restic backup "$BACKUPDIR"