Make encrypted storage requirement host configurable

This commit is contained in:
howard committed 2026-11-01 11:50:58 +13:00
1 parent 657ac97ee7
commit 06aa75095c
3 files changed
+14 -9

No files matched your search

+2
View File
@@ -18,6 +18,8 @@ ZSTD_EXTRA_OPTS="-T0 -12"
TAR_EXCLUDES=""
# Final backup-run reports retained locally for this many days.
BACKUP_HISTORY_DAYS=30
# Set to 1 when BACKUP_ROOT must reside on encrypted storage (e.g. Beaver).
BACKUP_REQUIRE_ENCRYPTED_STORAGE=0
# Optional retained MQTT status and command listener settings.
MQTT_REPORT_ENABLED=0
+1
View File
@@ -83,6 +83,7 @@ Copy `.env.example` to `.env`; `.env` is ignored by Git. Important values:
| `TAR_EXCLUDES` | Space-separated archive paths to omit, relative to `SOURCE_BASE_DIR` |
| `BACKUP_HISTORY_FILE` | JSON Lines run-history file (default is shared with backup-status MCP) |
| `BACKUP_HISTORY_DAYS` | Days of completed run history to retain, default `30` |
| `BACKUP_REQUIRE_ENCRYPTED_STORAGE` | Refuse to run unless `/dockerbackups` is on `/srv/storage`; default `0` |
| `KEEP_COUNT` | Local archives retained per Compose project |
| `PULL_IMAGES` | Pull images before restarting (`1` or `0`) |
+11 -9
View File
@@ -25,6 +25,7 @@ ZSTD_EXTRA_OPTS="-T0 -12"
TAR_EXCLUDES=""
BACKUP_HISTORY_FILE="/dockervolumes/openclaw/backup-status-mcp/history/backup-runs.jsonl"
BACKUP_HISTORY_DAYS=30
BACKUP_REQUIRE_ENCRYPTED_STORAGE=0
# Optional MQTT reporting and command-listener defaults.
MQTT_REPORT_ENABLED=0
MQTT_HOST=""
@@ -71,8 +72,16 @@ return 0
}
die() { log ERROR "$1"; exit "${2:-1}"; }
# Never let local backups silently fall back to the unencrypted root filesystem.
if [[ "$BACKUP_ROOT" == "/dockerbackups" ]]; then
is_true() {
case "${1,,}" in
1|true|yes|on|enabled) return 0 ;;
*) return 1 ;;
esac
}
# Never let local backups silently fall back to the unencrypted root filesystem
# on hosts that opt in (for example, Beaver's encrypted backup drive).
if is_true "${BACKUP_REQUIRE_ENCRYPTED_STORAGE:-0}" && [[ "$BACKUP_ROOT" == "/dockerbackups" ]]; then
if ! mountpoint -q /srv/storage || ! mountpoint -q "$BACKUP_ROOT"; then
die "Backup root is not mounted on encrypted storage; refusing to run."
fi
@@ -83,13 +92,6 @@ if [[ "$BACKUP_ROOT" == "/dockerbackups" ]]; then
fi
fi
is_true() {
case "${1,,}" in
1|true|yes|on|enabled) return 0 ;;
*) return 1 ;;
esac
}
require_command() {
command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1" 3
}