backup.sh
1#!/usr/bin/env bash
2set -euo pipefail
3
4# The rclone config comes via RCLONE_CONFIG (a Colmena key in
5# /var/lib/servers-keys). A failed backup shows on /healthz once the last
6# success is over 26h old.
7
8log() {
9 echo "[$(date -u +'%Y-%m-%dT%H:%M:%SZ')] $1"
10}
11
12log "starting soft-serve backup"
13
14if $RCLONE sync -L /var/soft/data/ r2:soft-serve/; then
15 log "completed soft-serve backup"
16 # forge-healthz reports the backup stale when this is over 26h old.
17 touch /var/lib/forge-backup/last-success
18else
19 log "soft-serve backup failed"
20 exit 1
21fi